0
|
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
|
4
|
47 #if 'SingleEndFastqManifestPhred' in str($inputformat):
|
0
|
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()
|
4
|
88 #if 'PairedEndFastqManifestPhred' in str($inputformat):
|
0
|
89 #set $in_= str($cwd)
|
4
|
90 #elif 'Casava' in str($inputformat):
|
0
|
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
|
4
|
122 --input-path=$in_
|
0
|
123
|
4
|
124 #if str($inputformat) != 'None':
|
|
125 #if '__ob__' in str($inputformat):
|
|
126 #set $inputformat_temp = str($inputformat).replace('__ob__', '[')
|
|
127 #set $inputformat_temp = str($inputformat_temp).replace('__cb__', ']')
|
|
128 #set $inputformat = $inputformat_temp
|
|
129 #end if
|
|
130 --input-format="$inputformat"
|
|
131 #end if
|
|
132
|
|
133 --type="$semantic_type"
|
0
|
134
|
|
135 --output-path=outputpath.qza
|
|
136
|
|
137 ;
|
|
138 cp outputpath.qza $outputpath
|
|
139 ]]>
|
|
140 </command>
|
|
141 <inputs>
|
|
142 <conditional name="input_type">
|
|
143 <param name="type" type="select" label="Select a way to provide data, either using a file or a list" help="">
|
|
144 <option value="regular">Input file</option>
|
|
145 <option selected="true" value="list_paired_collection">Multiple pairs - Combo mode (list:paired collection)</option>
|
|
146 <option value="list_list">Input list</option>
|
|
147 </param>
|
|
148
|
|
149 <when value="regular">
|
|
150 <param name="file" type="data" multiple="false" label="Input file" />
|
|
151 </when>
|
|
152 <when value="list_paired_collection">
|
|
153 <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" />
|
|
154 </when>
|
|
155 <when value="list_list">
|
|
156 <param name="list_list" type="data_collection" collection_type="list" label="Input list" />
|
|
157 </when>
|
|
158 </conditional>
|
|
159
|
|
160 <param label="--type: The semantic type of the artifact that will be created upon importing. [required]" name="semantic_type" optional="False" type="select">
|
|
161 <option value="DeblurStats">DeblurStats</option>
|
|
162 <option value="DistanceMatrix">DistanceMatrix</option>
|
|
163 <option value="EMPPairedEndSequences">EMPPairedEndSequences</option>
|
|
164 <option value="EMPSingleEndSequences">EMPSingleEndSequences</option>
|
4
|
165 <option value="ErrorCorrectionDetails">ErrorCorrectionDetails</option>
|
0
|
166 <option value="FeatureData[AlignedSequence]">FeatureData[AlignedSequence]</option>
|
4
|
167 <option value="FeatureData[Importance]">FeatureData[Importance]</option>
|
0
|
168 <option value="FeatureData[PairedEndSequence]">FeatureData[PairedEndSequence]</option>
|
|
169 <option value="FeatureData[Sequence]">FeatureData[Sequence]</option>
|
|
170 <option value="FeatureData[Taxonomy]">FeatureData[Taxonomy]</option>
|
|
171 <option value="FeatureTable[Balance]">FeatureTable[Balance]</option>
|
|
172 <option value="FeatureTable[Composition]">FeatureTable[Composition]</option>
|
|
173 <option value="FeatureTable[Frequency]">FeatureTable[Frequency]</option>
|
4
|
174 <option value="FeatureTable[PercentileNormalized]">FeatureTable[PercentileNormalized]</option>
|
0
|
175 <option value="FeatureTable[PresenceAbsence]">FeatureTable[PresenceAbsence]</option>
|
|
176 <option value="FeatureTable[RelativeFrequency]">FeatureTable[RelativeFrequency]</option>
|
|
177 <option value="Hierarchy">Hierarchy</option>
|
|
178 <option value="MultiplexedPairedEndBarcodeInSequence">MultiplexedPairedEndBarcodeInSequence</option>
|
|
179 <option value="MultiplexedSingleEndBarcodeInSequence">MultiplexedSingleEndBarcodeInSequence</option>
|
|
180 <option value="PCoAResults">PCoAResults</option>
|
|
181 <option value="Phylogeny[Rooted]">Phylogeny[Rooted]</option>
|
|
182 <option value="Phylogeny[Unrooted]">Phylogeny[Unrooted]</option>
|
4
|
183 <option value="Placements">Placements</option>
|
0
|
184 <option value="QualityFilterStats">QualityFilterStats</option>
|
|
185 <option value="RawSequences">RawSequences</option>
|
|
186 <option value="SampleData[AlphaDiversity]">SampleData[AlphaDiversity]</option>
|
|
187 <option value="SampleData[BooleanSeries]">SampleData[BooleanSeries]</option>
|
4
|
188 <option value="SampleData[ClassifierPredictions]">SampleData[ClassifierPredictions]</option>
|
0
|
189 <option value="SampleData[DADA2Stats]">SampleData[DADA2Stats]</option>
|
|
190 <option value="SampleData[FirstDifferences]">SampleData[FirstDifferences]</option>
|
|
191 <option value="SampleData[JoinedSequencesWithQuality]">SampleData[JoinedSequencesWithQuality]</option>
|
|
192 <option selected="True" value="SampleData[PairedEndSequencesWithQuality]">SampleData[PairedEndSequencesWithQuality]</option>
|
4
|
193 <option value="SampleData[RegressorPredictions]">SampleData[RegressorPredictions]</option>
|
0
|
194 <option value="SampleData[SequencesWithQuality]">SampleData[SequencesWithQuality]</option>
|
|
195 <option value="SampleData[Sequences]">SampleData[Sequences]</option>
|
4
|
196 <option value="SampleData[Classifier]">SampleData[Classifier]</option>
|
|
197 <option value="SampleData[Regressor]">SampleData[Regressor]</option>
|
0
|
198 <option value="TaxonomicClassifier">TaxonomicClassifier</option>
|
|
199 <option value="UchimeStats">UchimeStats</option>
|
|
200 </param>
|
|
201
|
4
|
202 <param label="--input-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="inputformat" optional="True" type="select">
|
0
|
203 <option value="AlignedDNAFASTAFormat">AlignedDNAFASTAFormat</option>
|
|
204 <option value="AlignedDNASequencesDirectoryFormat">AlignedDNASequencesDirectoryFormat</option>
|
|
205 <option value="AlphaDiversityDirectoryFormat">AlphaDiversityDirectoryFormat</option>
|
|
206 <option value="AlphaDiversityFormat">AlphaDiversityFormat</option>
|
|
207 <option value="BIOMV100DirFmt">BIOMV100DirFmt</option>
|
|
208 <option value="BIOMV100Format">BIOMV100Format</option>
|
|
209 <option value="BIOMV210DirFmt">BIOMV210DirFmt</option>
|
|
210 <option value="BIOMV210Format">BIOMV210Format</option>
|
|
211 <option value="BooleanSeriesDirectoryFormat">BooleanSeriesDirectoryFormat</option>
|
|
212 <option value="BooleanSeriesFormat">BooleanSeriesFormat</option>
|
|
213 <option value="CasavaOneEightLanelessPerSampleDirFmt">CasavaOneEightLanelessPerSampleDirFmt</option>
|
|
214 <option value="CasavaOneEightSingleLanePerSampleDirFmt">CasavaOneEightSingleLanePerSampleDirFmt</option>
|
|
215 <option value="DADA2StatsDirFmt">DADA2StatsDirFmt</option>
|
|
216 <option value="DADA2StatsFormat">DADA2StatsFormat</option>
|
|
217 <option value="DNAFASTAFormat">DNAFASTAFormat</option>
|
|
218 <option value="DNASequencesDirectoryFormat">DNASequencesDirectoryFormat</option>
|
|
219 <option value="DeblurStatsDirFmt">DeblurStatsDirFmt</option>
|
|
220 <option value="DeblurStatsFmt">DeblurStatsFmt</option>
|
|
221 <option value="DistanceMatrixDirectoryFormat">DistanceMatrixDirectoryFormat</option>
|
|
222 <option value="EMPPairedEndCasavaDirFmt">EMPPairedEndCasavaDirFmt</option>
|
|
223 <option value="EMPPairedEndDirFmt">EMPPairedEndDirFmt</option>
|
|
224 <option value="EMPSingleEndCasavaDirFmt">EMPSingleEndCasavaDirFmt</option>
|
|
225 <option value="EMPSingleEndDirFmt">EMPSingleEndDirFmt</option>
|
4
|
226 <option value="ErrorCorrectionDetailsDirFmt">ErrorCorrectionDetailsDirFmt</option>
|
0
|
227 <option value="FastqGzFormat">FastqGzFormat</option>
|
|
228 <option value="FirstDifferencesDirectoryFormat">FirstDifferencesDirectoryFormat</option>
|
|
229 <option value="FirstDifferencesFormat">FirstDifferencesFormat</option>
|
|
230 <option value="HeaderlessTSVTaxonomyDirectoryFormat">HeaderlessTSVTaxonomyDirectoryFormat</option>
|
|
231 <option value="HeaderlessTSVTaxonomyFormat">HeaderlessTSVTaxonomyFormat</option>
|
4
|
232 <option value="ImportanceDirectoryFormat">ImportanceDirectoryFormat</option>
|
|
233 <option value="ImportanceFormat">ImportanceFormat</option>
|
0
|
234 <option value="LSMatFormat">LSMatFormat</option>
|
|
235 <option value="MultiplexedPairedEndBarcodeInSequenceDirFmt">MultiplexedPairedEndBarcodeInSequenceDirFmt</option>
|
|
236 <option value="MultiplexedSingleEndBarcodeInSequenceDirFmt">MultiplexedSingleEndBarcodeInSequenceDirFmt</option>
|
|
237 <option value="NewickDirectoryFormat">NewickDirectoryFormat</option>
|
|
238 <option value="NewickFormat">NewickFormat</option>
|
|
239 <option value="OrdinationDirectoryFormat">OrdinationDirectoryFormat</option>
|
|
240 <option value="OrdinationFormat">OrdinationFormat</option>
|
|
241 <option value="PairedDNASequencesDirectoryFormat">PairedDNASequencesDirectoryFormat</option>
|
4
|
242 <option value="PairedEndFastqManifestPhred33">PairedEndFastqManifestPhred33</option>
|
|
243 <option value="PairedEndFastqManifestPhred33V2">PairedEndFastqManifestPhred33V2</option>
|
0
|
244 <option value="PairedEndFastqManifestPhred64">PairedEndFastqManifestPhred64</option>
|
4
|
245 <option value="PairedEndFastqManifestPhred64V2">PairedEndFastqManifestPhred64V2</option>
|
|
246 <option value="PlacementsDirFmt">PlacementsDirFmt</option>
|
|
247 <option value="PlacementsFormat">PlacementsFormat</option>
|
|
248 <option value="PredictionsDirectoryFormat">PredictionsDirectoryFormat</option>
|
|
249 <option value="PredictionsFormat">PredictionsFormat</option>
|
0
|
250 <option value="QIIME1DemuxDirFmt">QIIME1DemuxDirFmt</option>
|
|
251 <option value="QIIME1DemuxFormat">QIIME1DemuxFormat</option>
|
|
252 <option value="QualityFilterStatsDirFmt">QualityFilterStatsDirFmt</option>
|
|
253 <option value="QualityFilterStatsFmt">QualityFilterStatsFmt</option>
|
4
|
254 <option value="SampleEstimatorDirFmt">SampleEstimatorDirFmt</option>
|
0
|
255 <option value="SingleEndFastqManifestPhred33">SingleEndFastqManifestPhred33</option>
|
4
|
256 <option value="SingleEndFastqManifestPhred33V2">SingleEndFastqManifestPhred33V2</option>
|
0
|
257 <option value="SingleEndFastqManifestPhred64">SingleEndFastqManifestPhred64</option>
|
4
|
258 <option value="SingleEndFastqManifestPhred64V2">SingleEndFastqManifestPhred64V2</option>
|
0
|
259 <option value="SingleLanePerSamplePairedEndFastqDirFmt">SingleLanePerSamplePairedEndFastqDirFmt</option>
|
|
260 <option value="SingleLanePerSampleSingleEndFastqDirFmt">SingleLanePerSampleSingleEndFastqDirFmt</option>
|
|
261 <option value="TSVTaxonomyDirectoryFormat">TSVTaxonomyDirectoryFormat</option>
|
|
262 <option value="TSVTaxonomyFormat">TSVTaxonomyFormat</option>
|
|
263 <option value="TaxonomicClassiferTemporaryPickleDirFmt">TaxonomicClassiferTemporaryPickleDirFmt</option>
|
|
264 <option value="UchimeStatsDirFmt">UchimeStatsDirFmt</option>
|
|
265 <option value="UchimeStatsFmt">UchimeStatsFmt</option>
|
|
266 </param>
|
|
267 </inputs>
|
|
268 <outputs>
|
|
269 <data format="qza" label="${tool.name} on ${on_string}: outputpath.qza" name="outputpath"/>
|
|
270 </outputs>
|
|
271 <stdio>
|
|
272 <exit_code range="2" level="warning" description="Error" />
|
|
273 </stdio>
|
|
274 <help>
|
|
275 </help>
|
|
276 <macros>
|
|
277 <import>qiime_citation.xml</import>
|
|
278 </macros>
|
|
279 <expand macro="qiime_citation" />
|
|
280 </tool>
|