File: evalue-filter.rb

package info (click to toggle)
genometools 1.6.1%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 50,412 kB
  • sloc: ansic: 271,241; ruby: 30,339; python: 4,880; sh: 3,193; makefile: 1,194; perl: 219; pascal: 159; haskell: 37; sed: 5
file content (29 lines) | stat: -rwxr-xr-x 575 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env ruby

if ARGV.length != 2
  STDERR.puts "Usage: #{$0} <evalue-filter> <file with subset>"
  exit 1
end

def openthefile(filename)
  begin
    fp = File.new(filename,"r")
  rescue => err
    STDERR.puts "#{$0}: cannot open #{filename}: #{err}"
    exit 1
  end
end

evalue_filter = ARGV[0].to_f
fpstrong = openthefile(ARGV[1])

fpstrong.each_line do |line|
  if not line.match(/^#/)
    a = line.split(/\s/)
    evalue = a[a.length - 1].to_f
    if evalue > evalue_filter
      STDERR.puts "#{$0}: unexpected line: #{line.chomp}"
      exit 1
    end
  end
end