sequence_logo 1.2.3 → 1.3.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 +5 -5
- data/.gitignore +0 -1
- data/Gemfile.lock +21 -0
- data/lib/sequence_logo/exec/glue_logos.rb +16 -12
- data/lib/sequence_logo/exec/sequence_logo.rb +10 -7
- data/lib/sequence_logo/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 32b477a05d970c0504ddd097aba85fae5f2f99da68fcd391fcfae2292742eb6c
|
4
|
+
data.tar.gz: c35413b1a0b77c12ea272a99edfc98a17bae66a3b9b9cee4c5db51995016e070
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ca7a02cbecc38cd15b7c622786e0eb0eeb06840133a941ac340cc07f2bc7da0981ea1da4e082e675a7541da2eea2e6cd7d303ca10b8d16327d85884c5a675e4
|
7
|
+
data.tar.gz: 5835d5a6e720753e2555cf0a8dc13a9752f610506bae4c41e1bf582cd75602b8f7940963ffc29b10f1b152e4b5097953c334e8289f5892a3723ddc518d48afb8
|
data/.gitignore
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
sequence_logo (1.3.0)
|
5
|
+
bioinform (~> 0.3.1)
|
6
|
+
rmagick (~> 2.13)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
bioinform (0.3.1)
|
12
|
+
rmagick (2.16.0)
|
13
|
+
|
14
|
+
PLATFORMS
|
15
|
+
ruby
|
16
|
+
|
17
|
+
DEPENDENCIES
|
18
|
+
sequence_logo!
|
19
|
+
|
20
|
+
BUNDLED WITH
|
21
|
+
1.16.1
|
@@ -30,20 +30,19 @@ def make_logo_alignment(aligned_motifs, options)
|
|
30
30
|
alignment
|
31
31
|
end
|
32
32
|
|
33
|
-
def readlines_from_file_or_stdin(argv,
|
33
|
+
def readlines_from_file_or_stdin(argv, from_stdin: , **options)
|
34
34
|
default_options = { source_not_given_msg: 'Specify input data',
|
35
35
|
both_sources_given_msg: 'Specify either file with data or data itself in stdin, not both'}
|
36
36
|
options = default_options.merge(options)
|
37
|
-
|
38
|
-
|
39
|
-
if
|
40
|
-
|
41
|
-
elsif
|
42
|
-
|
37
|
+
raise ArgumentError, options[:both_sources_given_msg] if from_stdin && !argv.empty?
|
38
|
+
raise ArgumentError, options[:source_not_given_msg] if !from_stdin && argv.empty?
|
39
|
+
if from_stdin || argv == ['-']
|
40
|
+
$stdin.readlines
|
41
|
+
elsif argv.length == 1
|
42
|
+
File.readlines(argv.first)
|
43
43
|
else
|
44
|
-
raise ArgumentError,
|
44
|
+
raise ArgumentError, 'alignment should either be in stdin or in file, specified by arglist'
|
45
45
|
end
|
46
|
-
lines
|
47
46
|
end
|
48
47
|
|
49
48
|
def direct_output_filename(output_file)
|
@@ -65,7 +64,7 @@ begin
|
|
65
64
|
Usage:
|
66
65
|
glue_logos <output file> <alignment infos file>
|
67
66
|
or
|
68
|
-
<alignment infos file> | glue_logos <output file>
|
67
|
+
<alignment infos file> | glue_logos <output file> --from-stdin
|
69
68
|
|
70
69
|
Alignment infos has the following format (tab separated)
|
71
70
|
if motif names not specified - filenames are used as labels:
|
@@ -79,7 +78,7 @@ begin
|
|
79
78
|
total_orientation = :direct
|
80
79
|
default_options = { x_unit: 30, y_unit: 60, logo_shift: 300, scheme: 'nucl_simpa',
|
81
80
|
icd_mode: :discrete, threshold_lines: false,
|
82
|
-
text_size: 24, background_color: 'white' }
|
81
|
+
text_size: 24, background_color: 'white', from_stdin: false }
|
83
82
|
cli = SequenceLogo::CLI.new(default_options)
|
84
83
|
cli.instance_eval do
|
85
84
|
parser.banner = doc
|
@@ -102,13 +101,18 @@ begin
|
|
102
101
|
options[:background_fill] = Magick::SolidFill.new(v)
|
103
102
|
end
|
104
103
|
end
|
104
|
+
|
105
|
+
parser.on('--from-stdin') do
|
106
|
+
options[:from_stdin] = true
|
107
|
+
end
|
105
108
|
end
|
106
109
|
options = cli.parse_options!(argv)
|
107
110
|
|
108
111
|
output_file = argv.shift
|
109
112
|
raise ArgumentError, 'Specify output file' unless output_file
|
110
113
|
|
111
|
-
alignment_lines = readlines_from_file_or_stdin(argv,
|
114
|
+
alignment_lines = readlines_from_file_or_stdin(argv, from_stdin: options[:from_stdin],
|
115
|
+
source_not_given_msg: 'Specify alignment infos',
|
112
116
|
both_sources_given_msg: 'You can specify alignment infos either from file or from stdin. Don\'t use both sources simultaneously')
|
113
117
|
alignment = make_logo_alignment(load_alignment_infos(alignment_lines), options)
|
114
118
|
|
@@ -16,9 +16,9 @@ def in_necessary_orientations(objects_to_render, orientation, logo_folder)
|
|
16
16
|
end.flatten
|
17
17
|
end
|
18
18
|
|
19
|
-
def arglist_augmented_with_stdin(argv)
|
19
|
+
def arglist_augmented_with_stdin(argv, from_stdin:)
|
20
20
|
result = argv
|
21
|
-
result += $stdin.read.shellsplit
|
21
|
+
result += $stdin.read.shellsplit if from_stdin
|
22
22
|
result
|
23
23
|
end
|
24
24
|
|
@@ -35,7 +35,7 @@ begin
|
|
35
35
|
Usage:
|
36
36
|
sequence_logo [options] <motif file>...
|
37
37
|
or
|
38
|
-
ls pcm_folder/*.pcm | sequence_logo [options]
|
38
|
+
ls pcm_folder/*.pcm | sequence_logo --from-stdin [options]
|
39
39
|
or
|
40
40
|
sequence_logo --sequence <sequence>...
|
41
41
|
or
|
@@ -47,7 +47,7 @@ begin
|
|
47
47
|
default_options = { x_unit: 30, y_unit: 60, scheme: 'nucl_simpa',
|
48
48
|
orientation: :direct, icd_mode: :discrete, threshold_lines: true,
|
49
49
|
logo_folder: '.', background_color: 'white',
|
50
|
-
from_dinucleotide: false }
|
50
|
+
from_dinucleotide: false, from_stdin: false }
|
51
51
|
cli = SequenceLogo::CLI.new(default_options)
|
52
52
|
cli.instance_eval do
|
53
53
|
parser.banner = doc
|
@@ -73,6 +73,9 @@ begin
|
|
73
73
|
options[:background_fill] = Magick::SolidFill.new(v)
|
74
74
|
end
|
75
75
|
end
|
76
|
+
parser.on('--from-stdin') {
|
77
|
+
options[:from_stdin] = true
|
78
|
+
}
|
76
79
|
|
77
80
|
parser.on('--dinucleotide'){ options[:from_dinucleotide] = true }
|
78
81
|
end
|
@@ -90,7 +93,7 @@ begin
|
|
90
93
|
|
91
94
|
objects_to_render = []
|
92
95
|
if options[:sequence]
|
93
|
-
sequences = arglist_augmented_with_stdin(argv)
|
96
|
+
sequences = arglist_augmented_with_stdin(argv, from_stdin: options[:from_stdin])
|
94
97
|
raise ArgumentError, 'Specify at least one sequence' if sequences.empty?
|
95
98
|
|
96
99
|
sequences.each do |sequence|
|
@@ -98,7 +101,7 @@ begin
|
|
98
101
|
name: File.join(logo_folder, sequence)}
|
99
102
|
end
|
100
103
|
elsif options[:sequence_w_snp]
|
101
|
-
sequences = arglist_augmented_with_stdin(argv)
|
104
|
+
sequences = arglist_augmented_with_stdin(argv, from_stdin: options[:from_stdin])
|
102
105
|
raise ArgumentError, 'Specify at least one sequence' if sequences.empty?
|
103
106
|
|
104
107
|
sequences.each do |sequence_w_snp|
|
@@ -106,7 +109,7 @@ begin
|
|
106
109
|
name: File.join(logo_folder, sequence_w_snp.gsub(/[\[\]\/]/, '_'))}
|
107
110
|
end
|
108
111
|
else
|
109
|
-
filenames = arglist_augmented_with_stdin(argv)
|
112
|
+
filenames = arglist_augmented_with_stdin(argv, from_stdin: options[:from_stdin])
|
110
113
|
raise ArgumentError, 'Specify at least one motif file' if filenames.empty?
|
111
114
|
|
112
115
|
filenames.each do |filename|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sequence_logo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.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:
|
11
|
+
date: 2018-04-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rmagick
|
@@ -51,6 +51,7 @@ extra_rdoc_files: []
|
|
51
51
|
files:
|
52
52
|
- ".gitignore"
|
53
53
|
- Gemfile
|
54
|
+
- Gemfile.lock
|
54
55
|
- LICENSE
|
55
56
|
- README.md
|
56
57
|
- Rakefile
|
@@ -118,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
119
|
version: '0'
|
119
120
|
requirements: []
|
120
121
|
rubyforge_project:
|
121
|
-
rubygems_version: 2.
|
122
|
+
rubygems_version: 2.7.3
|
122
123
|
signing_key:
|
123
124
|
specification_version: 4
|
124
125
|
summary: Tool for drawing sequence logos of motifs
|