bioinform 0.1.17 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
data/spec/spec_helper.rb
CHANGED
data/spec/spec_helper_source.rb
CHANGED
@@ -27,18 +27,17 @@ def capture_stderr(&block)
|
|
27
27
|
capture_io(&block)[:stderr]
|
28
28
|
end
|
29
29
|
|
30
|
-
def parser_specs(
|
30
|
+
def parser_specs(parser, good_cases, bad_cases)
|
31
31
|
context '#parse!' do
|
32
32
|
good_cases.each do |case_description, input_and_result|
|
33
|
-
it "should be able to parse #{case_description}" do
|
34
|
-
|
35
|
-
Bioinform::PM.new(result).should == input_and_result[:result]
|
33
|
+
it "should be able to parse #{case_description} (input #{input_and_result[:input].inspect} --> result #{input_and_result[:result].inspect})" do
|
34
|
+
expect(parser.parse(input_and_result[:input])).to eq input_and_result[:result]
|
36
35
|
end
|
37
36
|
end
|
38
37
|
|
39
38
|
bad_cases.each do |case_description, input|
|
40
39
|
it "should raise an exception on parsing #{case_description}" do
|
41
|
-
expect{
|
40
|
+
expect{ parser.parse!(input[:input]) }.to raise_error
|
42
41
|
end
|
43
42
|
end
|
44
43
|
end
|
@@ -57,3 +56,24 @@ end
|
|
57
56
|
def make_model_file(motif, model_type)
|
58
57
|
make_file(motif_filename(motif, model_type), motif.send(model_type))
|
59
58
|
end
|
59
|
+
|
60
|
+
RSpec::Matchers.define :be_within_range_from_matrix do |expected, range|
|
61
|
+
match do |actual|
|
62
|
+
expected.alphabet == actual.alphabet && matrices_within_range?(actual.matrix, expected.matrix, range)
|
63
|
+
end
|
64
|
+
|
65
|
+
def matrices_within_range?(actual, expected, range)
|
66
|
+
(actual.length == expected.length) && actual.each_index.all?{|pos_index| postions_within_range?(actual[pos_index], expected[pos_index], range) }
|
67
|
+
end
|
68
|
+
|
69
|
+
def postions_within_range?(actual, expected, range)
|
70
|
+
(actual.length == expected.length) && actual.each_index.all?{|letter_index| (actual[letter_index] - expected[letter_index]).abs <= range }
|
71
|
+
end
|
72
|
+
|
73
|
+
description do
|
74
|
+
"\nbe in range #{range} from\n#{expected}\n"
|
75
|
+
end
|
76
|
+
failure_message do |actual|
|
77
|
+
"expected that\n#{actual}\nwould be in range #{range} from\n#{expected}\n"
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'bioinform/support'
|
2
|
+
|
3
|
+
describe Bioinform::Support do
|
4
|
+
specify do
|
5
|
+
expect(Bioinform::Support.element_indices([:A,:C,:G,:T])).to eq( {:A=>0, :C=>1, :G=>2, :T=>3} )
|
6
|
+
end
|
7
|
+
|
8
|
+
specify do
|
9
|
+
expect(Bioinform::Support.hash_keys_permuted([0,1], :A)).to eq( {[0,1] => :A, [1,0] => :A} )
|
10
|
+
end
|
11
|
+
|
12
|
+
specify do
|
13
|
+
expect(Bioinform::Support.with_key_permutations({[0,1] => :A, [0,2] => :T})).to eq( {[0,1] => :A, [1,0] => :A, [0,2] => :T, [2,0]=>:T} )
|
14
|
+
end
|
15
|
+
|
16
|
+
specify do
|
17
|
+
expect(Bioinform::Support.various_key_cases({'a' => 2, 'C' => 3, :g =>5, :T => 8})).to eq( {'a' => 2, 'A' => 2, 'c' => 3, 'C' => 3, :g =>5, :G => 5, :T => 8, :t=>8} )
|
18
|
+
end
|
19
|
+
|
20
|
+
specify do
|
21
|
+
expect(Bioinform::Support.various_key_types({'a' => 2, 'C' => 3, :g =>5, :T => 8})).to eq( {'a' => 2, :a => 2, 'C' => 3, :C => 3, :g =>5, 'g' => 5, :T => 8, 'T'=>8} )
|
22
|
+
end
|
23
|
+
|
24
|
+
specify do
|
25
|
+
expect(Bioinform::Support.various_key_value_cases({:A => :T})).to eq( {:A => :T, :a => :t} )
|
26
|
+
end
|
27
|
+
|
28
|
+
specify do
|
29
|
+
expect(Bioinform::Support.various_key_value_types({:A => :T})).to eq( {:A => :T, 'A' => 'T'} )
|
30
|
+
end
|
31
|
+
end
|
metadata
CHANGED
@@ -1,34 +1,20 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bioinform
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ilya Vorontsov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
12
|
-
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: docopt
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - '='
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 0.5.0
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - '='
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 0.5.0
|
11
|
+
date: 2014-07-14 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
27
13
|
description: A bunch of useful classes for bioinformatics
|
28
14
|
email:
|
29
15
|
- prijutme4ty@gmail.com
|
30
16
|
executables:
|
31
|
-
-
|
17
|
+
- convert_motif
|
32
18
|
- pcm2pwm
|
33
19
|
- split_motifs
|
34
20
|
extensions: []
|
@@ -41,80 +27,46 @@ files:
|
|
41
27
|
- README.md
|
42
28
|
- Rakefile
|
43
29
|
- TODO.txt
|
44
|
-
- bin/
|
30
|
+
- bin/convert_motif
|
45
31
|
- bin/pcm2pwm
|
46
32
|
- bin/split_motifs
|
47
33
|
- bioinform.gemspec
|
48
34
|
- lib/bioinform.rb
|
35
|
+
- lib/bioinform/alphabet.rb
|
36
|
+
- lib/bioinform/background.rb
|
49
37
|
- lib/bioinform/cli.rb
|
50
38
|
- lib/bioinform/cli/convert_motif.rb
|
51
|
-
- lib/bioinform/cli/merge_into_collection.rb
|
52
39
|
- lib/bioinform/cli/pcm2pwm.rb
|
53
40
|
- lib/bioinform/cli/split_motifs.rb
|
41
|
+
- lib/bioinform/conversion_algorithms.rb
|
54
42
|
- lib/bioinform/conversion_algorithms/pcm2ppm_converter.rb
|
55
43
|
- lib/bioinform/conversion_algorithms/pcm2pwm_converter.rb
|
56
44
|
- lib/bioinform/conversion_algorithms/pcm2pwm_mara_converter.rb
|
57
45
|
- lib/bioinform/conversion_algorithms/ppm2pcm_converter.rb
|
58
|
-
- lib/bioinform/conversion_algorithms/
|
46
|
+
- lib/bioinform/conversion_algorithms/pwm2iupac_pwm_converter.rb
|
47
|
+
- lib/bioinform/conversion_algorithms/pwm2pcm_converter.rb
|
59
48
|
- lib/bioinform/data_models.rb
|
60
|
-
- lib/bioinform/data_models/
|
61
|
-
- lib/bioinform/data_models/motif.rb
|
49
|
+
- lib/bioinform/data_models/named_model.rb
|
62
50
|
- lib/bioinform/data_models/pcm.rb
|
63
51
|
- lib/bioinform/data_models/pm.rb
|
64
52
|
- lib/bioinform/data_models/ppm.rb
|
65
53
|
- lib/bioinform/data_models/pwm.rb
|
54
|
+
- lib/bioinform/errors.rb
|
66
55
|
- lib/bioinform/formatters.rb
|
67
|
-
- lib/bioinform/formatters/
|
56
|
+
- lib/bioinform/formatters/consensus_formatter.rb
|
57
|
+
- lib/bioinform/formatters/motif_formatter.rb
|
58
|
+
- lib/bioinform/formatters/pretty_matrix_formatter.rb
|
68
59
|
- lib/bioinform/formatters/transfac_formatter.rb
|
69
60
|
- lib/bioinform/parsers.rb
|
70
|
-
- lib/bioinform/parsers/jaspar_parser.rb
|
71
61
|
- lib/bioinform/parsers/matrix_parser.rb
|
72
|
-
- lib/bioinform/parsers/
|
73
|
-
- lib/bioinform/parsers/splittable_parser.rb
|
74
|
-
- lib/bioinform/parsers/string_fantom_parser.rb
|
75
|
-
- lib/bioinform/parsers/string_parser.rb
|
76
|
-
- lib/bioinform/parsers/trivial_parser.rb
|
77
|
-
- lib/bioinform/parsers/yaml_parser.rb
|
62
|
+
- lib/bioinform/parsers/motif_splitter.rb
|
78
63
|
- lib/bioinform/support.rb
|
79
|
-
- lib/bioinform/support/advanced_scan.rb
|
80
|
-
- lib/bioinform/support/array_product.rb
|
81
|
-
- lib/bioinform/support/array_zip.rb
|
82
|
-
- lib/bioinform/support/collect_hash.rb
|
83
|
-
- lib/bioinform/support/deep_dup.rb
|
84
|
-
- lib/bioinform/support/delete_many.rb
|
85
|
-
- lib/bioinform/support/inverf.rb
|
86
|
-
- lib/bioinform/support/multiline_squish.rb
|
87
|
-
- lib/bioinform/support/parameters.rb
|
88
|
-
- lib/bioinform/support/partial_sums.rb
|
89
|
-
- lib/bioinform/support/same_by.rb
|
90
64
|
- lib/bioinform/support/strip_doc.rb
|
91
|
-
- lib/bioinform/support/third_part/active_support/core_ext/array/extract_options.rb
|
92
|
-
- lib/bioinform/support/third_part/active_support/core_ext/hash/indifferent_access.rb
|
93
|
-
- lib/bioinform/support/third_part/active_support/core_ext/hash/keys.rb
|
94
|
-
- lib/bioinform/support/third_part/active_support/core_ext/module/attribute_accessors.rb
|
95
|
-
- lib/bioinform/support/third_part/active_support/core_ext/object/try.rb
|
96
|
-
- lib/bioinform/support/third_part/active_support/core_ext/string/access.rb
|
97
|
-
- lib/bioinform/support/third_part/active_support/core_ext/string/behavior.rb
|
98
|
-
- lib/bioinform/support/third_part/active_support/core_ext/string/filters.rb
|
99
|
-
- lib/bioinform/support/third_part/active_support/core_ext/string/multibyte.rb
|
100
|
-
- lib/bioinform/support/third_part/active_support/hash_with_indifferent_access.rb
|
101
|
-
- lib/bioinform/support/third_part/active_support/multibyte.rb
|
102
|
-
- lib/bioinform/support/third_part/active_support/multibyte/chars.rb
|
103
|
-
- lib/bioinform/support/third_part/active_support/multibyte/exceptions.rb
|
104
|
-
- lib/bioinform/support/third_part/active_support/multibyte/unicode.rb
|
105
|
-
- lib/bioinform/support/third_part/active_support/multibyte/utils.rb
|
106
65
|
- lib/bioinform/version.rb
|
66
|
+
- spec/alphabet_spec.rb
|
67
|
+
- spec/background_spec.rb
|
107
68
|
- spec/cli/cli_spec.rb
|
108
69
|
- spec/cli/convert_motif_spec.rb
|
109
|
-
- spec/cli/data/merge_into_collection/GABPA_f1.pwm
|
110
|
-
- spec/cli/data/merge_into_collection/KLF4_f2.pwm
|
111
|
-
- spec/cli/data/merge_into_collection/SP1_f1.pwm
|
112
|
-
- spec/cli/data/merge_into_collection/collection.txt.result
|
113
|
-
- spec/cli/data/merge_into_collection/collection.yaml.result
|
114
|
-
- spec/cli/data/merge_into_collection/collection_pwm.yaml.result
|
115
|
-
- spec/cli/data/merge_into_collection/pwm_folder/GABPA_f1.pwm
|
116
|
-
- spec/cli/data/merge_into_collection/pwm_folder/KLF4_f2.pwm
|
117
|
-
- spec/cli/data/merge_into_collection/pwm_folder/SP1_f1.pwm
|
118
70
|
- spec/cli/data/pcm2pwm/KLF4 f2 spaced name.pcm
|
119
71
|
- spec/cli/data/pcm2pwm/KLF4_f2.pcm
|
120
72
|
- spec/cli/data/pcm2pwm/KLF4_f2.pwm.result
|
@@ -123,9 +75,7 @@ files:
|
|
123
75
|
- spec/cli/data/split_motifs/GABPA_f1.mat.result
|
124
76
|
- spec/cli/data/split_motifs/KLF4_f2.mat.result
|
125
77
|
- spec/cli/data/split_motifs/SP1_f1.mat.result
|
126
|
-
- spec/cli/data/split_motifs/collection.yaml
|
127
78
|
- spec/cli/data/split_motifs/plain_collection.txt
|
128
|
-
- spec/cli/merge_into_collection_spec.rb
|
129
79
|
- spec/cli/pcm2pwm_spec.rb
|
130
80
|
- spec/cli/shared_examples/convert_motif/motif_list_empty.rb
|
131
81
|
- spec/cli/shared_examples/convert_motif/several_motifs_specified.rb
|
@@ -133,35 +83,24 @@ files:
|
|
133
83
|
- spec/cli/shared_examples/convert_motif/yield_help_string.rb
|
134
84
|
- spec/cli/shared_examples/convert_motif/yield_motif_conversion_error.rb
|
135
85
|
- spec/cli/split_motifs_spec.rb
|
136
|
-
- spec/
|
137
|
-
- spec/
|
86
|
+
- spec/converters/pcm2ppm_converter_spec.rb
|
87
|
+
- spec/converters/pcm2pwm_converter_spec.rb
|
88
|
+
- spec/converters/ppm2pcm_converter_spec.rb
|
89
|
+
- spec/converters/pwm2iupac_pwm_converter_spec.rb
|
90
|
+
- spec/converters/pwm2pcm_converter_spec.rb
|
91
|
+
- spec/data_models/named_model_spec.rb
|
138
92
|
- spec/data_models/pcm_spec.rb
|
139
93
|
- spec/data_models/pm_spec.rb
|
140
94
|
- spec/data_models/ppm_spec.rb
|
141
95
|
- spec/data_models/pwm_spec.rb
|
142
|
-
- spec/fabricators/collection_fabricator.rb
|
143
|
-
- spec/fabricators/motif_fabricator.rb
|
144
96
|
- spec/fabricators/motif_formats_fabricator.rb
|
145
|
-
- spec/
|
146
|
-
- spec/
|
147
|
-
- spec/
|
148
|
-
- spec/
|
149
|
-
- spec/parsers/parser_spec.rb
|
150
|
-
- spec/parsers/string_fantom_parser_spec.rb
|
151
|
-
- spec/parsers/string_parser_spec.rb
|
152
|
-
- spec/parsers/trivial_parser_spec.rb
|
153
|
-
- spec/parsers/yaml_parser_spec.rb
|
97
|
+
- spec/formatters/consensus_formatter_spec.rb
|
98
|
+
- spec/formatters/raw_formatter_spec.rb
|
99
|
+
- spec/parsers/matrix_parser_spec.rb
|
100
|
+
- spec/parsers/motif_splitter_spec.rb
|
154
101
|
- spec/spec_helper.rb
|
155
102
|
- spec/spec_helper_source.rb
|
156
|
-
- spec/
|
157
|
-
- spec/support/array_product_spec.rb
|
158
|
-
- spec/support/array_zip_spec.rb
|
159
|
-
- spec/support/collect_hash_spec.rb
|
160
|
-
- spec/support/delete_many_spec.rb
|
161
|
-
- spec/support/inverf_spec.rb
|
162
|
-
- spec/support/multiline_squish_spec.rb
|
163
|
-
- spec/support/partial_sums_spec.rb
|
164
|
-
- spec/support/same_by_spec.rb
|
103
|
+
- spec/support_spec.rb
|
165
104
|
homepage: ''
|
166
105
|
licenses: []
|
167
106
|
metadata: {}
|
@@ -181,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
181
120
|
version: '0'
|
182
121
|
requirements: []
|
183
122
|
rubyforge_project:
|
184
|
-
rubygems_version: 2.
|
123
|
+
rubygems_version: 2.3.0
|
185
124
|
signing_key:
|
186
125
|
specification_version: 4
|
187
126
|
summary: Classes for work with different input formats of positional matrices and
|
@@ -189,17 +128,10 @@ summary: Classes for work with different input formats of positional matrices an
|
|
189
128
|
several useful extensions for Enumerable module like parametric map and callable
|
190
129
|
symbols
|
191
130
|
test_files:
|
131
|
+
- spec/alphabet_spec.rb
|
132
|
+
- spec/background_spec.rb
|
192
133
|
- spec/cli/cli_spec.rb
|
193
134
|
- spec/cli/convert_motif_spec.rb
|
194
|
-
- spec/cli/data/merge_into_collection/GABPA_f1.pwm
|
195
|
-
- spec/cli/data/merge_into_collection/KLF4_f2.pwm
|
196
|
-
- spec/cli/data/merge_into_collection/SP1_f1.pwm
|
197
|
-
- spec/cli/data/merge_into_collection/collection.txt.result
|
198
|
-
- spec/cli/data/merge_into_collection/collection.yaml.result
|
199
|
-
- spec/cli/data/merge_into_collection/collection_pwm.yaml.result
|
200
|
-
- spec/cli/data/merge_into_collection/pwm_folder/GABPA_f1.pwm
|
201
|
-
- spec/cli/data/merge_into_collection/pwm_folder/KLF4_f2.pwm
|
202
|
-
- spec/cli/data/merge_into_collection/pwm_folder/SP1_f1.pwm
|
203
135
|
- spec/cli/data/pcm2pwm/KLF4 f2 spaced name.pcm
|
204
136
|
- spec/cli/data/pcm2pwm/KLF4_f2.pcm
|
205
137
|
- spec/cli/data/pcm2pwm/KLF4_f2.pwm.result
|
@@ -208,9 +140,7 @@ test_files:
|
|
208
140
|
- spec/cli/data/split_motifs/GABPA_f1.mat.result
|
209
141
|
- spec/cli/data/split_motifs/KLF4_f2.mat.result
|
210
142
|
- spec/cli/data/split_motifs/SP1_f1.mat.result
|
211
|
-
- spec/cli/data/split_motifs/collection.yaml
|
212
143
|
- spec/cli/data/split_motifs/plain_collection.txt
|
213
|
-
- spec/cli/merge_into_collection_spec.rb
|
214
144
|
- spec/cli/pcm2pwm_spec.rb
|
215
145
|
- spec/cli/shared_examples/convert_motif/motif_list_empty.rb
|
216
146
|
- spec/cli/shared_examples/convert_motif/several_motifs_specified.rb
|
@@ -218,32 +148,21 @@ test_files:
|
|
218
148
|
- spec/cli/shared_examples/convert_motif/yield_help_string.rb
|
219
149
|
- spec/cli/shared_examples/convert_motif/yield_motif_conversion_error.rb
|
220
150
|
- spec/cli/split_motifs_spec.rb
|
221
|
-
- spec/
|
222
|
-
- spec/
|
151
|
+
- spec/converters/pcm2ppm_converter_spec.rb
|
152
|
+
- spec/converters/pcm2pwm_converter_spec.rb
|
153
|
+
- spec/converters/ppm2pcm_converter_spec.rb
|
154
|
+
- spec/converters/pwm2iupac_pwm_converter_spec.rb
|
155
|
+
- spec/converters/pwm2pcm_converter_spec.rb
|
156
|
+
- spec/data_models/named_model_spec.rb
|
223
157
|
- spec/data_models/pcm_spec.rb
|
224
158
|
- spec/data_models/pm_spec.rb
|
225
159
|
- spec/data_models/ppm_spec.rb
|
226
160
|
- spec/data_models/pwm_spec.rb
|
227
|
-
- spec/fabricators/collection_fabricator.rb
|
228
|
-
- spec/fabricators/motif_fabricator.rb
|
229
161
|
- spec/fabricators/motif_formats_fabricator.rb
|
230
|
-
- spec/
|
231
|
-
- spec/
|
232
|
-
- spec/
|
233
|
-
- spec/
|
234
|
-
- spec/parsers/parser_spec.rb
|
235
|
-
- spec/parsers/string_fantom_parser_spec.rb
|
236
|
-
- spec/parsers/string_parser_spec.rb
|
237
|
-
- spec/parsers/trivial_parser_spec.rb
|
238
|
-
- spec/parsers/yaml_parser_spec.rb
|
162
|
+
- spec/formatters/consensus_formatter_spec.rb
|
163
|
+
- spec/formatters/raw_formatter_spec.rb
|
164
|
+
- spec/parsers/matrix_parser_spec.rb
|
165
|
+
- spec/parsers/motif_splitter_spec.rb
|
239
166
|
- spec/spec_helper.rb
|
240
167
|
- spec/spec_helper_source.rb
|
241
|
-
- spec/
|
242
|
-
- spec/support/array_product_spec.rb
|
243
|
-
- spec/support/array_zip_spec.rb
|
244
|
-
- spec/support/collect_hash_spec.rb
|
245
|
-
- spec/support/delete_many_spec.rb
|
246
|
-
- spec/support/inverf_spec.rb
|
247
|
-
- spec/support/multiline_squish_spec.rb
|
248
|
-
- spec/support/partial_sums_spec.rb
|
249
|
-
- spec/support/same_by_spec.rb
|
168
|
+
- spec/support_spec.rb
|
data/bin/merge_into_collection
DELETED
@@ -1,80 +0,0 @@
|
|
1
|
-
require_relative '../../bioinform'
|
2
|
-
require 'docopt'
|
3
|
-
require 'shellwords'
|
4
|
-
require 'yaml'
|
5
|
-
|
6
|
-
module Bioinform
|
7
|
-
module CLI
|
8
|
-
module MergeIntoCollection
|
9
|
-
extend Bioinform::CLI::Helpers
|
10
|
-
def self.main(argv)
|
11
|
-
doc = <<-DOCOPT
|
12
|
-
Tool for merging multiple motifs into a single collection file.
|
13
|
-
It takes motif files or (entire collections) and creates a collection consisting of them all. By default motifs are treated simply as matrices(PM), but you can (possibly should) specify data model. Output file by default are in YAML-format but it's possible to create plain text file. YAML collections are useful if you want to provide additional information for motifs in collection with another tool, plain text is more readable by humans.
|
14
|
-
|
15
|
-
Usage:
|
16
|
-
merge_into_collection [options] [<pm-files>...]
|
17
|
-
|
18
|
-
Options:
|
19
|
-
-h --help Show this screen.
|
20
|
-
-n --name NAME Specify name for a collection. Default filename is based on this parameter
|
21
|
-
-o --output-file FILE Output file for resulting collection
|
22
|
-
-m --data-model MODEL Data model: PM, PCM, PPM or PWM [default: PM]
|
23
|
-
-p --plain-text Output collection of motifs in plain text (motifs separated with newlines, no additional information included).
|
24
|
-
DOCOPT
|
25
|
-
|
26
|
-
doc.gsub!(/^#{doc[/\A +/]}/,'')
|
27
|
-
options = Docopt::docopt(doc, argv: argv)
|
28
|
-
|
29
|
-
plain_text = options['--plain-text']
|
30
|
-
name = options['--name']
|
31
|
-
if options['--plain-text']
|
32
|
-
output_file = options['--output-file'] || set_extension(name || 'collection', 'txt')
|
33
|
-
else
|
34
|
-
output_file = options['--output-file'] || set_extension(name || 'collection', 'yaml')
|
35
|
-
end
|
36
|
-
data_model = Bioinform.const_get(options['--data-model'].upcase)
|
37
|
-
|
38
|
-
if options['<pm-files>'].empty?
|
39
|
-
filelist = $stdin.read.shellsplit
|
40
|
-
else
|
41
|
-
filelist = options['<pm-files>']
|
42
|
-
end
|
43
|
-
|
44
|
-
filelist = filelist.map do |data_source|
|
45
|
-
if File.directory? data_source
|
46
|
-
Dir.glob(File.join(data_source, '*'))
|
47
|
-
elsif File.file? data_source
|
48
|
-
data_source
|
49
|
-
else
|
50
|
-
raise "File or directory #{data_source} can't be found"
|
51
|
-
end
|
52
|
-
end.flatten
|
53
|
-
|
54
|
-
collection = Collection.new
|
55
|
-
collection.name = name if name
|
56
|
-
|
57
|
-
filelist.each do |filename|
|
58
|
-
data_model.split_on_motifs(File.read(filename)).each do |pm|
|
59
|
-
pm.name ||= File.basename(filename, File.extname(filename))
|
60
|
-
collection << pm
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
if plain_text
|
65
|
-
File.open(output_file, 'w') do |f|
|
66
|
-
collection.each(options['--data-model'].downcase) do |pm|
|
67
|
-
f.puts(pm.to_s + "\n\n")
|
68
|
-
end
|
69
|
-
end
|
70
|
-
else
|
71
|
-
File.open(output_file, 'w'){|f| YAML.dump(collection, f) }
|
72
|
-
end
|
73
|
-
|
74
|
-
rescue Docopt::Exit => e
|
75
|
-
puts e.message
|
76
|
-
end
|
77
|
-
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|