comparison interprophet_wrapper.rb @ 2:418f42b34049 draft

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