Class AbstractAlignment
source code
object --+
|
AbstractAlignment
- Known Subclasses:
-
Base class for all alignment objects.
Provides 1-based access to the alignment.rows and alignment.columns.
Alignment rows can also be accessed by sequence ID. In addition, all
alignments support 0-based slicing:
>>> alignment[rows, columns]
AbstractAlignment (sub-alignment)
where
-
rows
can be a slice, tuple of row indexes or tuple of
sequence IDs
-
columns can be a slice or tuple of column indexes
For example:
>>> alignment[:, 2:]
AbstractAlignment # all rows, columns [3, alignment.length]
>>> alignment[(0, 'seqx'), (3, 5)]
AbstractAlignment # rows #1 and 'seq3', columns #4 and #5
Note:
if strict
is False and there are
sequences
with redundant identifiers, those sequences
will be added to the rows
collection with :An suffix,
where n is a serial number. Therefore, rows['ID'] will return only
one sequence, the first sequence with id=ID. All remaining
sequences can be retrieved with rows['ID:A1']
,
{rows['ID:A2']}, etc. However, the sequence objects will remain
intact, e.g. {rows['ID:A1'].id} still returns 'ID' and not 'ID:A1'.
|
__metaclass__
Metaclass for defining Abstract Base Classes (ABCs).
|
|
|
|
__init__(self,
sequences,
strict=True)
x.__init__(...) initializes x; see help(type(x)) for signature |
source code
|
|
|
|
|
add(self,
sequence)
Append a new sequence to the alignment. |
source code
|
|
str
|
format(self,
format=FASTA,
headers=True)
Format the alignment as a string. |
source code
|
|
bool
|
|
AbstractAlignment
|
|
Inherited from object :
__delattr__ ,
__format__ ,
__getattribute__ ,
__hash__ ,
__new__ ,
__reduce__ ,
__reduce_ex__ ,
__repr__ ,
__setattr__ ,
__sizeof__ ,
__str__ ,
__subclasshook__
|
|
__abstractmethods__ = frozenset([ ' _construct ' ])
|
ColumnIndexer
|
columns
1-based access to the alignment columns
|
int
|
length
Number of columns in the alignment
|
AlignmentRowsTable
|
rows
1-based access to the alignment entries (sequences)
|
int
|
size
Number of rows (sequences) in the alignment
|
Inherited from object :
__class__
|
__init__(self,
sequences,
strict=True)
(Constructor)
| source code
|
x.__init__(...) initializes x; see help(type(x)) for signature
- Parameters:
sequences (list of AbstractSequences) - alignment entries (must have equal length)
strict (bool) - if True, raise {DuplicateSequenceError} when a duplicate ID is
found (default=True)
- Overrides:
object.__init__
- (inherited documentation)
|
Append a new sequence to the alignment.
- Parameters:
- Raises:
|
Format the alignment as a string.
- Parameters:
- Returns: str
|
Return True of column contains at least one gap.
- Parameters:
column (int) - column number, 1-based
- Returns: bool
|
Extract a sub-alignment, ranging from start to
end columns.
- Parameters:
start (int) - starting column, 1-based
end (int) - ending column, 1-based
- Returns: AbstractAlignment
- a new alignment of the current type
- Raises:
|
columns
1-based access to the alignment columns
- Get Method:
- unreachable.columns(self)
- 1-based access to the alignment columns
- Type:
- ColumnIndexer
|
length
Number of columns in the alignment
- Get Method:
- unreachable.length(self)
- Number of columns in the alignment
- Type:
- int
|
rows
1-based access to the alignment entries (sequences)
- Get Method:
- unreachable.rows(self)
- 1-based access to the alignment entries (sequences)
- Type:
- AlignmentRowsTable
|
size
Number of rows (sequences) in the alignment
- Get Method:
- unreachable.size(self)
- Number of rows (sequences) in the alignment
- Type:
- int
|