def __init__(self, data, comments = list()):
"""
Data structure for storing a sequence of amino acids.
The latter is represented by a contiguous array of integers.
The mapping between the amino acids and their numeric value
is done by using the ascii table.
Attributes
----------
comments [list] : list of informations about the sequence parsed from the FASTA file
The list is constructed by splitting the comments using the ' ' delimiter
N [int] : length of the sequence
data [np.ndarray] : contiguous array containing the ascii values of the amino acids
"""
self.comments = comments
self.N = len(data)
if isinstance(data, np.ndarray):
self.data = data
else:
# If a string is passed, the latter is converted to a numpy array
self.data = np.empty(self.N, dtype = np.int16)
for i in range(self.N):
self.data[i] = Sequence.charToInt(data[i])
评论列表
文章目录