macroape 4.0.0 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3037e164fd1b1c23bf40a9fca1d1da39737934a5
4
- data.tar.gz: 4d4482d00ce0c76cbb47fe9d9eff53b48c1d2741
3
+ metadata.gz: 4499602694103f438e53430766a1b5bad85baf61
4
+ data.tar.gz: e95adc086488900be4e0f0654da3543a8ea6a8c2
5
5
  SHA512:
6
- metadata.gz: cc4176fe2b1d2f7b5bf4835b3612d316797f378dbf036bf0bba3135effe1cf9cbba1037ef87c7cffc24d0d2ef8d2ebf16fe5d585780445a1492fa795df44cb48
7
- data.tar.gz: d86983eeb148235e1470dbfa7f674cf0e395129bd1836e34256b42bba06525f0881961cd8c6ca0e5e09df520786a8735e1ec2e10e76c4e59b8cfddb38b151685
6
+ metadata.gz: 42fa7ba9a07625432176831623549395695aa936f19efcfd62e9282f1dc6bb5b93359103b7e84de6d3fcda4686dc5f8f1264756a050e0b1f2fb433c4b96809bb
7
+ data.tar.gz: d4e94f5384e9e1cf4d34d777349b2d4e64e780f7b8ad9a5c71228c4b83b0b791165499c7bdc8c6c84a0a8d384bd617e9c312e68cb27e32713cd0be79a34cf879
@@ -18,6 +18,8 @@ module Macroape
18
18
  Usage:
19
19
  #{run_tool_cmd} [options] <leader pm> <rest pm files>...
20
20
  or
21
+ ls rest_pms/*.pm | #{run_tool_cmd} [options]
22
+ or
21
23
  ls rest_pms/*.pm | #{run_tool_cmd} [options] <leader pm>
22
24
 
23
25
  Options:
@@ -28,8 +30,8 @@ module Macroape
28
30
  [-b <background probabilities] ACGT - 4 numbers, comma-delimited(spaces not allowed), sum should be equal to 1, like 0.25,0.24,0.26,0.25
29
31
  EOS
30
32
 
31
- if argv.empty? || ['-h', '--h', '-help', '--help'].any?{|help_option| argv.include?(help_option)}
32
- STDERR.puts doc
33
+ if (argv.empty? && $stdin.tty?) || ['-h', '--h', '-help', '--help'].any?{|help_option| argv.include?(help_option)}
34
+ $stderr.puts doc
33
35
  exit
34
36
  end
35
37
 
@@ -65,17 +67,20 @@ module Macroape
65
67
  end
66
68
  end
67
69
 
68
- leader_pwm_file = argv.shift
69
- rest_pwms_file = argv
70
- rest_pwms_file += $stdin.read.shellsplit unless $stdin.tty?
71
- rest_pwms_file.reject!{|filename| File.expand_path(filename) == File.expand_path(leader_pwm_file)}
70
+ pwm_files = argv
71
+ pwm_files += $stdin.read.shellsplit unless $stdin.tty?
72
+ leader_pwm_file = pwm_files.first
73
+ rest_pwm_files = pwm_files[1..-1]
74
+ rest_pwm_files.reject!{|filename| File.expand_path(filename) == File.expand_path(leader_pwm_file)}
75
+
76
+ raise 'Specify leader file' unless leader_pwm_file
72
77
 
73
78
  shifts = []
74
79
  shifts << [leader_pwm_file, 0, :direct]
75
80
  pwm_first = data_model.new(File.read(leader_pwm_file)).to_pwm
76
81
  pwm_first.set_parameters(background: leader_background, max_hash_size: max_hash_size).discrete!(discretization)
77
82
 
78
- rest_pwms_file.each do |motif_name|
83
+ rest_pwm_files.each do |motif_name|
79
84
  pwm_second = data_model.new(File.read(motif_name)).to_pwm
80
85
  pwm_second.set_parameters(background: rest_motifs_background, max_hash_size: max_hash_size).discrete!(discretization)
81
86
  cmp = Macroape::PWMCompare.new(pwm_first, pwm_second).set_parameters(max_pair_hash_size: max_pair_hash_size)
@@ -87,7 +92,7 @@ module Macroape
87
92
  puts "#{motif_name}\t#{shift}\t#{orientation}"
88
93
  end
89
94
  rescue => err
90
- STDERR.puts "\n#{err}\n#{err.backtrace.first(5).join("\n")}\n\nUse --help option for help\n\n#{doc}"
95
+ $stderr.puts "\n#{err}\n#{err.backtrace.first(5).join("\n")}\n\nUse --help option for help\n\n#{doc}"
91
96
  end
92
97
 
93
98
  end
@@ -24,7 +24,7 @@ module Macroape
24
24
  EOS
25
25
 
26
26
  if argv.empty? || ['-h', '--h', '-help', '--help'].any?{|help_option| argv.include?(help_option)}
27
- STDERR.puts doc
27
+ $stderr.puts doc
28
28
  exit
29
29
  end
30
30
 
@@ -148,7 +148,7 @@ module Macroape
148
148
  puts Helper.similarity_info_string(info)
149
149
 
150
150
  rescue => err
151
- STDERR.puts "\n#{err}\n#{err.backtrace.first(5).join("\n")}\n\nUse --help option for help\n\n#{doc}"
151
+ $stderr.puts "\n#{err}\n#{err.backtrace.first(5).join("\n")}\n\nUse --help option for help\n\n#{doc}"
152
152
  end
153
153
 
154
154
  end
@@ -23,7 +23,7 @@ module Macroape
23
23
  EOS
24
24
 
25
25
  if argv.empty? || ['-h', '--h', '-help', '--help'].any?{|help_option| argv.include?(help_option)}
26
- STDERR.puts doc
26
+ $stderr.puts doc
27
27
  exit
28
28
  end
29
29
 
@@ -129,7 +129,7 @@ module Macroape
129
129
  puts Helper.similarity_info_string(info)
130
130
 
131
131
  rescue => err
132
- STDERR.puts "\n#{err}\n#{err.backtrace.first(5).join("\n")}\n\nUse --help option for help\n\n#{doc}"
132
+ $stderr.puts "\n#{err}\n#{err.backtrace.first(5).join("\n")}\n\nUse --help option for help\n\n#{doc}"
133
133
  end
134
134
 
135
135
  end
@@ -20,7 +20,7 @@ module Macroape
20
20
  EOS
21
21
 
22
22
  if argv.empty? || ['-h', '--h', '-help', '--help'].any?{|help_option| argv.include?(help_option)}
23
- STDERR.puts doc
23
+ $stderr.puts doc
24
24
  exit
25
25
  end
26
26
 
@@ -79,7 +79,7 @@ module Macroape
79
79
  {discretization: discretization,
80
80
  background: background} )
81
81
  rescue => err
82
- STDERR.puts "\n#{err}\n#{err.backtrace.first(5).join("\n")}\n\nUse --help option for help\n\n#{doc}"
82
+ $stderr.puts "\n#{err}\n#{err.backtrace.first(5).join("\n")}\n\nUse --help option for help\n\n#{doc}"
83
83
  end
84
84
 
85
85
  end
@@ -21,7 +21,7 @@ module Macroape
21
21
  EOS
22
22
 
23
23
  if argv.empty? || ['-h', '--h', '-help', '--help'].any?{|help_option| argv.include?(help_option)}
24
- STDERR.puts doc
24
+ $stderr.puts doc
25
25
  exit
26
26
  end
27
27
 
@@ -88,7 +88,7 @@ module Macroape
88
88
  background: background,
89
89
  pvalue_boundary: pvalue_boundary} )
90
90
  rescue => err
91
- STDERR.puts "\n#{err}\n#{err.backtrace.first(5).join("\n")}\n\nUse --help option for help\n\n#{doc}"
91
+ $stderr.puts "\n#{err}\n#{err.backtrace.first(5).join("\n")}\n\nUse --help option for help\n\n#{doc}"
92
92
  end
93
93
 
94
94
  end
@@ -26,7 +26,7 @@ module Macroape
26
26
  EOS
27
27
 
28
28
  if argv.empty? || ['-h', '--h', '-help', '--help'].any?{|help_option| argv.include?(help_option)}
29
- STDERR.puts doc
29
+ $stderr.puts doc
30
30
  exit
31
31
  end
32
32
 
@@ -99,7 +99,7 @@ module Macroape
99
99
  pwms = motifs.map(&:to_pwm)
100
100
 
101
101
  pwms.each_with_index do |pwm,index|
102
- STDERR.puts "Motif #{pwm.name}, length: #{pwm.length} (#{index+1} of #{pwms.size}, #{index*100/pwms.size}% complete)" unless silent
102
+ $stderr.puts "Motif #{pwm.name}, length: #{pwm.length} (#{index+1} of #{pwms.size}, #{index*100/pwms.size}% complete)" unless silent
103
103
 
104
104
  # When support of onefile collections is introduced - then here should be check if name exists.
105
105
  # Otherwise it should skip motif and tell you about this
@@ -140,7 +140,7 @@ module Macroape
140
140
  end
141
141
  collection.add_pm(pwm, info) unless skip_motif
142
142
  end
143
- STDERR.puts "100% complete. Saving results" unless silent
143
+ $stderr.puts "100% complete. Saving results" unless silent
144
144
  File.open(output_file, 'w') do |f|
145
145
  f.puts(collection.to_yaml)
146
146
  end
@@ -152,7 +152,7 @@ module Macroape
152
152
  infos.background_parameter('B', 'background', background)
153
153
  }.result
154
154
  rescue => err
155
- STDERR.puts "\n#{err}\n#{err.backtrace.first(5).join("\n")}\n\nUse --help option for help\n\n#{doc}"
155
+ $stderr.puts "\n#{err}\n#{err.backtrace.first(5).join("\n")}\n\nUse --help option for help\n\n#{doc}"
156
156
  end
157
157
 
158
158
  end
@@ -29,7 +29,7 @@ module Macroape
29
29
  EOS
30
30
 
31
31
  if argv.empty? || ['-h', '--h', '-help', '--help'].any?{|help_option| argv.include?(help_option)}
32
- STDERR.puts doc
32
+ $stderr.puts doc
33
33
  exit
34
34
  end
35
35
 
@@ -123,7 +123,7 @@ module Macroape
123
123
 
124
124
  collection.each_with_index do |motif, index|
125
125
  name = motif.name
126
- STDERR.puts "Testing motif #{name} (#{index+1} of #{collection.size}, #{index*100/collection.size}% complete)" unless silent
126
+ $stderr.puts "Testing motif #{name} (#{index+1} of #{collection.size}, #{index*100/collection.size}% complete)" unless silent
127
127
  motif.set_parameters(background: collection_background, max_hash_size: max_hash_size)
128
128
  if motif.rough[pvalue]
129
129
  collection_pwm_rough = motif.pwm.discrete(rough_discretization)
@@ -141,7 +141,7 @@ module Macroape
141
141
  similarities[name] = info
142
142
  end
143
143
 
144
- STDERR.puts "100% complete" unless silent
144
+ $stderr.puts "100% complete" unless silent
145
145
 
146
146
  similarities_to_output = similarities.sort_by{|name, info| info[:similarity] }.reverse.select{|name,info| info[:similarity] >= cutoff }.map{|name,info|info}
147
147
  puts Helper.scan_collection_infos_string( similarities_to_output,
@@ -155,7 +155,7 @@ module Macroape
155
155
  collection_background: collection_background,
156
156
  query_background: query_background} )
157
157
  rescue => err
158
- STDERR.puts "\n#{err}\n#{err.backtrace.first(5).join("\n")}\n\nUse --help option for help\n\n#{doc}"
158
+ $stderr.puts "\n#{err}\n#{err.backtrace.first(5).join("\n")}\n\nUse --help option for help\n\n#{doc}"
159
159
  end
160
160
 
161
161
  end
@@ -1,4 +1,4 @@
1
1
  module Macroape
2
- VERSION = "4.0.0"
2
+ VERSION = "4.0.1"
3
3
  STANDALONE = false
4
4
  end
@@ -21,12 +21,18 @@ class TestAlignmotifs < Test::Unit::TestCase
21
21
  %w[SP1_f1_revcomp.pcm -1 revcomp]],
22
22
  Helpers.align_motifs_output('--pcm KLF4_f2.pcm KLF3_f1.pcm SP1_f1_revcomp.pcm')
23
23
  end
24
- def test_names_from_stdin
24
+ def test_names_from_stdin_leader_specified
25
25
  assert_equal [%w[KLF4_f2.pwm 0 direct],
26
26
  %w[KLF3_f1.pwm -4 direct],
27
27
  %w[SP1_f1_revcomp.pwm -1 revcomp]],
28
28
  Helpers.provide_stdin('KLF3_f1.pwm SP1_f1_revcomp.pwm'){ Helpers.align_motifs_output('KLF4_f2.pwm') }
29
29
  end
30
+ def test_names_from_stdin_leader_not_specified
31
+ assert_equal [%w[KLF4_f2.pwm 0 direct],
32
+ %w[KLF3_f1.pwm -4 direct],
33
+ %w[SP1_f1_revcomp.pwm -1 revcomp]],
34
+ Helpers.provide_stdin('KLF4_f2.pwm KLF3_f1.pwm SP1_f1_revcomp.pwm'){ Helpers.align_motifs_output('') }
35
+ end
30
36
  def test_names_from_stdin_duplicate_leader
31
37
  assert_equal [%w[KLF4_f2.pwm 0 direct],
32
38
  %w[KLF3_f1.pwm -4 direct],
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: macroape
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ilya Vorontsov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-29 00:00:00.000000000 Z
11
+ date: 2013-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bioinform