comparison qiime2/qiime_tools_import.xml @ 0:370e0b6e9826 draft

Uploaded
author florianbegusch
date Wed, 17 Jul 2019 03:05:17 -0400
parents
children 914fa4daf16a
comparison
equal deleted inserted replaced
-1:000000000000 0:370e0b6e9826
1 <?xml version="1.0" ?>
2 <tool id="qiime_tools_import" name="qiime tools import" version="2019.4">
3 <description> - Import data into a new QIIME 2 Artifact.</description>
4 <requirements>
5 <requirement type="package" version="2019.4">qiime2</requirement>
6 </requirements>
7 <command>
8 <![CDATA[
9 mkdir input;
10
11 #set $in_= 'input'
12
13
14 #if '__ob__' in str($semantic_type):
15 #set $type_temp = str($semantic_type).replace('__ob__', '[')
16 #set $type_temp = str($type_temp).replace('__cb__', ']')
17 #set $semantic_type = $type_temp
18 #end if
19
20 #def is_fastq($f_test)
21 #set $f = open($f_test, 'rb')
22 #if str($f.readline()[0]) == '@'
23 #$f.close()
24 #return True
25 #end if
26
27 #$f.close()
28 #return False
29 #end def
30
31
32 ## Symlinks creation or On the fly creation of a combo file
33 #if $input_type.type == 'list_list'
34 ## Symlinks creation or On the fly creation of a combo file
35 #for $f in $input_type.list_list:
36
37 #set $is_fastq_file = $is_fastq(str($f))
38
39 #if $is_fastq_file:
40 #set $file_for_processing = "'input/" + $f.name + '.gz' + "'"
41 gzip -c ${f} > $file_for_processing;
42 #else
43 #set $file_for_processing = "'input/" + $f.name + "'"
44 ln -s ${f} $file_for_processing;
45 #end if
46 #end for
47 #if 'SingleEndFastqManifestPhred' in str($sourceformat):
48 #set $cwd = str($outputpath.extra_files_path) + "_manifest_file.txt"
49 #set $m_file = open(str($cwd), 'w')
50 $m_file.write("sample-id,absolute-filepath,direction\n")
51 #for $f in $input_type.list_list:
52 $m_file.write(str($f.name).split("_")[0]+",$PWD/input/"+str($f.name)+".gz,forward\n")
53 #end for
54 $m_file.close()
55 #set $in_= str($cwd)
56 #end if
57
58
59 #elif $input_type.type == 'list_paired_collection':
60
61 #set $cwd = str($outputpath.extra_files_path) + "_manifest_file.txt"
62 #set $m_file = open(str($cwd), 'w')
63 $m_file.write("sample-id,absolute-filepath,direction\n")
64
65 #for $pair in $input_type.list_paired_collection:
66 #set $forward_is_fastq_file = $is_fastq(str($pair.forward))
67 #set $reverse_is_fastq_file = $is_fastq(str($pair.reverse))
68
69 #if $forward_is_fastq_file:
70 gzip -c ${pair.forward} > input/${pair.name}_R1_001.fastq.gz;
71 $m_file.write(str($pair.name).split("_")[0]+",$PWD/input/"+str($pair.name)+"_R1_001.fastq.gz,forward\n")
72 #else
73 ln -s ${pair.forward} input/${pair.name}_R1_001.fastq.gz;
74 $m_file.write(str($pair.name).split("_")[0]+",$PWD/input/"+str($pair.name)+"_R1_001.fastq.gz,forward\n")
75 #end if
76
77 #if $reverse_is_fastq_file:
78 gzip -c ${pair.reverse} > input/${pair.name}_R2_001.fastq.gz;
79 $m_file.write(str($pair.name).split("_")[0]+",$PWD/input/"+str($pair.name)+"_R2_001.fastq.gz,reverse\n")
80 #else
81 ln -s ${pair.reverse} input/${pair.name}_R2_001.fastq.gz;
82 $m_file.write(str($pair.name).split("_")[0]+",$PWD/input/"+str($pair.name)+"_R2_001.fastq.gz,reverse\n")
83 #end if
84 #end for
85
86
87 $m_file.close()
88 #if 'PairedEndFastqManifestPhred' in str($sourceformat):
89 #set $in_= str($cwd)
90 #elif 'Casava' in str($sourceformat):
91 #set $in_= 'input'
92 #end if
93
94 #else
95 #set $res = $is_fastq(str($file))
96
97 #if $res
98 gzip -c ${file} > ${file.name}.gz;
99 #set $in_= $file.name + '.gz'
100
101 #else
102 #set $in_= str($file)
103 #end if
104
105 #if "MultiplexedSingleEndBarcodeInSequence" in str($semantic_type):
106 mv *_R1_* forward.fastq.gz;
107 #set $in_= 'forward.fastq.gz';
108 #end if
109
110 #end if
111
112
113 ## rename files to predefined names for "MultiplexedPairedEndBarcodeInSequence"
114 #if "MultiplexedPairedEndBarcodeInSequence" in str($semantic_type):
115 mv input/*_R1_* input/forward.fastq.gz;
116 mv input/*_R2_* input/reverse.fastq.gz;
117 #end if
118
119
120 qiime tools import
121
122 --type="$semantic_type"
123
124 --input-path=$in_
125
126 --output-path=outputpath.qza
127
128 #if str($sourceformat) != 'None':
129 #if '__ob__' in str($sourceformat):
130 #set $sourceformat_temp = str($sourceformat).replace('__ob__', '[')
131 #set $sourceformat_temp = str($sourceformat_temp).replace('__cb__', ']')
132 #set $sourceformat = $sourceformat_temp
133 #end if
134 --source-format="$sourceformat"
135 #end if
136 ;
137 cp outputpath.qza $outputpath
138 ]]>
139 </command>
140 <inputs>
141 <conditional name="input_type">
142 <param name="type" type="select" label="Select a way to provide data, either using a file or a list" help="">
143 <option value="regular">Input file</option>
144 <option selected="true" value="list_paired_collection">Multiple pairs - Combo mode (list:paired collection)</option>
145 <option value="list_list">Input list</option>
146 </param>
147
148 <when value="regular">
149 <param name="file" type="data" multiple="false" label="Input file" />
150 </when>
151 <when value="list_paired_collection">
152 <param name="list_paired_collection" type="data_collection" collection_type="list:paired" label="Fastq pairs (collection)" help="Dataset collection made from multiple pairs of files" />
153 </when>
154 <when value="list_list">
155 <param name="list_list" type="data_collection" collection_type="list" label="Input list" />
156 </when>
157 </conditional>
158
159 <param label="--type: The semantic type of the artifact that will be created upon importing. [required]" name="semantic_type" optional="False" type="select">
160 <option value="DeblurStats">DeblurStats</option>
161 <option value="DistanceMatrix">DistanceMatrix</option>
162 <option value="EMPPairedEndSequences">EMPPairedEndSequences</option>
163 <option value="EMPSingleEndSequences">EMPSingleEndSequences</option>
164 <option value="FeatureData[AlignedSequence]">FeatureData[AlignedSequence]</option>
165 <option value="FeatureData[PairedEndSequence]">FeatureData[PairedEndSequence]</option>
166 <option value="FeatureData[Sequence]">FeatureData[Sequence]</option>
167 <option value="FeatureData[Taxonomy]">FeatureData[Taxonomy]</option>
168 <option value="FeatureTable[Balance]">FeatureTable[Balance]</option>
169 <option value="FeatureTable[Composition]">FeatureTable[Composition]</option>
170 <option value="FeatureTable[Frequency]">FeatureTable[Frequency]</option>
171 <option value="FeatureTable[PresenceAbsence]">FeatureTable[PresenceAbsence]</option>
172 <option value="FeatureTable[RelativeFrequency]">FeatureTable[RelativeFrequency]</option>
173 <option value="Hierarchy">Hierarchy</option>
174 <option value="MultiplexedPairedEndBarcodeInSequence">MultiplexedPairedEndBarcodeInSequence</option>
175 <option value="MultiplexedSingleEndBarcodeInSequence">MultiplexedSingleEndBarcodeInSequence</option>
176 <option value="PCoAResults">PCoAResults</option>
177 <option value="Phylogeny[Rooted]">Phylogeny[Rooted]</option>
178 <option value="Phylogeny[Unrooted]">Phylogeny[Unrooted]</option>
179 <option value="QualityFilterStats">QualityFilterStats</option>
180 <option value="RawSequences">RawSequences</option>
181 <option value="SampleData[AlphaDiversity]">SampleData[AlphaDiversity]</option>
182 <option value="SampleData[BooleanSeries]">SampleData[BooleanSeries]</option>
183 <option value="SampleData[DADA2Stats]">SampleData[DADA2Stats]</option>
184 <option value="SampleData[FirstDifferences]">SampleData[FirstDifferences]</option>
185 <option value="SampleData[JoinedSequencesWithQuality]">SampleData[JoinedSequencesWithQuality]</option>
186 <option selected="True" value="SampleData[PairedEndSequencesWithQuality]">SampleData[PairedEndSequencesWithQuality]</option>
187 <option value="SampleData[SequencesWithQuality]">SampleData[SequencesWithQuality]</option>
188 <option value="SampleData[Sequences]">SampleData[Sequences]</option>
189 <option value="TaxonomicClassifier">TaxonomicClassifier</option>
190 <option value="UchimeStats">UchimeStats</option>
191 </param>
192
193 <param label="--source-format: The format of the data to be imported. If not provided, data must be in the format expected by the semantic type provided via --type." name="sourceformat" optional="True" type="select">
194 <option value="AlignedDNAFASTAFormat">AlignedDNAFASTAFormat</option>
195 <option value="AlignedDNASequencesDirectoryFormat">AlignedDNASequencesDirectoryFormat</option>
196 <option value="AlphaDiversityDirectoryFormat">AlphaDiversityDirectoryFormat</option>
197 <option value="AlphaDiversityFormat">AlphaDiversityFormat</option>
198 <option value="BIOMV100DirFmt">BIOMV100DirFmt</option>
199 <option value="BIOMV100Format">BIOMV100Format</option>
200 <option value="BIOMV210DirFmt">BIOMV210DirFmt</option>
201 <option value="BIOMV210Format">BIOMV210Format</option>
202 <option value="BooleanSeriesDirectoryFormat">BooleanSeriesDirectoryFormat</option>
203 <option value="BooleanSeriesFormat">BooleanSeriesFormat</option>
204 <option value="CasavaOneEightLanelessPerSampleDirFmt">CasavaOneEightLanelessPerSampleDirFmt</option>
205 <option value="CasavaOneEightSingleLanePerSampleDirFmt">CasavaOneEightSingleLanePerSampleDirFmt</option>
206 <option value="DADA2StatsDirFmt">DADA2StatsDirFmt</option>
207 <option value="DADA2StatsFormat">DADA2StatsFormat</option>
208 <option value="DNAFASTAFormat">DNAFASTAFormat</option>
209 <option value="DNASequencesDirectoryFormat">DNASequencesDirectoryFormat</option>
210 <option value="DeblurStatsDirFmt">DeblurStatsDirFmt</option>
211 <option value="DeblurStatsFmt">DeblurStatsFmt</option>
212 <option value="DistanceMatrixDirectoryFormat">DistanceMatrixDirectoryFormat</option>
213 <option value="EMPPairedEndCasavaDirFmt">EMPPairedEndCasavaDirFmt</option>
214 <option value="EMPPairedEndDirFmt">EMPPairedEndDirFmt</option>
215 <option value="EMPSingleEndCasavaDirFmt">EMPSingleEndCasavaDirFmt</option>
216 <option value="EMPSingleEndDirFmt">EMPSingleEndDirFmt</option>
217 <option value="FastqGzFormat">FastqGzFormat</option>
218 <option value="FirstDifferencesDirectoryFormat">FirstDifferencesDirectoryFormat</option>
219 <option value="FirstDifferencesFormat">FirstDifferencesFormat</option>
220 <option value="HeaderlessTSVTaxonomyDirectoryFormat">HeaderlessTSVTaxonomyDirectoryFormat</option>
221 <option value="HeaderlessTSVTaxonomyFormat">HeaderlessTSVTaxonomyFormat</option>
222 <option value="LSMatFormat">LSMatFormat</option>
223 <option value="MultiplexedPairedEndBarcodeInSequenceDirFmt">MultiplexedPairedEndBarcodeInSequenceDirFmt</option>
224 <option value="MultiplexedSingleEndBarcodeInSequenceDirFmt">MultiplexedSingleEndBarcodeInSequenceDirFmt</option>
225 <option value="NewickDirectoryFormat">NewickDirectoryFormat</option>
226 <option value="NewickFormat">NewickFormat</option>
227 <option value="OrdinationDirectoryFormat">OrdinationDirectoryFormat</option>
228 <option value="OrdinationFormat">OrdinationFormat</option>
229 <option value="PairedDNASequencesDirectoryFormat">PairedDNASequencesDirectoryFormat</option>
230 <option selected="True" value="PairedEndFastqManifestPhred33">PairedEndFastqManifestPhred33</option>
231 <option value="PairedEndFastqManifestPhred64">PairedEndFastqManifestPhred64</option>
232 <option value="QIIME1DemuxDirFmt">QIIME1DemuxDirFmt</option>
233 <option value="QIIME1DemuxFormat">QIIME1DemuxFormat</option>
234 <option value="QualityFilterStatsDirFmt">QualityFilterStatsDirFmt</option>
235 <option value="QualityFilterStatsFmt">QualityFilterStatsFmt</option>
236 <option value="SingleEndFastqManifestPhred33">SingleEndFastqManifestPhred33</option>
237 <option value="SingleEndFastqManifestPhred64">SingleEndFastqManifestPhred64</option>
238 <option value="SingleLanePerSamplePairedEndFastqDirFmt">SingleLanePerSamplePairedEndFastqDirFmt</option>
239 <option value="SingleLanePerSampleSingleEndFastqDirFmt">SingleLanePerSampleSingleEndFastqDirFmt</option>
240 <option value="TSVTaxonomyDirectoryFormat">TSVTaxonomyDirectoryFormat</option>
241 <option value="TSVTaxonomyFormat">TSVTaxonomyFormat</option>
242 <option value="TaxonomicClassiferTemporaryPickleDirFmt">TaxonomicClassiferTemporaryPickleDirFmt</option>
243 <option value="UchimeStatsDirFmt">UchimeStatsDirFmt</option>
244 <option value="UchimeStatsFmt">UchimeStatsFmt</option>
245 </param>
246 </inputs>
247 <outputs>
248 <data format="qza" label="${tool.name} on ${on_string}: outputpath.qza" name="outputpath"/>
249 </outputs>
250 <stdio>
251 <exit_code range="2" level="warning" description="Error" />
252 </stdio>
253 <help>
254 </help>
255 <macros>
256 <import>qiime_citation.xml</import>
257 </macros>
258 <expand macro="qiime_citation" />
259 </tool>