2
|
1 require 'pathname'
|
|
2
|
|
3 $VERBOSE=nil
|
|
4
|
|
5 actual_output_path_string=ARGV.shift
|
|
6
|
|
7 # Second argument is the original input file name ... we'll change this below
|
|
8 original_input_file=ARGV[0]
|
|
9
|
|
10 # Before doing anything we append create a link to the input file in our working dir with ".pep.xml" appended to the input
|
|
11 # name because peptide prophet can't handle anything else
|
|
12
|
|
13 wd= Dir.pwd
|
|
14
|
|
15 original_input_path=Pathname.new("#{original_input_file}")
|
|
16 actual_input_path_string="#{wd}/#{original_input_path.basename}.pep.xml"
|
|
17 full_tmp_output_path_string="#{wd}/peptide_prophet_output.pep.xml"
|
|
18
|
|
19 cmd = "ln -s #{original_input_file} #{actual_input_path_string};"
|
|
20
|
|
21 cmd << "rvm 1.9.3@protk-1.1.9 do peptide_prophet.rb"
|
|
22
|
|
23
|
|
24 ARGV[0]="#{actual_input_path_string}"
|
|
25
|
|
26 ARGV.each { |a|
|
|
27 cmd << " #{a}"
|
|
28 }
|
|
29
|
|
30 cmd << " -o peptide_prophet_output.pep.xml"
|
|
31
|
|
32 # Finally we need to fix up the output file so any references to the temporary working file are changed to refs to the original input file
|
|
33 cmd << ";ruby -pi -e \"gsub('#{actual_input_path_string}', '#{original_input_file}')\" peptide_prophet_output.pep.xml"
|
|
34 cmd << ";ruby -pi -e \"gsub('#{full_tmp_output_path_string}', '#{actual_output_path_string}')\" peptide_prophet_output.pep.xml"
|
|
35
|
4
|
36 p %x[#{cmd}]
|