Mercurial > repos > iracooke > protk
diff peptide_prophet_wrapper.rb @ 0:a929e27eb203 draft
Uploaded
author | iracooke |
---|---|
date | Thu, 21 Jun 2012 22:30:48 -0400 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/peptide_prophet_wrapper.rb Thu Jun 21 22:30:48 2012 -0400 @@ -0,0 +1,38 @@ +require 'pathname' + +$VERBOSE=nil + +peptide_prophet_path=%x[which peptide_prophet.rb] + +actual_output_path_string=ARGV.shift + +# Second argument is the original input file name ... we'll change this below +original_input_file=ARGV[0] + +# Before doing anything we append create a link to the input file in our working dir with ".pep.xml" appended to the input +# name because peptide prophet can't handle anything else + +wd= Dir.pwd + +original_input_path=Pathname.new("#{original_input_file}") +actual_input_path_string="#{wd}/#{original_input_path.basename}.pep.xml" +full_tmp_output_path_string="#{wd}/peptide_prophet_output.pep.xml" + +cmd = "ln -s #{original_input_file} #{actual_input_path_string};" + +cmd << peptide_prophet_path.chomp + + +ARGV[0]="#{actual_input_path_string}" + +ARGV.each { |a| + cmd << " #{a}" +} + +cmd << " -o peptide_prophet_output.pep.xml" + +# 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 +cmd << ";ruby -pi -e \"gsub('#{actual_input_path_string}', '#{original_input_file}')\" peptide_prophet_output.pep.xml" +cmd << ";ruby -pi -e \"gsub('#{full_tmp_output_path_string}', '#{actual_output_path_string}')\" peptide_prophet_output.pep.xml" + +%x[#{cmd}]