Mercurial > repos > iracooke > tpp_prophets
changeset 9:c04896f31ff7
Added bash wrapper scripts and protxml to table
author | Ira Cooke <iracooke@gmail.com> |
---|---|
date | Mon, 10 Jun 2013 04:58:03 -0500 |
parents | d19a95abf2e4 |
children | 0ad9b29c22e5 |
files | interprophet_wrapper.rb interprophet_wrapper.sh peptide_prophet_wrapper.rb peptide_prophet_wrapper.sh protein_prophet_wrapper.rb protein_prophet_wrapper.sh protxml_to_table.xml |
diffstat | 7 files changed, 112 insertions(+), 127 deletions(-) [+] |
line wrap: on
line diff
--- a/interprophet_wrapper.rb Sun Jun 09 08:19:01 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -require 'pathname' - -$VERBOSE=nil - -# Hard-Coded argument order and number of arguments -# -actual_output_path_string=ARGV[0] -use_nss=ARGV[1] -use_nrs=ARGV[2] -use_nse=ARGV[3] -use_nsi=ARGV[4] -use_nsm=ARGV[5] -minprob=ARGV[6] -minprob_val=ARGV[7] - -wd= Dir.pwd -original_input_files=ARGV.drop(7) -# End hard coded args # - -cmd="" - -output_substitution_cmds="" - -input_files=original_input_files.collect do |input| - - # We append ".pep.xml" to the input file name because interprophet can't handle anything else - # In order for this to work properly we need to create a symbolic link our working directory - # - original_input_path=Pathname.new("#{input}") - actual_input_path_string="#{wd}/#{original_input_path.basename}.pep.xml" - - cmd << "ln -s #{input} #{actual_input_path_string};" - output_substitution_cmds << "ruby -pi -e \"gsub('#{actual_input_path_string}', '#{input}.pep.xml')\" interprophet_output.pep.xml;" - actual_input_path_string -end - -cmd << "rvm 1.9.3@protk-1.2.0 do interprophet.rb" - -cmd << " --no-nss" unless use_nss=="blank" -cmd << " --no-nrs" unless use_nrs=="blank" -cmd << " --no-nse" unless use_nse=="blank" -cmd << " --no-nsi" unless use_nsi=="blank" -cmd << " --no-nsm" unless use_nsm=="blank" - - -input_files.each { |input| - cmd << " #{input}" -} - - -cmd << " -o interprophet_output.pep.xml -r" - -cmd << ";#{output_substitution_cmds}" - -%x[#{cmd}] -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/interprophet_wrapper.sh Mon Jun 10 04:58:03 2013 -0500 @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +# + +# Hard-Coded argument order +# Args 0-4 are like (eg --no-nss) +# Args 5 and 6 are like (eg --minprob 0.5) +# Remaining args are filenames +# +actual_output_path_string=$1;shift +for i in {0 1 2 3 4}; do + if [ $1 != "blank" ]; then cmd_args[$i]=$1; fi;shift +done +cmd_args+=($1);shift +cmd_args+=($1);shift + +wd=`pwd` + +for original_input_file in $@; do + input_file_name=`basename $original_input_file` + actual_input_path_string=$wd/$input_file_name.pep.xml + ln -s $original_input_file $actual_input_path_string + cmd_args+=($actual_input_path_string) +done + +rvm 1.9.3@protk-1.2.2 do interprophet.rb ${cmd_args[@]} -o interprophet_output.pep.xml -r; + +if [ -f interprophet_output.pep.xml ]; then + for original_input_file in $@; do + actual_input_path_string=$wd/`basename $original_input_file`.pep.xml + sed -i.bak s%$actual_input_path_string%$original_input_file%g interprophet_output.pep.xml + done +fi +
--- a/peptide_prophet_wrapper.rb Sun Jun 09 08:19:01 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -require 'pathname' - -$VERBOSE=nil - -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 << "rvm 1.9.3@protk-1.2.0 do peptide_prophet.rb" - - -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" - -p %x[#{cmd}]
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/peptide_prophet_wrapper.sh Mon Jun 10 04:58:03 2013 -0500 @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +actual_output_path_string=$1;shift + +original_input_file=$1;shift + +# 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=`pwd` + +actual_input_path_string=$wd/`basename $original_input_file`.pep.xml + +full_tmp_output_path_string=$wd/peptide_prophet_output.pep.xml + +ln -s $original_input_file $actual_input_path_string + + +rvm 1.9.3@protk-1.2.2 do peptide_prophet.rb $actual_input_path_string $@ -o peptide_prophet_output.pep.xml; + +sed -i.bak s%$actual_input_path_string%$original_input_file%g peptide_prophet_output.pep.xml +sed -i.bak s%$full_tmp_output_path_string%$actual_output_path_string%g peptide_prophet_output.pep.xml +
--- a/protein_prophet_wrapper.rb Sun Jun 09 08:19:01 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -require 'pathname' - -$VERBOSE=nil - -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" - -cmd = "ln -s #{original_input_file} #{actual_input_path_string};" - -cmd << "rvm 1.9.3@protk-1.2.0 do protein_prophet.rb" - - -ARGV[0]="#{actual_input_path_string}" - -ARGV.each { |a| - - cmd << " #{a}" -} - -cmd << " -o protein_prophet_results.prot.xml" - -cmd << ";ruby -pi -e \"gsub('#{actual_input_path_string}', '#{original_input_file}.pep.xml')\" protein_prophet_results.prot.xml" - -%x[#{cmd}] -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/protein_prophet_wrapper.sh Mon Jun 10 04:58:03 2013 -0500 @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +# + +actual_output_path_string=$1;shift +original_input_file=$1;shift + +# 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=`pwd` + +actual_input_path_string=$wd/`basename $original_input_file`.pep.xml + +ln -s $original_input_file $actual_input_path_string + +rvm 1.9.3@protk-1.2.2 do protein_prophet.rb $actual_input_path_string $@ -o protein_prophet_results.prot.xml + +if [ -f protein_prophet_results.prot.xml ]; then + sed -i.bak s%$actual_input_path_string%$original_input_file.pep.xml%g protein_prophet_results.prot.xml +fi +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/protxml_to_table.xml Mon Jun 10 04:58:03 2013 -0500 @@ -0,0 +1,35 @@ +<tool id="protxml_to_table_1" name="ProtXML to Table" version="1.0.1"> + <requirements> + <requirement type="package" version="1.2.2">galaxy_protk</requirement> + </requirements> + + <description>Converts a ProtXML file to a table</description> + + <command> + rvm 1.9.3@protk-1.2.2 do protxml_to_table.rb + + $input_file + -o $output + </command> + + <inputs> + + <param format="protxml" name="input_file" type="data" label="ProtXML File to Convert"/> + + </inputs> + + + <outputs> + <data format="tabular" name="output" /> + </outputs> + + + <help> + +**What it does** + +Converts a ProtXML file to a tab separated table + + </help> + +</tool>