annotate interprophet_wrapper.rb @ 3:255b5b6ec617 draft default tip

Better defaults for omssa
author Ira Cooke <iracooke@gmail.com>
date Mon, 23 Jul 2012 14:48:31 +1000
parents a929e27eb203
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
1 require 'pathname'
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
2
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
3 $VERBOSE=nil
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
4
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
5 # Hard-Coded argument order and number of arguments
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
6 #
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
7 actual_output_path_string=ARGV[0]
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
8 use_nss=ARGV[1]
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
9 use_nrs=ARGV[2]
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
10 use_nse=ARGV[3]
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
11 use_nsi=ARGV[4]
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
12 use_nsm=ARGV[5]
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
13 minprob=ARGV[6]
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
14 minprob_val=ARGV[7]
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
15
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
16 wd= Dir.pwd
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
17 original_input_files=ARGV.drop(7)
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
18 # End hard coded args #
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
19
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
20 cmd=""
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
21
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
22 output_substitution_cmds=""
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
23
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
24 input_files=original_input_files.collect do |input|
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
25
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
26 # We append ".pep.xml" to the input file name because interprophet can't handle anything else
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
27 # In order for this to work properly we need to create a symbolic link our working directory
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
28 #
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
29 original_input_path=Pathname.new("#{input}")
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
30 actual_input_path_string="#{wd}/#{original_input_path.basename}.pep.xml"
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
31
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
32 cmd << "ln -s #{input} #{actual_input_path_string};"
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
33 output_substitution_cmds << "ruby -pi -e \"gsub('#{actual_input_path_string}', '#{input}.pep.xml')\" interprophet_output.pep.xml;"
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
34 actual_input_path_string
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
35 end
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
36
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
37 interprophet_path=%x[which interprophet.rb]
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
38 cmd << interprophet_path.chomp
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
39
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
40 cmd << " --no-nss" unless use_nss=="blank"
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
41 cmd << " --no-nrs" unless use_nrs=="blank"
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
42 cmd << " --no-nse" unless use_nse=="blank"
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
43 cmd << " --no-nsi" unless use_nsi=="blank"
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
44 cmd << " --no-nsm" unless use_nsm=="blank"
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
45
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
46
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
47 input_files.each { |input|
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
48 cmd << " #{input}"
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
49 }
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
50
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
51
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
52 cmd << " -o interprophet_output.pep.xml -r"
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
53
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
54 cmd << ";#{output_substitution_cmds}"
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
55
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
56 %x[#{cmd}]
a929e27eb203 Uploaded
iracooke
parents:
diff changeset
57