update encodable_sequences
@@ -132,7 +132,12 @@ class EncodableSequences(object):
@classmethod
def sequences_to_fixed_length_index_encoded_array(
- klass, sequences, left_edge=4, right_edge=4, max_length=15):
+ klass,
+ sequences,
+ alignment_method="pad_middle",
+ left_edge=4,
+ right_edge=4,
+ max_length=15):
"""
Transform a sequence of strings, where each string is of length at least
left_edge + right_edge and at most max_length into strings of length
@@ -161,7 +166,8 @@ class EncodableSequences(object):
-------
numpy array of shape (len(sequences), max_length) and dtype int
"""
-
+ result = None
+ if alignment_method == 'pad_middle':
# Result array is int32, filled with X (null amino acid) value.
result = numpy.full(
fill_value=amino_acid.AMINO_ACID_INDEX['X'],
@@ -220,4 +226,9 @@ class EncodableSequences(object):
sub_df.index,
-right_edge:
] = fixed_length_sequences[:, -right_edge:]
+ elif alignment_method == "left_pad_right_pad":
+ raise NotImplementedError
+ else:
+ raise NotImplementedError(
+ "Unsupported alignment method: %s" % alignment_method)
return result
