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