# HG changeset patch # User devteam # Date 1506797901 14400 # Node ID 4ac14b275acaf500864f345e65d0fad0144a6b93 # Parent bb07615a5b6aa7d7fad4bc7c6bc05ec550d838ac planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/galaxy_sequence_utils/fastq_manipulation commit f2582539542b33240234e8ea6093e25d0aee9b6a diff -r bb07615a5b6a -r 4ac14b275aca fastq_manipulation.py --- a/fastq_manipulation.py Wed Nov 11 12:41:10 2015 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -#Dan Blankenberg -import sys, os, shutil -import imp -from galaxy_utils.sequence.fastq import fastqReader, fastqWriter - -def main(): - #Read command line arguments - input_filename = sys.argv[1] - script_filename = sys.argv[2] - output_filename = sys.argv[3] - additional_files_path = sys.argv[4] - input_type = sys.argv[5] or 'sanger' - - #Save script file for debuging/verification info later - os.mkdir( additional_files_path ) - shutil.copy( script_filename, os.path.join( additional_files_path, 'debug.txt' ) ) - - fastq_manipulator = imp.load_module( 'fastq_manipulator', open( script_filename ), script_filename, ( '', 'r', imp.PY_SOURCE ) ) - - out = fastqWriter( open( output_filename, 'wb' ), format = input_type ) - - i = None - reads_manipulated = 0 - for i, fastq_read in enumerate( fastqReader( open( input_filename ), format = input_type ) ): - new_read = fastq_manipulator.match_and_manipulate_read( fastq_read ) - if new_read: - out.write( new_read ) - if new_read != fastq_read: - reads_manipulated += 1 - out.close() - if i is None: - print "Your file contains no valid FASTQ reads." - else: - print 'Manipulated %s of %s reads (%.2f%%).' % ( reads_manipulated, i + 1, float( reads_manipulated ) / float( i + 1 ) * 100.0 ) - -if __name__ == "__main__": - main() diff -r bb07615a5b6a -r 4ac14b275aca fastq_manipulation.xml --- a/fastq_manipulation.xml Wed Nov 11 12:41:10 2015 -0500 +++ b/fastq_manipulation.xml Sat Sep 30 14:58:21 2017 -0400 @@ -1,199 +1,54 @@ - - - - galaxy_sequence_utils - - reads on various attributes - fastq_manipulation.py $input_file $fastq_manipulation_file $output_file $output_file.files_path '${input_file.extension[len( 'fastq' ):]}' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - int( float( value ) ) == float( value ) - - - - int( float( value ) ) == float( value ) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ##create an importable module + + + reads on various attributes + + galaxy_sequence_utils + + + + 0: + if right_column_offset != 0: right_column_offset = -right_column_offset else: right_column_offset = None - new_read = new_read.slice( left_column_offset, right_column_offset ) - if not ( ${str( manipulate_block['manipulation_type']['manipulation']['keep_zero_length'] ) == 'keep_zero_length'} or len( new_read ) ): + new_read = new_read.slice(left_column_offset, right_column_offset) + if not (${str(manipulate_block['manipulation_type']['manipulation']['keep_zero_length']) == 'keep_zero_length'} or len(new_read)): return None #elif $manipulate_block['manipulation_type']['manipulation']['manipulation_selector'] == 'dna_to_rna': new_read = new_read.sequence_as_DNA() @@ -221,181 +76,335 @@ new_read = new_read.sequence_as_RNA() #elif $manipulate_block['manipulation_type']['manipulation']['manipulation_selector'] == 'change_adapter': if new_read.sequence_space == 'color': - new_read = new_read.change_adapter( binascii.unhexlify( "${ binascii.hexlify( str( manipulate_block['manipulation_type']['manipulation']['new_adapter'] ) ) }" ) ) + new_read = new_read.change_adapter(binascii.unhexlify("${ binascii.hexlify(str(manipulate_block['manipulation_type']['manipulation']['new_adapter'])) }").decode()) #end if #elif $manipulate_block['manipulation_type']['manipulation_type_selector'] == 'quality': #if $manipulate_block['manipulation_type']['manipulation']['manipulation_selector'] == 'translate': - new_read.quality = new_read.quality.translate( maketrans( binascii.unhexlify( "${ binascii.hexlify( str( manipulate_block['manipulation_type']['manipulation']['from'] ) ) }" ), binascii.unhexlify( "${ binascii.hexlify( str( manipulate_block['manipulation_type']['manipulation']['to'] ) ) }" ) ) ) + new_read.quality = new_read.quality.translate(maketrans(binascii.unhexlify("${ binascii.hexlify(str(manipulate_block['manipulation_type']['manipulation']['from'])) }").decode(), binascii.unhexlify("${ binascii.hexlify(str(manipulate_block['manipulation_type']['manipulation']['to'])) }").decode())) #elif $manipulate_block['manipulation_type']['manipulation']['manipulation_selector'] == 'map_score': - def score_method( score ): - raise Exception, "Unimplemented" ##This option is not yet available, need to abstract out e.g. column adding tool action: preventing users from using 'harmful' actions - new_read.quality_map( score_method ) + def score_method(score): + raise Exception("Unimplemented") ##This option is not yet available, need to abstract out e.g. column adding tool action: preventing users from using 'harmful' actions + new_read.quality_map(score_method) #end if #elif $manipulate_block['manipulation_type']['manipulation_type_selector'] == 'miscellaneous': #if $manipulate_block['manipulation_type']['manipulation']['manipulation_selector'] == 'remove': return None #end if #else: - #continue + #continue #end if #end for if new_read.description != "+": - new_read.description = "+%s" % new_read.identifier[1:] ##ensure description is still valid + new_read.description = "+%s" % new_read.identifier[1:] ##ensure description is still valid return new_read -def match_and_manipulate_read( fastq_read ): + + +def match_and_manipulate_read(fastq_read): new_read = fastq_read - if match_read( fastq_read ): - new_read = manipulate_read( fastq_read ) + if match_read(fastq_read): + new_read = manipulate_read(fastq_read) return new_read - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ]]> 10.1093/bioinformatics/btq281 diff -r bb07615a5b6a -r 4ac14b275aca test-data/sanger_full_range_as_rna.fastqsanger.bz2 Binary file test-data/sanger_full_range_as_rna.fastqsanger.bz2 has changed diff -r bb07615a5b6a -r 4ac14b275aca test-data/sanger_full_range_as_rna.fastqsanger.gz Binary file test-data/sanger_full_range_as_rna.fastqsanger.gz has changed diff -r bb07615a5b6a -r 4ac14b275aca tool_dependencies.xml --- a/tool_dependencies.xml Wed Nov 11 12:41:10 2015 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ - - - - - -