Mercurial > repos > greg > vsnp_sample_names
comparison vsnp_sample_names.xml @ 8:4f43f163c408 draft
"planemo upload for repository https://github.com/gregvonkuster/galaxy_tools/tree/master/tools/sequence_analysis/vsnp/vsnp_sample_names commit 9f80907d5bebf572ecd34e1171751c9091cb8697"
author | greg |
---|---|
date | Mon, 13 Sep 2021 19:35:10 +0000 |
parents | e1cb13d6a82c |
children |
comparison
equal
deleted
inserted
replaced
7:e1cb13d6a82c | 8:4f43f163c408 |
---|---|
3 <macros> | 3 <macros> |
4 <import>macros.xml</import> | 4 <import>macros.xml</import> |
5 </macros> | 5 </macros> |
6 <command detect_errors="exit_code"><![CDATA[ | 6 <command detect_errors="exit_code"><![CDATA[ |
7 #import difflib | 7 #import difflib |
8 #import os | |
9 #import re | 8 #import re |
10 | 9 |
11 #if $input_type_cond.input_type == 'single': | 10 #if $input_type_cond.input_type == 'single': |
12 #set read1 = $input_type_cond.read1 | 11 #set read1 = $input_type_cond.read1 |
13 #set sample_name = re.sub('[^\s\w\-\\.]', '_', str($read1.element_identifier)) | 12 #set sample_name = re.sub('[^\s\w\-]', '_', str($read1.element_identifier)) |
14 #else if $input_type_cond.input_type == 'pair': | 13 #else if $input_type_cond.input_type == 'pair': |
15 #set read1 = $input_type_cond.read1 | 14 #set read1 = $input_type_cond.read1 |
16 #set read1_identifier = re.sub('[^\s\w\-]', '_', str($read1.element_identifier)) | 15 #set read1_identifier = re.sub('[^\s\w\-]', '_', str($read1.element_identifier)) |
17 #set read2 = $input_type_cond.read2 | 16 #set read2 = $input_type_cond.read2 |
18 #set read2_identifier = re.sub('[^\s\w\-]', '_', str($read2.element_identifier)) | 17 #set read2_identifier = re.sub('[^\s\w\-]', '_', str($read2.element_identifier)) |
19 #set matches = difflib.SequenceMatcher(None, read1_identifier, read2_identifier).get_matching_blocks() | 18 #set matches = difflib.SequenceMatcher(None, read1_identifier, read2_identifier).get_matching_blocks() |
20 #set match = $matches[0] | 19 #set match = $matches[0] |
21 #set sample_name = re.sub('[^\s\w\-]', '_', str($read1_identifier[match.a:match.a + match.size])) | 20 #set sample_name = re.sub('[^\s\w\-]', '_', str($read1_identifier[match.a:match.a + match.size])) |
22 #else: | 21 #else: |
23 #set read1 = $input_type_cond.reads_collection['forward'] | 22 #set read1_name = $input_type_cond.reads_collection['forward'].name |
24 #set read1_filename = $read1.name | 23 #set read1_identifier = re.sub('[^\s\w\-]', '_', str($read1_name)) |
25 #set sample_name = re.sub('[^\s\w\-]', '_', str($read1_filename)) | 24 #set read2_name = $input_type_cond.reads_collection['reverse'].name |
26 #end if | 25 #set read2_identifier = re.sub('[^\s\w\-]', '_', str($read2_name)) |
27 | 26 #set matches = difflib.SequenceMatcher(None, read1_identifier, read2_identifier).get_matching_blocks() |
28 #if $sample_name.find('_R1') >0: | 27 #set match = $matches[0] |
29 ## Something like CMC_20E1_R1.fastq.gz | 28 #set sample_name = re.sub('[^\s\w\-]', '_', str($read1_identifier[match.a:match.a + match.size])) |
30 #set sample_name = $sample_name.split('_R1')[0] | |
31 #else if $sample_name.find(".") > 0: | |
32 #if $read1.is_of_type('fastqsanger.gz') and $sample_name.endswith('gz'): | |
33 ## Something like my_sample.fastq.gz | |
34 #set sample_name = '.'.join($sample_name.split('.')[0:-2]) | |
35 #else: | |
36 ## Something like my_sample.fastq | |
37 #set sample_name = $os.path.splitext($sample_name)[0] | |
38 #end if | |
39 #else if $sample_name.find("_") > 0: | |
40 #if $read1.is_of_type('fastqsanger.gz') and $sample_name.endswith('gz'): | |
41 ## Something like my_sample_fastq_gz | |
42 #set sample_name = '_'.join($sample_name.split('_')[0:-2]) | |
43 #else: | |
44 ## Something like my_sample_fastq | |
45 #set sample_name = "_".join($sample_name.split("_")[0:-1]) | |
46 #end if | |
47 #end if | 29 #end if |
48 | 30 |
49 echo '$sample_name' > '$output' | 31 echo '$sample_name' > '$output' |
50 ]]></command> | 32 ]]></command> |
51 <inputs> | 33 <inputs> |
80 <!-- Paired reads in separate datasets --> | 62 <!-- Paired reads in separate datasets --> |
81 <test> | 63 <test> |
82 <param name="input_type" value="pair"/> | 64 <param name="input_type" value="pair"/> |
83 <param name="read1" value="CMC_20E1_R1.fastq.gz" dbkey="89"/> | 65 <param name="read1" value="CMC_20E1_R1.fastq.gz" dbkey="89"/> |
84 <param name="read2" value="CMC_20E1_R2.fastq.gz" dbkey="89"/> | 66 <param name="read2" value="CMC_20E1_R2.fastq.gz" dbkey="89"/> |
85 <output name="output" file="sample_names.txt" ftype="txt"/> | 67 <output name="output" file="sample_names2.txt" ftype="txt"/> |
86 </test> | 68 </test> |
87 <!-- Collection of Paired reads --> | 69 <!-- Collection of Paired reads --> |
88 <test> | 70 <test> |
89 <param name="input_type" value="paired"/> | 71 <param name="input_type" value="paired"/> |
90 <param name="reads_collection"> | 72 <param name="reads_collection"> |
91 <collection type="paired"> | 73 <collection type="paired"> |
92 <element name="forward" value="CMC_20E1_R1.fastq.gz"/> | 74 <element name="forward" value="CMC_20E1_R1.fastq.gz"/> |
93 <element name="reverse" value="CMC_20E1_R2.fastq.gz"/> | 75 <element name="reverse" value="CMC_20E1_R2.fastq.gz"/> |
94 </collection> | 76 </collection> |
95 </param> | 77 </param> |
96 <output name="output" file="sample_names.txt" ftype="txt"/> | 78 <output name="output" file="sample_names3.txt" ftype="txt"/> |
97 </test> | 79 </test> |
98 <!-- Collection of Paired reads --> | 80 <!-- Collection of Paired reads --> |
99 <test> | 81 <test> |
100 <param name="input_type" value="paired"/> | 82 <param name="input_type" value="paired"/> |
101 <param name="reads_collection"> | 83 <param name="reads_collection"> |
102 <collection type="paired"> | 84 <collection type="paired"> |
103 <element name="forward" value="SRR14085881_forward"/> | 85 <element name="forward" value="SRR14085881_forward"/> |
104 <element name="reverse" value="SRR14085881_reverse"/> | 86 <element name="reverse" value="SRR14085881_reverse"/> |
105 </collection> | 87 </collection> |
106 </param> | 88 </param> |
107 <output name="output" file="sample_names2.txt" ftype="txt"/> | 89 <output name="output" file="sample_names4.txt" ftype="txt"/> |
108 </test> | 90 </test> |
109 </tests> | 91 </tests> |
110 <help> | 92 <help> |
111 **What it does** | 93 **What it does** |
112 | 94 |