# HG changeset patch # User fangly # Date 1318916894 14400 # Node ID 68576b1d2d8bb66e7dd9e6bc9cae5aaf7b4ed62e # Parent 5ba7c9ac056a6fc96aeb0237bdca6b1291a34f90 Uploaded diff -r 5ba7c9ac056a -r 68576b1d2d8b grinder.xml --- a/grinder.xml Tue Oct 04 02:01:58 2011 -0400 +++ b/grinder.xml Tue Oct 18 01:48:14 2011 -0400 @@ -1,13 +1,4 @@ - - - + genomic, metagenomic and amplicon read simulator @@ -17,12 +8,8 @@ grinder --version - - #set $tool_dir = os.path.join( os.path.abspath($__root_dir__), 'tools', 'ngs_simulation' ) - #set $script1 = os.path.join( $tool_dir, 'stderr_wrapper.py' ) - #set $script2 = os.path.join( $tool_dir, 'grinder_multiple_outputs.py' ) - - $script1 + + stderr_wrapper.py grinder #if $reference_file.specify == "builtin": -reference_file ${ filter( lambda x: str( x[0] ) == str( $reference_file.value ), $__app__.tool_data_tables[ 'all_fasta' ].get_fields() )[0][-1] } @@ -101,7 +88,7 @@ #if str($qual_levels): -qual_levels $qual_levels #end if - #if str($fastq_output): + #if str($fastq_output) == '1': -fastq_output $fastq_output #end if #if str($profile_file) != "None": @@ -110,16 +97,6 @@ - - #set $output_dir = $__new_file_path__ - -output_dir $output_dir - - #set $base_name = $output.id - -base_name $base_name - ; - - $script2 $output_dir $base_name - @@ -199,7 +176,7 @@ 1/ uniform distribution: uniform, 2/ powerlaw distribution with parameter 0.1: powerlaw 0.1." /> - + @@ -248,7 +225,164 @@ --> - + + + + int(str(num_libraries)) == 1 + + + int(str(num_libraries)) == 1 and fastq_output == 0 + + + int(str(num_libraries)) == 1 and str(qual_levels) and fastq_output == 0 + + + int(str(num_libraries)) == 1 and fastq_output == 1 + + + + + + + + int(str(num_libraries)) >= 2 + + + int(str(num_libraries)) >= 2 and fastq_output == 0 + + + int(str(num_libraries)) >= 2 and str(qual_levels) and fastq_output == 0 + + + int(str(num_libraries)) >= 2 and fastq_output == 1 + + + + + int(str(num_libraries)) >= 2 + + + int(str(num_libraries)) >= 2 and fastq_output == 0 + + + int(str(num_libraries)) >= 2 and str(qual_levels) and fastq_output == 0 + + + int(str(num_libraries)) >= 2 and fastq_output == 1 + + + + + int(str(num_libraries)) >= 3 + + + int(str(num_libraries)) >= 3 and fastq_output == 0 + + + int(str(num_libraries)) >= 3 and str(qual_levels) and fastq_output == 0 + + + int(str(num_libraries)) >= 3 and fastq_output == 1 + + + + + int(str(num_libraries)) >= 4 + + + int(str(num_libraries)) >= 4 and fastq_output == 0 + + + int(str(num_libraries)) >= 4 and str(qual_levels) and fastq_output == 0 + + + int(str(num_libraries)) >= 4 and fastq_output == 1 + + + + + int(str(num_libraries)) >= 5 + + + int(str(num_libraries)) >= 5 and fastq_output == 0 + + + int(str(num_libraries)) >= 5 and str(qual_levels) and fastq_output == 0 + + + int(str(num_libraries)) >= 5 and fastq_output == 1 + + + + + int(str(num_libraries)) >= 6 + + + int(str(num_libraries)) >= 6 and fastq_output == 0 + + + int(str(num_libraries)) >= 6 and str(qual_levels) and fastq_output == 0 + + + int(str(num_libraries)) >= 6 and fastq_output == 1 + + + + + int(str(num_libraries)) >= 7 + + + int(str(num_libraries)) >= 7 and fastq_output == 0 + + + int(str(num_libraries)) >= 7 and str(qual_levels) and fastq_output == 0 + + + int(str(num_libraries)) >= 7 and fastq_output == 1 + + + + + int(str(num_libraries)) >= 8 + + + int(str(num_libraries)) >= 8 and fastq_output == 0 + + + int(str(num_libraries)) >= 8 and str(qual_levels) and fastq_output == 0 + + + int(str(num_libraries)) >= 8 and fastq_output == 1 + + + + + int(str(num_libraries)) >= 9 + + + int(str(num_libraries)) >= 9 and fastq_output == 0 + + + int(str(num_libraries)) >= 9 and str(qual_levels) and fastq_output == 0 + + + int(str(num_libraries)) >= 9 and fastq_output == 1 + + + + + int(str(num_libraries)) >= 10 + + + int(str(num_libraries)) >= 10 and fastq_output == 0 + + + int(str(num_libraries)) >= 10 and str(qual_levels) and fastq_output == 0 + + + int(str(num_libraries)) >= 10 and fastq_output == 1 + + @@ -270,7 +404,6 @@ --> - diff -r 5ba7c9ac056a -r 68576b1d2d8b grinder_multiple_outputs.py --- a/grinder_multiple_outputs.py Tue Oct 04 02:01:58 2011 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,99 +0,0 @@ -#!/usr/bin/env python - -""" -Move files create by Grinder to a location where it is going to be recognized by -Galaxy as multiple output files with the right format. See -http://wiki.g2.bx.psu.edu/Admin/Tools/Multiple Output Files -Example: python grinder_move_outputs output_dir output_id -Author: Florent Angly -""" - -import sys, os, re - -assert sys.version_info[:2] >= ( 2, 4 ) - -def stop_err( msg ): - sys.stderr.write( "%s\n" % msg ) - sys.exit() - -def __main__(): - # Get output dir and ID - args = sys.argv - output_dir = args[1] - output_id = args[2] - - # Move Grinder files to the proper output - # Grinder filenames look like this - # grinder-ranks.txt - # grinder-reads.fa - # grinder-reads.qual - # grinder-1-ranks.txt - # grinder-1-reads.fa - # grinder-1-reads.qual - # grinder-2-ranks.txt - # grinder-2-reads.fa - # grinder-2-reads.qual - - p = re.compile(output_id) - q = re.compile('-(\d+)-') - r = re.compile('-(\w+)$') - - - for fname in os.listdir(output_dir): - - # Skip files that do not start with the output_id - source = os.path.join( output_dir, fname ) - basename, extension = os.path.splitext(fname) - if not p.match(fname): - continue - - # Assign the dataset format - if extension == '.txt': - format = 'text' - elif extension == '.fq': - format = 'fastqsanger' - elif extension == '.fastq': - format = 'fastqsanger' - elif extension == '.fa': - format = 'fasta' - elif extension == '.fna': - format = 'fasta' - elif extension == '.faa': - format = 'fasta' - elif extension == '.fasta': - format = 'fasta' - elif extension == '.qual': - format = 'qual' - else: - stop_err( 'Error: File %s had the unknown extension %s' % ( fname, extension ) ) - - # Assign the dataset name - name = '' - match = q.search(basename) - if match != None: - lib_num = match.group(1) - name = 'lib%s-' % lib_num - - match = r.search(basename) - if match == None: - stop_err( 'Error: File with basename %s did not have a recognized name' % (basename) ) - - lib_type = match.group(1) - if format == 'qual': - lib_type = 'qual' - - name = name + lib_type - - # Move the dataset to the proper place - #db_ref = '' - #destination = os.path.join( output_dir, 'primary_%s_%s_visible_%s_%s' % (output_id, name, format, db_ref) ) - destination = os.path.join( output_dir, 'primary_%s_%s_visible_%s' % (output_id, name, format) ) - - print "moving %s to %s" % (source, destination) - - try: - os.rename(source, destination) - except Exception, e: - stop_err( 'Error: ' + str( e ) ) - -if __name__ == "__main__": __main__()