comparison fastq_manipulation.xml @ 4:5b87038565bb draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/galaxy_sequence_utils/fastq_manipulation commit d4ced60a941c4c4a2fe95de9c09a10086810b387"
author iuc
date Wed, 19 Feb 2020 12:31:39 -0500
parents 7861f3b10c68
children e30352e889fe
comparison
equal deleted inserted replaced
3:7861f3b10c68 4:5b87038565bb
1 <tool id="fastq_manipulation" name="Manipulate FASTQ" version="1.1.1"> 1 <tool id="fastq_manipulation" name="Manipulate FASTQ" version="@TOOL_VERSION@">
2 <options sanitize="false" /> 2 <options sanitize="false" />
3 <!-- This tool uses a file to rely all parameter information (actually a dynamically generated python module), we can safely not sanitize any parameters --> 3 <!-- This tool uses a file to rely all parameter information (actually a dynamically generated python module), we can safely not sanitize any parameters -->
4 <description>reads on various attributes</description> 4 <description>reads on various attributes</description>
5 <requirements> 5 <macros>
6 <requirement type="package" version="1.1.1">galaxy_sequence_utils</requirement> 6 <import>macros.xml</import>
7 </requirements> 7 </macros>
8 <expand macro="requirements"/>
8 <edam_topics> 9 <edam_topics>
9 <edam_topic>topic_0622</edam_topic> 10 <edam_topic>topic_0622</edam_topic>
10 </edam_topics> 11 </edam_topics>
11 <edam_operations> 12 <edam_operations>
12 <edam_operation>operation_0233</edam_operation> 13 <edam_operation>operation_0233</edam_operation>
37 #elif $match_block['match_type']['match_type_selector'] == 'quality': 38 #elif $match_block['match_type']['match_type_selector'] == 'quality':
38 search_target = fastq_read.quality 39 search_target = fastq_read.quality
39 #else: 40 #else:
40 #continue 41 #continue
41 #end if 42 #end if
42 if not re.search(binascii.unhexlify("${ binascii.hexlify(str(match_block['match_type']['match']['match_by'])) }").decode(), search_target): 43 if not re.search(binascii.unhexlify(${ binascii.hexlify(str(match_block['match_type']['match']['match_by']).encode()) }).decode(), search_target):
43 return False 44 return False
44 #end for 45 #end for
45 return True 46 return True
46 47
47 48
49 def manipulate_read(fastq_read): 50 def manipulate_read(fastq_read):
50 new_read = fastq_read.clone() 51 new_read = fastq_read.clone()
51 #for $manipulate_block in $manipulate_blocks: 52 #for $manipulate_block in $manipulate_blocks:
52 #if $manipulate_block['manipulation_type']['manipulation_type_selector'] == 'identifier': 53 #if $manipulate_block['manipulation_type']['manipulation_type_selector'] == 'identifier':
53 #if $manipulate_block['manipulation_type']['manipulation']['manipulation_selector'] == 'translate': 54 #if $manipulate_block['manipulation_type']['manipulation']['manipulation_selector'] == 'translate':
54 new_read.identifier = "@%s" % new_read.identifier[1:].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())) 55 new_read.identifier = "@%s" % new_read.identifier[1:].translate(maketrans(binascii.unhexlify(${ binascii.hexlify(str(manipulate_block['manipulation_type']['manipulation']['from']).encode()) }).decode(), binascii.unhexlify(${ binascii.hexlify(str(manipulate_block['manipulation_type']['manipulation']['to']).encode()) }).decode()))
55 #end if 56 #end if
56 #elif $manipulate_block['manipulation_type']['manipulation_type_selector'] == 'sequence': 57 #elif $manipulate_block['manipulation_type']['manipulation_type_selector'] == 'sequence':
57 #if $manipulate_block['manipulation_type']['manipulation']['manipulation_selector'] == 'translate': 58 #if $manipulate_block['manipulation_type']['manipulation']['manipulation_selector'] == 'translate':
58 new_read.sequence = new_read.sequence.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())) 59 new_read.sequence = new_read.sequence.translate(maketrans(binascii.unhexlify(${ binascii.hexlify(str(manipulate_block['manipulation_type']['manipulation']['from']).encode()) }).decode(), binascii.unhexlify(${ binascii.hexlify(str(manipulate_block['manipulation_type']['manipulation']['to']).encode()) }).decode()))
59 #elif $manipulate_block['manipulation_type']['manipulation']['manipulation_selector'] == 'rev_comp': 60 #elif $manipulate_block['manipulation_type']['manipulation']['manipulation_selector'] == 'rev_comp':
60 new_read = new_read.reverse_complement() 61 new_read = new_read.reverse_complement()
61 #elif $manipulate_block['manipulation_type']['manipulation']['manipulation_selector'] == 'rev_no_comp': 62 #elif $manipulate_block['manipulation_type']['manipulation']['manipulation_selector'] == 'rev_no_comp':
62 new_read = new_read.reverse() 63 new_read = new_read.reverse()
63 #elif $manipulate_block['manipulation_type']['manipulation']['manipulation_selector'] == 'no_rev_comp': 64 #elif $manipulate_block['manipulation_type']['manipulation']['manipulation_selector'] == 'no_rev_comp':
81 new_read = new_read.sequence_as_DNA() 82 new_read = new_read.sequence_as_DNA()
82 #elif $manipulate_block['manipulation_type']['manipulation']['manipulation_selector'] == 'rna_to_dna': 83 #elif $manipulate_block['manipulation_type']['manipulation']['manipulation_selector'] == 'rna_to_dna':
83 new_read = new_read.sequence_as_RNA() 84 new_read = new_read.sequence_as_RNA()
84 #elif $manipulate_block['manipulation_type']['manipulation']['manipulation_selector'] == 'change_adapter': 85 #elif $manipulate_block['manipulation_type']['manipulation']['manipulation_selector'] == 'change_adapter':
85 if new_read.sequence_space == 'color': 86 if new_read.sequence_space == 'color':
86 new_read = new_read.change_adapter(binascii.unhexlify("${ binascii.hexlify(str(manipulate_block['manipulation_type']['manipulation']['new_adapter'])) }").decode()) 87 new_read = new_read.change_adapter(binascii.unhexlify(${ binascii.hexlify(str(manipulate_block['manipulation_type']['manipulation']['new_adapter']).encode()) }).decode())
87 #end if 88 #end if
88 #elif $manipulate_block['manipulation_type']['manipulation_type_selector'] == 'quality': 89 #elif $manipulate_block['manipulation_type']['manipulation_type_selector'] == 'quality':
89 #if $manipulate_block['manipulation_type']['manipulation']['manipulation_selector'] == 'translate': 90 #if $manipulate_block['manipulation_type']['manipulation']['manipulation_selector'] == 'translate':
90 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())) 91 new_read.quality = new_read.quality.translate(maketrans(binascii.unhexlify(${ binascii.hexlify(str(manipulate_block['manipulation_type']['manipulation']['from'])).encode() }).decode(), binascii.unhexlify(${ binascii.hexlify(str(manipulate_block['manipulation_type']['manipulation']['to']).encode()) }).decode()))
91 #elif $manipulate_block['manipulation_type']['manipulation']['manipulation_selector'] == 'map_score': 92 #elif $manipulate_block['manipulation_type']['manipulation']['manipulation_selector'] == 'map_score':
92 def score_method(score): 93 def score_method(score):
93 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 94 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
94 new_read.quality_map(score_method) 95 new_read.quality_map(score_method)
95 #end if 96 #end if