[hg] galaxy 3727: Cuffcompare wrapper handles all outputs gracef...
details: http://www.bx.psu.edu/hg/galaxy/rev/8e00344d941a changeset: 3727:8e00344d941a user: jeremy goecks <jeremy.goecks@emory.edu> date: Fri Apr 30 18:26:06 2010 -0400 description: Cuffcompare wrapper handles all outputs gracefully. Tests needed. diffstat: tools/ngs_rna/cuffcompare_wrapper.py | 30 +++++++++++++++++++-------- tools/ngs_rna/cuffcompare_wrapper.xml | 38 +++++++++++++++++++++++++++++++++- 2 files changed, 57 insertions(+), 11 deletions(-) diffs (130 lines): diff -r c642fbb301fc -r 8e00344d941a tools/ngs_rna/cuffcompare_wrapper.py --- a/tools/ngs_rna/cuffcompare_wrapper.py Fri Apr 30 13:09:29 2010 -0400 +++ b/tools/ngs_rna/cuffcompare_wrapper.py Fri Apr 30 18:26:06 2010 -0400 @@ -18,6 +18,11 @@ parser.add_option( '-A', '--transcripts-accuracy-output', dest='transcripts_accuracy_output_file', help='' ) parser.add_option( '-B', '--transcripts-combined-output', dest='transcripts_combined_output_file', help='' ) parser.add_option( '-C', '--transcripts-tracking-output', dest='transcripts_tracking_output_file', help='' ) + parser.add_option( '', '--input1-tmap-output', dest='input1_tmap_output_file', help='' ) + parser.add_option( '', '--input1-refmap-output', dest='input1_refmap_output_file', help='' ) + parser.add_option( '', '--input2-tmap-output', dest='input2_tmap_output_file', help='' ) + parser.add_option( '', '--input2-refmap-output', dest='input2_refmap_output_file', help='' ) + (options, args) = parser.parse_args() @@ -35,17 +40,22 @@ if options.ignore_nonoverlap: cmd += " -R " - # Output/debugging. - print cmd + # Add input files. - # Add input files. - cmd += " %s" % options.input1 + # Need to symlink inputs so that output files are written to temp directory. + print options.input1 + input1_file_name = tmp_output_dir + "/input1" + os.symlink( options.input1, input1_file_name ) + cmd += " %s" % input1_file_name two_inputs = ( options.input2 != None) if two_inputs: - cmd += " %s" % options.input2 + input2_file_name = tmp_output_dir + "/input2" + os.symlink( options.input2, input2_file_name ) + cmd += " %s" % input2_file_name + print cmd # Run command. - try: + try: tmp_name = tempfile.NamedTemporaryFile( dir=tmp_output_dir ).name tmp_stderr = open( tmp_name, 'wb' ) proc = subprocess.Popen( args=cmd, shell=True, cwd=tmp_output_dir, stderr=tmp_stderr.fileno() ) @@ -79,16 +89,18 @@ try: try: shutil.copyfile( tmp_output_dir + "/cc_output", options.transcripts_accuracy_output_file ) + shutil.copyfile( tmp_output_dir + "/input1.tmap", options.input1_tmap_output_file ) + shutil.copyfile( tmp_output_dir + "/input1.refmap", options.input1_refmap_output_file ) if two_inputs: shutil.copyfile( tmp_output_dir + "/cc_output.combined.gtf", options.transcripts_combined_output_file ) shutil.copyfile( tmp_output_dir + "/cc_output.tracking", options.transcripts_tracking_output_file ) - - # TODO: also copy *.tmap, *.refmap to outputs? + shutil.copyfile( tmp_output_dir + "/input2.tmap", options.input2_tmap_output_file ) + shutil.copyfile( tmp_output_dir + "/input2.refmap", options.input2_refmap_output_file ) except Exception, e: stop_err( 'Error in cuffcompare:\n' + str( e ) ) finally: # Clean up temp dirs - if os.path.exists( tmp_output_dir ): + if not os.path.exists( tmp_output_dir ): shutil.rmtree( tmp_output_dir ) if __name__=="__main__": __main__() \ No newline at end of file diff -r c642fbb301fc -r 8e00344d941a tools/ngs_rna/cuffcompare_wrapper.xml --- a/tools/ngs_rna/cuffcompare_wrapper.xml Fri Apr 30 13:09:29 2010 -0400 +++ b/tools/ngs_rna/cuffcompare_wrapper.xml Fri Apr 30 18:26:06 2010 -0400 @@ -3,9 +3,13 @@ <command interpreter="python"> cuffcompare_wrapper.py --transcripts-accuracy-output=$transcripts_accuracy + --input1-tmap-output=$input1_tmap + --input1-refmap-output=$input1_refmap #if $second_gtf.use_second_gtf == "Yes": --transcripts-combined-output=$transcripts_combined --transcripts-tracking-output=$transcripts_tracking + --input2-tmap-output=$input2_tmap + --input2-refmap-output=$input2_refmap #end if #if $annotation.use_ref_annotation == "Yes": -r $annotation.reference_annotation @@ -46,13 +50,43 @@ </inputs> <outputs> - <data format="gtf" name="transcripts_combined" label="${tool.name} on ${on_string}: combined transcripts"/> - <data format="tracking" name="transcripts_tracking" label="${tool.name} on ${on_string}: transcript tracking"/> + <data format="tmap" name="input1_tmap" label="${tool.name} on ${on_string}: data ${input1.hid} tmap file"/> + <data format="refmap" name="input1_refmap" label="${tool.name} on ${on_string}: data ${input1.hid} refmap file"/> + <data format="tmap" name="input2_tmap" label="${tool.name} on ${on_string}: data ${second_gtf.input2.hid} tmap file"> + <filter>second_gtf['use_second_gtf'] == "Yes"</filter> + </data> + <data format="refmap" name="input2_refmap" label="${tool.name} on ${on_string}: data ${second_gtf.input2.hid} refmap file"> + <filter>second_gtf['use_second_gtf'] == "Yes"</filter> + </data> + <data format="gtf" name="transcripts_combined" label="${tool.name} on ${on_string}: combined transcripts"> + <filter>second_gtf['use_second_gtf'] == "Yes"</filter> + </data> + <data format="tracking" name="transcripts_tracking" label="${tool.name} on ${on_string}: transcript tracking"> + <filter>second_gtf['use_second_gtf'] == "Yes"</filter> + </data> <data format="gtf" name="transcripts_accuracy" label="${tool.name} on ${on_string}: transcript accuracy"/> </outputs> <tests> + <!-- + cuffcompare -r cuffcompare_in3.gtf -R cuffcompare_in1.gtf cuffcompare_in3.gtf + --> <test> + <param name="input1" value="cuffcompare_in1.gtf" ftype="gtf"/> + <param name="use_second_gtf" value="Yes"/> + <param name="input2" value="cuffcompare_in2.gtf" ftype="gtf"/> + <param name="use_ref_annotation" value="Yes"/> + <param name="reference_annotation" value="cuffcompare_in3.gtf" ftype="gtf"/> + <param name="ignore_nonoverlapping_reference" value="Yes"/> + <output name="transcripts_combined" file="cuffcompare_out5.gtf"/> + <!-- + <output name="transcripts_tracking" file="cuffcompare_out6.tracking"/> + <output name="input1_tmap" file="cuffcompare_out1.tmap"/> + <output name="input1_refmap" file="cuffcompare_out2.refmap"/> + <output name="input2_tmap" file="cuffcompare_out3.tmap"/> + <output name="input2_refmap" file="cuffcompare_out4.refmap"/> + <output name="transcripts_accuracy" file="cuffcompare_out7.txt"/> + --> </test> </tests>
participants (1)
-
Nate Coraor