File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change 1
1
class Constants :
2
2
3
- VERSION = "1.0.8 "
3
+ VERSION = "1.0.9 "
4
4
5
5
# encoding constants
6
6
FEATURE_DELIMITER = "-"
Original file line number Diff line number Diff line change 10
10
from ligo .environment .EnvironmentSettings import EnvironmentSettings
11
11
from ligo .environment .SequenceType import SequenceType
12
12
from ligo .simulation .implants .Motif import Motif
13
+ from ligo .simulation .implants .MotifInstance import MotifInstance
13
14
14
15
15
16
@dataclass
@@ -57,11 +58,13 @@ def get_alphabet(self) -> List[str]:
57
58
return list (self .pwm_matrix .alphabet )
58
59
59
60
def instantiate_motif (self , sequence_type : SequenceType = SequenceType .AMINO_ACID ):
60
- if len (EnvironmentSettings .get_sequence_alphabet (sequence_type )) != self .pwm_matrix .alphabet :
61
- raise RuntimeError (f"{ LigoPWM .__name__ } : could not instantiate motif for sequence type { sequence_type .name } ,"
62
- f" check if the motif sequence type is a match at { self .file_path } ." )
61
+ if EnvironmentSettings .get_sequence_alphabet (sequence_type ) != sorted (list (self .pwm_matrix .alphabet )):
62
+ raise RuntimeError (
63
+ f"{ LigoPWM .__name__ } : could not instantiate motif for sequence type { sequence_type .name } ,"
64
+ f" check if the motif sequence type is a match at { self .file_path } ." )
63
65
64
66
counts_per_position = np .exp (self .pwm_matrix ._matrix + np .log ([0.25 ])[:, np .newaxis ])
65
67
66
- return "" .join ([random .choices (list (self .pwm_matrix .alphabet ), weights = counts_per_position [:, position ])[0 ]
67
- for position in range (self .pwm_matrix .window_size )])
68
+ return MotifInstance (
69
+ "" .join ([random .choices (list (self .pwm_matrix .alphabet ), weights = counts_per_position [:, position ])[0 ]
70
+ for position in range (self .pwm_matrix .window_size )]), gap = 0 )
You can’t perform that action at this time.
0 commit comments