bioinform 0.1.17 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +3 -3
- data/LICENSE +0 -1
- data/README.md +1 -1
- data/TODO.txt +23 -30
- data/bin/convert_motif +4 -0
- data/bin/pcm2pwm +1 -1
- data/bin/split_motifs +1 -1
- data/bioinform.gemspec +0 -2
- data/lib/bioinform.rb +54 -16
- data/lib/bioinform/alphabet.rb +85 -0
- data/lib/bioinform/background.rb +90 -0
- data/lib/bioinform/cli.rb +1 -2
- data/lib/bioinform/cli/convert_motif.rb +52 -17
- data/lib/bioinform/cli/pcm2pwm.rb +32 -26
- data/lib/bioinform/cli/split_motifs.rb +31 -30
- data/lib/bioinform/conversion_algorithms.rb +6 -0
- data/lib/bioinform/conversion_algorithms/pcm2ppm_converter.rb +13 -11
- data/lib/bioinform/conversion_algorithms/pcm2pwm_converter.rb +39 -11
- data/lib/bioinform/conversion_algorithms/pcm2pwm_mara_converter.rb +26 -0
- data/lib/bioinform/conversion_algorithms/ppm2pcm_converter.rb +30 -0
- data/lib/bioinform/conversion_algorithms/pwm2iupac_pwm_converter.rb +23 -0
- data/lib/bioinform/conversion_algorithms/pwm2pcm_converter.rb +85 -0
- data/lib/bioinform/data_models.rb +1 -7
- data/lib/bioinform/data_models/named_model.rb +38 -0
- data/lib/bioinform/data_models/pcm.rb +18 -28
- data/lib/bioinform/data_models/pm.rb +73 -170
- data/lib/bioinform/data_models/ppm.rb +11 -24
- data/lib/bioinform/data_models/pwm.rb +30 -56
- data/lib/bioinform/errors.rb +17 -0
- data/lib/bioinform/formatters.rb +4 -2
- data/lib/bioinform/formatters/consensus_formatter.rb +35 -0
- data/lib/bioinform/formatters/motif_formatter.rb +69 -0
- data/lib/bioinform/formatters/pretty_matrix_formatter.rb +36 -0
- data/lib/bioinform/formatters/transfac_formatter.rb +29 -37
- data/lib/bioinform/parsers.rb +1 -8
- data/lib/bioinform/parsers/matrix_parser.rb +44 -36
- data/lib/bioinform/parsers/motif_splitter.rb +45 -0
- data/lib/bioinform/support.rb +46 -14
- data/lib/bioinform/support/strip_doc.rb +1 -1
- data/lib/bioinform/version.rb +1 -1
- data/spec/alphabet_spec.rb +79 -0
- data/spec/background_spec.rb +57 -0
- data/spec/cli/cli_spec.rb +6 -6
- data/spec/cli/convert_motif_spec.rb +88 -88
- data/spec/cli/data/pcm2pwm/KLF4_f2.pwm.result +9 -9
- data/spec/cli/data/pcm2pwm/SP1_f1.pwm.result +11 -11
- data/spec/cli/pcm2pwm_spec.rb +22 -23
- data/spec/cli/shared_examples/convert_motif/motif_list_empty.rb +1 -1
- data/spec/cli/shared_examples/convert_motif/several_motifs_specified.rb +1 -1
- data/spec/cli/shared_examples/convert_motif/single_motif_specified.rb +5 -5
- data/spec/cli/shared_examples/convert_motif/yield_help_string.rb +2 -2
- data/spec/cli/shared_examples/convert_motif/yield_motif_conversion_error.rb +3 -3
- data/spec/cli/split_motifs_spec.rb +6 -21
- data/spec/converters/pcm2ppm_converter_spec.rb +32 -0
- data/spec/converters/pcm2pwm_converter_spec.rb +71 -0
- data/spec/converters/ppm2pcm_converter_spec.rb +32 -0
- data/spec/converters/pwm2iupac_pwm_converter_spec.rb +65 -0
- data/spec/converters/pwm2pcm_converter_spec.rb +57 -0
- data/spec/data_models/named_model_spec.rb +41 -0
- data/spec/data_models/pcm_spec.rb +114 -45
- data/spec/data_models/pm_spec.rb +132 -333
- data/spec/data_models/ppm_spec.rb +47 -44
- data/spec/data_models/pwm_spec.rb +85 -77
- data/spec/fabricators/motif_formats_fabricator.rb +116 -116
- data/spec/formatters/consensus_formatter_spec.rb +26 -0
- data/spec/formatters/raw_formatter_spec.rb +169 -0
- data/spec/parsers/matrix_parser_spec.rb +216 -0
- data/spec/parsers/motif_splitter_spec.rb +87 -0
- data/spec/spec_helper.rb +2 -2
- data/spec/spec_helper_source.rb +25 -5
- data/spec/support_spec.rb +31 -0
- metadata +43 -124
- data/bin/merge_into_collection +0 -4
- data/lib/bioinform/cli/merge_into_collection.rb +0 -80
- data/lib/bioinform/conversion_algorithms/ppm2pwm_converter.rb +0 -0
- data/lib/bioinform/data_models/collection.rb +0 -75
- data/lib/bioinform/data_models/motif.rb +0 -56
- data/lib/bioinform/formatters/raw_formatter.rb +0 -41
- data/lib/bioinform/parsers/jaspar_parser.rb +0 -35
- data/lib/bioinform/parsers/parser.rb +0 -92
- data/lib/bioinform/parsers/splittable_parser.rb +0 -57
- data/lib/bioinform/parsers/string_fantom_parser.rb +0 -35
- data/lib/bioinform/parsers/string_parser.rb +0 -72
- data/lib/bioinform/parsers/trivial_parser.rb +0 -34
- data/lib/bioinform/parsers/yaml_parser.rb +0 -35
- data/lib/bioinform/support/advanced_scan.rb +0 -8
- data/lib/bioinform/support/array_product.rb +0 -6
- data/lib/bioinform/support/array_zip.rb +0 -6
- data/lib/bioinform/support/collect_hash.rb +0 -7
- data/lib/bioinform/support/deep_dup.rb +0 -5
- data/lib/bioinform/support/delete_many.rb +0 -14
- data/lib/bioinform/support/inverf.rb +0 -13
- data/lib/bioinform/support/multiline_squish.rb +0 -6
- data/lib/bioinform/support/parameters.rb +0 -28
- data/lib/bioinform/support/partial_sums.rb +0 -16
- data/lib/bioinform/support/same_by.rb +0 -12
- data/lib/bioinform/support/third_part/active_support/core_ext/array/extract_options.rb +0 -29
- data/lib/bioinform/support/third_part/active_support/core_ext/hash/indifferent_access.rb +0 -23
- data/lib/bioinform/support/third_part/active_support/core_ext/hash/keys.rb +0 -54
- data/lib/bioinform/support/third_part/active_support/core_ext/module/attribute_accessors.rb +0 -64
- data/lib/bioinform/support/third_part/active_support/core_ext/object/try.rb +0 -57
- data/lib/bioinform/support/third_part/active_support/core_ext/string/access.rb +0 -99
- data/lib/bioinform/support/third_part/active_support/core_ext/string/behavior.rb +0 -6
- data/lib/bioinform/support/third_part/active_support/core_ext/string/filters.rb +0 -49
- data/lib/bioinform/support/third_part/active_support/core_ext/string/multibyte.rb +0 -72
- data/lib/bioinform/support/third_part/active_support/hash_with_indifferent_access.rb +0 -181
- data/lib/bioinform/support/third_part/active_support/multibyte.rb +0 -44
- data/lib/bioinform/support/third_part/active_support/multibyte/chars.rb +0 -476
- data/lib/bioinform/support/third_part/active_support/multibyte/exceptions.rb +0 -8
- data/lib/bioinform/support/third_part/active_support/multibyte/unicode.rb +0 -393
- data/lib/bioinform/support/third_part/active_support/multibyte/utils.rb +0 -60
- data/spec/cli/data/merge_into_collection/GABPA_f1.pwm +0 -14
- data/spec/cli/data/merge_into_collection/KLF4_f2.pwm +0 -11
- data/spec/cli/data/merge_into_collection/SP1_f1.pwm +0 -12
- data/spec/cli/data/merge_into_collection/collection.txt.result +0 -40
- data/spec/cli/data/merge_into_collection/collection.yaml.result +0 -188
- data/spec/cli/data/merge_into_collection/collection_pwm.yaml.result +0 -188
- data/spec/cli/data/merge_into_collection/pwm_folder/GABPA_f1.pwm +0 -14
- data/spec/cli/data/merge_into_collection/pwm_folder/KLF4_f2.pwm +0 -11
- data/spec/cli/data/merge_into_collection/pwm_folder/SP1_f1.pwm +0 -12
- data/spec/cli/data/split_motifs/collection.yaml +0 -188
- data/spec/cli/merge_into_collection_spec.rb +0 -100
- data/spec/data_models/collection_spec.rb +0 -98
- data/spec/data_models/motif_spec.rb +0 -224
- data/spec/fabricators/collection_fabricator.rb +0 -8
- data/spec/fabricators/motif_fabricator.rb +0 -33
- data/spec/fabricators/pcm_fabricator.rb +0 -25
- data/spec/fabricators/pm_fabricator.rb +0 -52
- data/spec/fabricators/ppm_fabricator.rb +0 -14
- data/spec/fabricators/pwm_fabricator.rb +0 -16
- data/spec/parsers/parser_spec.rb +0 -152
- data/spec/parsers/string_fantom_parser_spec.rb +0 -70
- data/spec/parsers/string_parser_spec.rb +0 -77
- data/spec/parsers/trivial_parser_spec.rb +0 -64
- data/spec/parsers/yaml_parser_spec.rb +0 -50
- data/spec/support/advanced_scan_spec.rb +0 -32
- data/spec/support/array_product_spec.rb +0 -15
- data/spec/support/array_zip_spec.rb +0 -15
- data/spec/support/collect_hash_spec.rb +0 -15
- data/spec/support/delete_many_spec.rb +0 -44
- data/spec/support/inverf_spec.rb +0 -19
- data/spec/support/multiline_squish_spec.rb +0 -25
- data/spec/support/partial_sums_spec.rb +0 -30
- data/spec/support/same_by_spec.rb +0 -36
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
GABPA_f1
|
|
2
|
-
-0.1106670158341858 0.013801606113892391 0.6054596108973699 -1.3518085041421573
|
|
3
|
-
0.37030668921643345 0.15761121480429963 0.009069314183831202 -0.9888619717703562
|
|
4
|
-
0.47526546359546684 -0.3011678534572083 0.4031522994412777 -1.8638752827041059
|
|
5
|
-
-1.5544255540164373 1.1082369687811506 -0.2814091552834454 -5.30708531823271
|
|
6
|
-
-0.6362037835776368 1.235338189985594 -3.5801322928552253 -5.717323067092849
|
|
7
|
-
-5.852906870733575 -5.852906870733575 1.3841383838057746 -5.852906870733575
|
|
8
|
-
-5.852906870733575 -5.852906870733575 1.3841383838057746 -5.852906870733575
|
|
9
|
-
1.3835219739184708 -5.2341956006430985 -5.852906870733575 -5.852906870733575
|
|
10
|
-
1.3756340514956562 -5.394962755562375 -5.394962755562375 -3.401117964959733
|
|
11
|
-
-1.2176198315414444 -3.109079898175411 1.2964067931472216 -5.717323067092849
|
|
12
|
-
-1.3716559438167257 -0.2761401935045069 -1.8504445165866068 1.0404320473626856
|
|
13
|
-
-0.5440863133031895 -0.48103682561971345 0.907381908447086 -1.1280642594012078
|
|
14
|
-
0.10557340209290218 -0.01814819455289191 0.4381106695354074 -1.0304105539540915
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
KLF4_f2
|
|
2
|
-
0.30861857265872605 -2.254321000121579 0.13505703522674192 0.3285194224375633
|
|
3
|
-
-1.227018967707036 -4.814127713368663 1.3059890687390967 -4.908681463544344
|
|
4
|
-
-2.443469374521196 -4.648238485031404 1.3588686548279805 -4.441801801188402
|
|
5
|
-
-2.7177827948276123 -3.8073538975356565 1.356272809724262 -3.504104725510225
|
|
6
|
-
-0.5563232977367343 0.5340697765121405 -3.61417723090579 0.5270259776377405
|
|
7
|
-
-1.8687622060887386 -4.381483976582316 1.337932245336098 -3.815629658877517
|
|
8
|
-
-2.045671123823928 -2.384975142213679 0.7198551207724355 0.5449254135616948
|
|
9
|
-
-1.373157530374372 -3.0063112097748217 1.285188335493552 -2.5026044231773543
|
|
10
|
-
-2.1030513122772208 -1.8941348100402244 1.249265758393991 -1.4284210948906104
|
|
11
|
-
-1.3277128628152939 0.8982415633049462 -0.8080773665408135 -0.18161647647456935
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
SP1_f1
|
|
2
|
-
-0.24435707885585292 -0.674823404693731 0.8657012535789866 -1.1060188862599287
|
|
3
|
-
-1.0631255752097797 -2.111925969423868 1.0960627561110403 -0.6138563775211977
|
|
4
|
-
-0.3872276234760535 -2.9739851913218045 1.1807800242010378 -4.338927525031566
|
|
5
|
-
-4.563896055436894 -2.9161633002532277 1.3684371349982638 -5.077972423609655
|
|
6
|
-
-2.2369752892820083 -3.7196436313301846 1.3510439136452734 -4.889930670508233
|
|
7
|
-
-0.07473964149330865 0.944919654762011 -2.6246857648086044 -0.8510983487822436
|
|
8
|
-
-1.9643526491643322 -2.978402770880115 1.3113096718240573 -2.324334259499025
|
|
9
|
-
-4.0155484139655835 -3.1384268078096667 1.3387488589788057 -2.084673903537648
|
|
10
|
-
-0.44509385828355363 -2.2510053061629702 1.1265431574368685 -1.7780413702431372
|
|
11
|
-
-1.1896356092245048 -1.2251832285630027 1.1636760063747527 -1.6080243648157353
|
|
12
|
-
-0.5166047365590571 0.7641033353626657 -0.2862677570028208 -0.68254820978656
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
--- !ruby/object:Bioinform::Collection
|
|
2
|
-
container:
|
|
3
|
-
- !ruby/object:Bioinform::Motif
|
|
4
|
-
parameters: !ruby/object:OpenStruct
|
|
5
|
-
table:
|
|
6
|
-
:original_data_model: :pwm
|
|
7
|
-
:pwm: !ruby/object:Bioinform::PWM
|
|
8
|
-
parameters: !ruby/object:OpenStruct
|
|
9
|
-
table:
|
|
10
|
-
:name: GABPA_f1
|
|
11
|
-
:background:
|
|
12
|
-
- 1
|
|
13
|
-
- 1
|
|
14
|
-
- 1
|
|
15
|
-
- 1
|
|
16
|
-
modifiable: true
|
|
17
|
-
matrix:
|
|
18
|
-
- - -0.1106670158341858
|
|
19
|
-
- 0.013801606113892391
|
|
20
|
-
- 0.6054596108973699
|
|
21
|
-
- -1.3518085041421573
|
|
22
|
-
- - 0.37030668921643345
|
|
23
|
-
- 0.15761121480429963
|
|
24
|
-
- 0.009069314183831202
|
|
25
|
-
- -0.9888619717703562
|
|
26
|
-
- - 0.47526546359546684
|
|
27
|
-
- -0.3011678534572083
|
|
28
|
-
- 0.4031522994412777
|
|
29
|
-
- -1.8638752827041059
|
|
30
|
-
- - -1.5544255540164373
|
|
31
|
-
- 1.1082369687811506
|
|
32
|
-
- -0.2814091552834454
|
|
33
|
-
- -5.30708531823271
|
|
34
|
-
- - -0.6362037835776368
|
|
35
|
-
- 1.235338189985594
|
|
36
|
-
- -3.5801322928552253
|
|
37
|
-
- -5.717323067092849
|
|
38
|
-
- - -5.852906870733575
|
|
39
|
-
- -5.852906870733575
|
|
40
|
-
- 1.3841383838057746
|
|
41
|
-
- -5.852906870733575
|
|
42
|
-
- - -5.852906870733575
|
|
43
|
-
- -5.852906870733575
|
|
44
|
-
- 1.3841383838057746
|
|
45
|
-
- -5.852906870733575
|
|
46
|
-
- - 1.3835219739184708
|
|
47
|
-
- -5.2341956006430985
|
|
48
|
-
- -5.852906870733575
|
|
49
|
-
- -5.852906870733575
|
|
50
|
-
- - 1.3756340514956562
|
|
51
|
-
- -5.394962755562375
|
|
52
|
-
- -5.394962755562375
|
|
53
|
-
- -3.401117964959733
|
|
54
|
-
- - -1.2176198315414444
|
|
55
|
-
- -3.109079898175411
|
|
56
|
-
- 1.2964067931472216
|
|
57
|
-
- -5.717323067092849
|
|
58
|
-
- - -1.3716559438167257
|
|
59
|
-
- -0.2761401935045069
|
|
60
|
-
- -1.8504445165866068
|
|
61
|
-
- 1.0404320473626856
|
|
62
|
-
- - -0.5440863133031895
|
|
63
|
-
- -0.48103682561971345
|
|
64
|
-
- 0.907381908447086
|
|
65
|
-
- -1.1280642594012078
|
|
66
|
-
- - 0.10557340209290218
|
|
67
|
-
- -0.01814819455289191
|
|
68
|
-
- 0.4381106695354074
|
|
69
|
-
- -1.0304105539540915
|
|
70
|
-
modifiable: true
|
|
71
|
-
- !ruby/object:Bioinform::Motif
|
|
72
|
-
parameters: !ruby/object:OpenStruct
|
|
73
|
-
table:
|
|
74
|
-
:original_data_model: :pwm
|
|
75
|
-
:pwm: !ruby/object:Bioinform::PWM
|
|
76
|
-
parameters: !ruby/object:OpenStruct
|
|
77
|
-
table:
|
|
78
|
-
:name: KLF4_f2
|
|
79
|
-
:background:
|
|
80
|
-
- 1
|
|
81
|
-
- 1
|
|
82
|
-
- 1
|
|
83
|
-
- 1
|
|
84
|
-
modifiable: true
|
|
85
|
-
matrix:
|
|
86
|
-
- - 0.30861857265872605
|
|
87
|
-
- -2.254321000121579
|
|
88
|
-
- 0.13505703522674192
|
|
89
|
-
- 0.3285194224375633
|
|
90
|
-
- - -1.227018967707036
|
|
91
|
-
- -4.814127713368663
|
|
92
|
-
- 1.3059890687390967
|
|
93
|
-
- -4.908681463544344
|
|
94
|
-
- - -2.443469374521196
|
|
95
|
-
- -4.648238485031404
|
|
96
|
-
- 1.3588686548279805
|
|
97
|
-
- -4.441801801188402
|
|
98
|
-
- - -2.7177827948276123
|
|
99
|
-
- -3.8073538975356565
|
|
100
|
-
- 1.356272809724262
|
|
101
|
-
- -3.504104725510225
|
|
102
|
-
- - -0.5563232977367343
|
|
103
|
-
- 0.5340697765121405
|
|
104
|
-
- -3.61417723090579
|
|
105
|
-
- 0.5270259776377405
|
|
106
|
-
- - -1.8687622060887386
|
|
107
|
-
- -4.381483976582316
|
|
108
|
-
- 1.337932245336098
|
|
109
|
-
- -3.815629658877517
|
|
110
|
-
- - -2.045671123823928
|
|
111
|
-
- -2.384975142213679
|
|
112
|
-
- 0.7198551207724355
|
|
113
|
-
- 0.5449254135616948
|
|
114
|
-
- - -1.373157530374372
|
|
115
|
-
- -3.0063112097748217
|
|
116
|
-
- 1.285188335493552
|
|
117
|
-
- -2.5026044231773543
|
|
118
|
-
- - -2.1030513122772208
|
|
119
|
-
- -1.8941348100402244
|
|
120
|
-
- 1.249265758393991
|
|
121
|
-
- -1.4284210948906104
|
|
122
|
-
- - -1.3277128628152939
|
|
123
|
-
- 0.8982415633049462
|
|
124
|
-
- -0.8080773665408135
|
|
125
|
-
- -0.18161647647456935
|
|
126
|
-
modifiable: true
|
|
127
|
-
- !ruby/object:Bioinform::Motif
|
|
128
|
-
parameters: !ruby/object:OpenStruct
|
|
129
|
-
table:
|
|
130
|
-
:original_data_model: :pwm
|
|
131
|
-
:pwm: !ruby/object:Bioinform::PWM
|
|
132
|
-
parameters: !ruby/object:OpenStruct
|
|
133
|
-
table:
|
|
134
|
-
:name: SP1_f1
|
|
135
|
-
:background:
|
|
136
|
-
- 1
|
|
137
|
-
- 1
|
|
138
|
-
- 1
|
|
139
|
-
- 1
|
|
140
|
-
modifiable: true
|
|
141
|
-
matrix:
|
|
142
|
-
- - -0.24435707885585292
|
|
143
|
-
- -0.674823404693731
|
|
144
|
-
- 0.8657012535789866
|
|
145
|
-
- -1.1060188862599287
|
|
146
|
-
- - -1.0631255752097797
|
|
147
|
-
- -2.111925969423868
|
|
148
|
-
- 1.0960627561110403
|
|
149
|
-
- -0.6138563775211977
|
|
150
|
-
- - -0.3872276234760535
|
|
151
|
-
- -2.9739851913218045
|
|
152
|
-
- 1.1807800242010378
|
|
153
|
-
- -4.338927525031566
|
|
154
|
-
- - -4.563896055436894
|
|
155
|
-
- -2.9161633002532277
|
|
156
|
-
- 1.3684371349982638
|
|
157
|
-
- -5.077972423609655
|
|
158
|
-
- - -2.2369752892820083
|
|
159
|
-
- -3.7196436313301846
|
|
160
|
-
- 1.3510439136452734
|
|
161
|
-
- -4.889930670508233
|
|
162
|
-
- - -0.07473964149330865
|
|
163
|
-
- 0.944919654762011
|
|
164
|
-
- -2.6246857648086044
|
|
165
|
-
- -0.8510983487822436
|
|
166
|
-
- - -1.9643526491643322
|
|
167
|
-
- -2.978402770880115
|
|
168
|
-
- 1.3113096718240573
|
|
169
|
-
- -2.324334259499025
|
|
170
|
-
- - -4.0155484139655835
|
|
171
|
-
- -3.1384268078096667
|
|
172
|
-
- 1.3387488589788057
|
|
173
|
-
- -2.084673903537648
|
|
174
|
-
- - -0.44509385828355363
|
|
175
|
-
- -2.2510053061629702
|
|
176
|
-
- 1.1265431574368685
|
|
177
|
-
- -1.7780413702431372
|
|
178
|
-
- - -1.1896356092245048
|
|
179
|
-
- -1.2251832285630027
|
|
180
|
-
- 1.1636760063747527
|
|
181
|
-
- -1.6080243648157353
|
|
182
|
-
- - -0.5166047365590571
|
|
183
|
-
- 0.7641033353626657
|
|
184
|
-
- -0.2862677570028208
|
|
185
|
-
- -0.68254820978656
|
|
186
|
-
modifiable: true
|
|
187
|
-
parameters: !ruby/object:OpenStruct
|
|
188
|
-
table: {}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
require 'shellwords'
|
|
2
|
-
require 'yaml'
|
|
3
|
-
require_relative '../spec_helper'
|
|
4
|
-
require_relative '../../lib/bioinform/cli/merge_into_collection'
|
|
5
|
-
require_relative '../../lib/bioinform/data_models/collection'
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def run_merge_into_collection(cmd)
|
|
9
|
-
Bioinform::CLI::MergeIntoCollection.main(cmd.shellsplit)
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
describe Bioinform::CLI::MergeIntoCollection do
|
|
13
|
-
before :each do
|
|
14
|
-
@start_dir = Dir.pwd
|
|
15
|
-
Dir.chdir File.join(File.dirname(__FILE__), 'data', 'merge_into_collection')
|
|
16
|
-
end
|
|
17
|
-
after :each do
|
|
18
|
-
File.delete('collection.yaml') if File.exist?('collection.yaml')
|
|
19
|
-
File.delete('collection.txt') if File.exist?('collection.txt')
|
|
20
|
-
File.delete('my_collection.yaml') if File.exist?('my_collection.yaml')
|
|
21
|
-
File.delete('my_collection.txt') if File.exist?('my_collection.txt')
|
|
22
|
-
File.delete('result.out') if File.exist?('result.out')
|
|
23
|
-
Dir.chdir(@start_dir)
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
context 'without --plain option' do
|
|
27
|
-
context 'when name not specified' do
|
|
28
|
-
it 'collects motifs into file collection.yaml' do
|
|
29
|
-
run_merge_into_collection('GABPA_f1.pwm KLF4_f2.pwm SP1_f1.pwm')
|
|
30
|
-
File.exist?('collection.yaml').should be_true
|
|
31
|
-
YAML.load(File.read('collection.yaml')).should == YAML.load(File.read('collection.yaml.result'))
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
context 'when name specified' do
|
|
36
|
-
it 'collects motifs into file <collection name>.yaml' do
|
|
37
|
-
run_merge_into_collection('--name my_collection GABPA_f1.pwm KLF4_f2.pwm SP1_f1.pwm')
|
|
38
|
-
File.exist?('my_collection.yaml').should be_true
|
|
39
|
-
YAML.load(File.read('my_collection.yaml')).should == YAML.load(File.read('collection.yaml.result')).set_parameters(name: 'my_collection')
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
context 'with --data-model option' do
|
|
44
|
-
it 'treat motifs as specified data model' do
|
|
45
|
-
run_merge_into_collection('--data-model pwm GABPA_f1.pwm KLF4_f2.pwm SP1_f1.pwm')
|
|
46
|
-
File.exist?('collection.yaml').should be_true
|
|
47
|
-
YAML.load(File.read('collection.yaml')).should == YAML.load(File.read('collection_pwm.yaml.result'))
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
context 'with --plain option' do
|
|
53
|
-
context 'when name not specified' do
|
|
54
|
-
it 'should collect motifs into file collection.txt in plain-text format' do
|
|
55
|
-
run_merge_into_collection('--plain GABPA_f1.pwm KLF4_f2.pwm SP1_f1.pwm')
|
|
56
|
-
File.exist?('collection.txt').should be_true
|
|
57
|
-
YAML.load(File.read('collection.txt')).should == YAML.load(File.read('collection.txt.result'))
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
context 'when name specified' do
|
|
62
|
-
it 'should collect motifs into file <collection name>.txt in plain-text format' do
|
|
63
|
-
run_merge_into_collection('--name my_collection --plain GABPA_f1.pwm KLF4_f2.pwm SP1_f1.pwm')
|
|
64
|
-
File.exist?('my_collection.txt').should be_true
|
|
65
|
-
YAML.load(File.read('my_collection.txt')).should == YAML.load(File.read('collection.txt.result'))
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
context 'with --data-model option' do
|
|
70
|
-
it 'generate usual txt file' do
|
|
71
|
-
run_merge_into_collection('--data-model pwm --plain GABPA_f1.pwm KLF4_f2.pwm SP1_f1.pwm')
|
|
72
|
-
File.exist?('collection.txt').should be_true
|
|
73
|
-
YAML.load(File.read('collection.txt')).should == YAML.load(File.read('collection.txt.result'))
|
|
74
|
-
end
|
|
75
|
-
end
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
context 'when --output-file specified' do
|
|
79
|
-
it 'collects motifs into specified file' do
|
|
80
|
-
run_merge_into_collection('--output-file result.out GABPA_f1.pwm KLF4_f2.pwm SP1_f1.pwm')
|
|
81
|
-
File.exist?('result.out').should be_true
|
|
82
|
-
YAML.load(File.read('result.out')).should == YAML.load(File.read('collection.yaml.result'))
|
|
83
|
-
end
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
context 'when filelist is empty' do
|
|
87
|
-
it 'takes filelist from stdin' do
|
|
88
|
-
provide_stdin('GABPA_f1.pwm KLF4_f2.pwm SP1_f1.pwm'){ run_merge_into_collection('') }
|
|
89
|
-
File.exist?('collection.yaml').should be_true
|
|
90
|
-
YAML.load(File.read('collection.yaml')).should == YAML.load(File.read('collection.yaml.result'))
|
|
91
|
-
end
|
|
92
|
-
end
|
|
93
|
-
context 'when filelist contain folder name' do
|
|
94
|
-
it 'takes filelist as files from folder' do
|
|
95
|
-
run_merge_into_collection('pwm_folder')
|
|
96
|
-
File.exist?('collection.yaml').should be_true
|
|
97
|
-
YAML.load(File.read('collection.yaml')).should == YAML.load(File.read('collection.yaml.result'))
|
|
98
|
-
end
|
|
99
|
-
end
|
|
100
|
-
end
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
require_relative '../spec_helper'
|
|
2
|
-
require_relative '../../lib/bioinform/data_models/collection'
|
|
3
|
-
|
|
4
|
-
module Bioinform
|
|
5
|
-
describe Collection do
|
|
6
|
-
before :each do
|
|
7
|
-
@collection = Collection.new(name: 'Main collection')
|
|
8
|
-
@pm_1 = Fabricate(:pm_1)
|
|
9
|
-
@pm_2 = Fabricate(:pm_2)
|
|
10
|
-
@pm_3 = Fabricate(:pm_3)
|
|
11
|
-
end
|
|
12
|
-
describe '#size' do
|
|
13
|
-
it 'should return size of collection' do
|
|
14
|
-
@collection << @pm_1 << @pm_2 << @pm_3
|
|
15
|
-
@collection.size.should == 3
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
describe '#<<' do
|
|
19
|
-
it 'should add element to collection' do
|
|
20
|
-
@collection << @pm_1
|
|
21
|
-
@collection << @pm_2
|
|
22
|
-
@collection << @pm_3
|
|
23
|
-
@collection.should include(Motif.new(pm: @pm_1), Motif.new(pm: @pm_2), Motif.new(pm: @pm_3))
|
|
24
|
-
end
|
|
25
|
-
it 'should be chainable' do
|
|
26
|
-
@collection << @pm_1 << @pm_2 << @pm_3
|
|
27
|
-
@collection.should include(Motif.new(pm: @pm_1), Motif.new(pm: @pm_2), Motif.new(pm: @pm_3))
|
|
28
|
-
end
|
|
29
|
-
# it 'should mark motif with name' do
|
|
30
|
-
# @collection << @pm_1 << @pm_2
|
|
31
|
-
# @pm_1.should be_tagged('Main collection')
|
|
32
|
-
# @pm_2.should be_tagged('Main collection')
|
|
33
|
-
# end
|
|
34
|
-
# it 'should mark motif with self' do
|
|
35
|
-
# @collection << @pm_1 << @pm_2
|
|
36
|
-
# @pm_1.should be_tagged(@collection)
|
|
37
|
-
# @pm_2.should be_tagged(@collection)
|
|
38
|
-
# end
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
describe '#each' do
|
|
42
|
-
before :each do
|
|
43
|
-
@collection << @pm_1 << @pm_2 << @pm_3
|
|
44
|
-
end
|
|
45
|
-
context 'with block given' do
|
|
46
|
-
it 'should yield Motifs' do
|
|
47
|
-
expect{|b| @collection.each(&b)}.to yield_successive_args(Motif,Motif,Motif)
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
context 'with block given' do
|
|
51
|
-
it 'return an Enumerator' do
|
|
52
|
-
@collection.each.should be_kind_of(Enumerator)
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
describe '#each(:pcm)' do
|
|
58
|
-
before :each do
|
|
59
|
-
@collection << @pm_1.as_pcm << @pm_2 << @pm_3.as_pcm
|
|
60
|
-
end
|
|
61
|
-
context 'with block given' do
|
|
62
|
-
it 'should yield elements of collecton converted to pcm' do
|
|
63
|
-
expect{|b| @collection.each(:pcm, &b)}.to yield_successive_args(PCM, nil, PCM)
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
context 'with block given' do
|
|
67
|
-
it 'return an Enumerator' do
|
|
68
|
-
@collection.each(:pcm).should be_kind_of(Enumerator)
|
|
69
|
-
end
|
|
70
|
-
end
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
describe '#+' do
|
|
74
|
-
before :each do
|
|
75
|
-
@collection << @pm_1 << @pm_2 << @pm_3
|
|
76
|
-
@pm_sec_1 = Fabricate(:pm_4)
|
|
77
|
-
@pm_sec_2 = Fabricate(:pm_5)
|
|
78
|
-
@secondary_collection = Collection.new(name: 'Secondary collection')
|
|
79
|
-
@secondary_collection << @pm_sec_1 << @pm_sec_2
|
|
80
|
-
@summary_collection = @collection + @secondary_collection
|
|
81
|
-
end
|
|
82
|
-
it 'should create a collection consisting of all elements of both collections' do
|
|
83
|
-
@summary_collection.should be_kind_of(Collection)
|
|
84
|
-
@summary_collection.size.should == (@collection.size + @secondary_collection.size)
|
|
85
|
-
@summary_collection.should include(Motif.new(pm: @pm_1), Motif.new(pm: @pm_2), Motif.new(pm: @pm_3),
|
|
86
|
-
Motif.new(pm: @pm_sec_1), Motif.new(pm: @pm_sec_2))
|
|
87
|
-
end
|
|
88
|
-
# it 'should leave marks on motifs' do
|
|
89
|
-
# @pm_1.should be_tagged('Main collection')
|
|
90
|
-
# @pm_sec_1.should be_tagged('Secondary collection')
|
|
91
|
-
# end
|
|
92
|
-
# it 'should not mix marks of motifs in different collections' do
|
|
93
|
-
# @pm_1.should_not be_tagged('Secondary collection')
|
|
94
|
-
# @pm_sec_1.should_not be_tagged('Main collection')
|
|
95
|
-
# end
|
|
96
|
-
end
|
|
97
|
-
end
|
|
98
|
-
end
|
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
require_relative '../../lib/bioinform/data_models/motif'
|
|
2
|
-
|
|
3
|
-
shared_examples 'when pm is PM' do
|
|
4
|
-
context 'when pm-value is a PCM' do
|
|
5
|
-
let(:pm) { Fabricate(:pcm) }
|
|
6
|
-
it 'sets pcm-attribute to specified PM' do
|
|
7
|
-
subject.pcm.should == Fabricate(:pcm)
|
|
8
|
-
end
|
|
9
|
-
end
|
|
10
|
-
context 'when pm-value is a PWM' do
|
|
11
|
-
let(:pm) { Fabricate(:pwm) }
|
|
12
|
-
it 'sets pwm-attribute to specified PM' do
|
|
13
|
-
subject.pwm.should == Fabricate(:pwm)
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
context 'when pm-value is a PPM' do
|
|
17
|
-
let(:pm) { Fabricate(:ppm) }
|
|
18
|
-
it 'sets ppm-attribute to specified PM' do
|
|
19
|
-
subject.ppm.should == Fabricate(:ppm)
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
context 'when pm-value is a PM' do
|
|
23
|
-
let(:pm) { Fabricate(:pm) }
|
|
24
|
-
it 'sets only parameter pm attribute to specified PM' do
|
|
25
|
-
subject.parameters.pm.should == Fabricate(:pm)
|
|
26
|
-
subject.pcm.should be_nil
|
|
27
|
-
subject.pwm.should be_nil
|
|
28
|
-
subject.ppm.should be_nil
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
module Bioinform
|
|
35
|
-
describe Motif do
|
|
36
|
-
describe '.new' do
|
|
37
|
-
it 'accepts empty argument list' do
|
|
38
|
-
expect{ described_class.new }.to_not raise_error
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
context 'when argument is a Hash' do
|
|
42
|
-
subject{ described_class.new(hash) }
|
|
43
|
-
context 'which contains usual symbolic parameters' do
|
|
44
|
-
let(:hash){ {:a => 123, :key => 'value', :threshold => {0.1 => 15} } }
|
|
45
|
-
it 'sets its content as parameters' do
|
|
46
|
-
subject.parameters.a.should == 123
|
|
47
|
-
subject.parameters.key.should == 'value'
|
|
48
|
-
subject.parameters.threshold.should == {0.1 => 15}
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
context 'which contains any combination of :pwm, :pcm and :ppm keys' do
|
|
52
|
-
let(:hash) { {pcm: 'my_pcm', ppm: 'my_ppm'} }
|
|
53
|
-
it 'sets corresponding attributes to specified values' do
|
|
54
|
-
subject.pcm.should == 'my_pcm'
|
|
55
|
-
subject.ppm.should == 'my_ppm'
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
context 'when argument is a Hash with pm-key' do
|
|
61
|
-
subject{ described_class.new(pm: pm) }
|
|
62
|
-
|
|
63
|
-
include_examples 'when pm is PM'
|
|
64
|
-
|
|
65
|
-
context 'when pm-value is a usual object' do
|
|
66
|
-
let(:pm) { 'stub pm' }
|
|
67
|
-
it 'sets only parameter pm attribute to specified value' do
|
|
68
|
-
subject.parameters.pm.should == 'stub pm'
|
|
69
|
-
subject.pcm.should be_nil
|
|
70
|
-
subject.pwm.should be_nil
|
|
71
|
-
subject.ppm.should be_nil
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
end
|
|
75
|
-
context 'when argument is neither PM nor Hash' do
|
|
76
|
-
it 'raises ArgumentError' do
|
|
77
|
-
expect{ described_class.new('stub pm') }.to raise_error(ArgumentError)
|
|
78
|
-
end
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
########################################################
|
|
83
|
-
describe '#pcm' do
|
|
84
|
-
subject { motif.pcm }
|
|
85
|
-
context 'when pcm is set' do
|
|
86
|
-
context 'when pwm and ppm aren\'t setted' do
|
|
87
|
-
let(:motif) { Fabricate(:motif_pcm) }
|
|
88
|
-
it 'returns setted pcm' do
|
|
89
|
-
subject.should == Fabricate(:pcm)
|
|
90
|
-
end
|
|
91
|
-
end
|
|
92
|
-
context 'when ppm also setted' do
|
|
93
|
-
let(:motif) { Fabricate(:motif_pcm_and_ppm) }
|
|
94
|
-
it 'returns setted pcm' do
|
|
95
|
-
subject.should == Fabricate(:pcm)
|
|
96
|
-
end
|
|
97
|
-
end
|
|
98
|
-
context 'when pwm also setted' do
|
|
99
|
-
let(:motif) { Fabricate(:motif_pcm_and_pwm) }
|
|
100
|
-
it 'returns setted pcm' do
|
|
101
|
-
subject.should == Fabricate(:pcm)
|
|
102
|
-
end
|
|
103
|
-
end
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
context 'when pcm isn\'t set' do
|
|
107
|
-
context 'when nothing set' do
|
|
108
|
-
let(:motif) { Fabricate(:motif) }
|
|
109
|
-
it 'returns nil' do
|
|
110
|
-
subject.should be_nil
|
|
111
|
-
end
|
|
112
|
-
end
|
|
113
|
-
context 'when pwm setted' do
|
|
114
|
-
let(:motif) { Fabricate(:motif_pwm) }
|
|
115
|
-
it 'returns nil' do
|
|
116
|
-
subject.should be_nil
|
|
117
|
-
end
|
|
118
|
-
end
|
|
119
|
-
context 'when ppm setted' do
|
|
120
|
-
let(:motif) { Fabricate(:motif_ppm) }
|
|
121
|
-
it 'returns nil' do
|
|
122
|
-
subject.should be_nil
|
|
123
|
-
end
|
|
124
|
-
end
|
|
125
|
-
end
|
|
126
|
-
end
|
|
127
|
-
############################################
|
|
128
|
-
describe '#pwm' do
|
|
129
|
-
subject { motif.pwm }
|
|
130
|
-
context 'when pwm is set' do
|
|
131
|
-
context 'when pcm and ppm aren\'t setted' do
|
|
132
|
-
let(:motif) { Fabricate(:motif_pwm) }
|
|
133
|
-
it 'returns setted pwm' do
|
|
134
|
-
subject.should == Fabricate(:pwm)
|
|
135
|
-
end
|
|
136
|
-
end
|
|
137
|
-
context 'when ppm also setted' do
|
|
138
|
-
let(:motif) { Fabricate(:motif_pwm_and_ppm) }
|
|
139
|
-
it 'returns setted pwm' do
|
|
140
|
-
subject.should == Fabricate(:pwm)
|
|
141
|
-
end
|
|
142
|
-
end
|
|
143
|
-
context 'when pcm also setted' do
|
|
144
|
-
let(:motif) { Fabricate(:motif_pcm_and_pwm) }
|
|
145
|
-
it 'returns setted pwm' do
|
|
146
|
-
subject.should == Fabricate(:pwm)
|
|
147
|
-
end
|
|
148
|
-
end
|
|
149
|
-
end
|
|
150
|
-
|
|
151
|
-
context 'when pwm isn\'t set' do
|
|
152
|
-
context 'when nothing set' do
|
|
153
|
-
let(:motif) { Fabricate(:motif) }
|
|
154
|
-
it 'returns nil' do
|
|
155
|
-
subject.should be_nil
|
|
156
|
-
end
|
|
157
|
-
end
|
|
158
|
-
context 'when pcm setted' do
|
|
159
|
-
let(:motif) { Fabricate(:motif_pcm) }
|
|
160
|
-
it 'returns pcm converted to pwm' do
|
|
161
|
-
subject.should == Fabricate(:pwm_by_pcm)
|
|
162
|
-
end
|
|
163
|
-
end
|
|
164
|
-
context 'when ppm setted' do
|
|
165
|
-
let(:motif) { Fabricate(:motif_ppm) }
|
|
166
|
-
it 'returns nil' do
|
|
167
|
-
subject.should be_nil
|
|
168
|
-
end
|
|
169
|
-
end
|
|
170
|
-
end
|
|
171
|
-
end
|
|
172
|
-
|
|
173
|
-
############################################
|
|
174
|
-
describe '#ppm' do
|
|
175
|
-
subject { motif.ppm }
|
|
176
|
-
context 'when ppm is set' do
|
|
177
|
-
context 'when pcm and pwm aren\'t setted' do
|
|
178
|
-
let(:motif) { Fabricate(:motif_ppm) }
|
|
179
|
-
it 'returns setted ppm' do
|
|
180
|
-
subject.should == Fabricate(:ppm)
|
|
181
|
-
end
|
|
182
|
-
end
|
|
183
|
-
context 'when pcm also setted' do
|
|
184
|
-
let(:motif) { Fabricate(:motif_pcm_and_ppm) }
|
|
185
|
-
it 'returns setted ppm' do
|
|
186
|
-
subject.should == Fabricate(:ppm)
|
|
187
|
-
end
|
|
188
|
-
end
|
|
189
|
-
context 'when pwm also setted' do
|
|
190
|
-
let(:motif) { Fabricate(:motif_pwm_and_ppm) }
|
|
191
|
-
it 'returns setted ppm' do
|
|
192
|
-
subject.should == Fabricate(:ppm)
|
|
193
|
-
end
|
|
194
|
-
end
|
|
195
|
-
end
|
|
196
|
-
|
|
197
|
-
context 'when ppm isn\'t set' do
|
|
198
|
-
context 'when nothing set' do
|
|
199
|
-
let(:motif) { Fabricate(:motif) }
|
|
200
|
-
it 'returns nil' do
|
|
201
|
-
subject.should be_nil
|
|
202
|
-
end
|
|
203
|
-
end
|
|
204
|
-
context 'when pcm setted' do
|
|
205
|
-
let(:motif) { Fabricate(:motif_pcm) }
|
|
206
|
-
it 'returns pcm converted to ppm' do
|
|
207
|
-
subject.should == Fabricate(:ppm_by_pcm)
|
|
208
|
-
end
|
|
209
|
-
end
|
|
210
|
-
context 'when pwm setted' do
|
|
211
|
-
let(:motif) { Fabricate(:motif_pwm) }
|
|
212
|
-
it 'returns nil' do
|
|
213
|
-
subject.should be_nil
|
|
214
|
-
end
|
|
215
|
-
end
|
|
216
|
-
end
|
|
217
|
-
end
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
end
|
|
224
|
-
end
|