comparison poppunk_cluster.xml @ 0:d3c2de4d003a draft

Uploaded
author johnlees
date Wed, 15 May 2019 14:44:11 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:d3c2de4d003a
1 <tool id="poppunk_cluster" name="PopPUNK (cluster)" version="1.1.6">
2 <description>Cluster bacterial genomes</description>
3
4 <requirements>
5 <requirement type="package" version="1.1.6">poppunk</requirement>
6 </requirements>
7
8 <version_command><![CDATA[
9 poppunk --version
10 ]]></version_command>
11
12 <command detect_errors="exit_code"><![CDATA[
13 ##Set up input files
14 ##echo "$input_assemblies" | tr ',' '\n' > r_files.txt
15 #for $input in $input_assemblies
16 ln -s $input $input.element_identifier && echo $input.element_identifier >> r_files.txt;
17 #end for
18
19 ## command line 1 (create db)
20 echo "
21 poppunk
22 --create-db
23 --r-files r_files.txt
24 --output poppunk_db
25 --threads \${GALAXY_SLOTS:-1}
26 --min-k $min_k
27 --max-k $max_k
28 --k-step $k_step
29 --sketch-size $sketch_size
30 --max-a-dist $max_a_dist
31 #if $ignore_length
32 --ignore_length
33 #end if
34 --no-stream
35 " > poppunk_1.sh
36
37 && sh poppunk_1.sh
38
39 ## command line 2 (fit model)
40 && echo "
41 poppunk
42 --fit-model
43 --distances poppunk_db/poppunk_db.dists
44 --ref-db poppunk_db
45 --output poppunk_db
46
47 ## mode
48 #if str( $model.model_mode ) == "gmm":
49 --K ${model.K}
50 #end if
51 #if str( $model.model_mode ) == "dbscan":
52 --dbscan
53 --D $model.D
54 --min-cluster-prop $model.min_cluster_prop
55 #end if
56
57 #if not $no_full_db or $refine.refine_model
58 --full-db
59 #end if
60
61 #if not $refine.refine_model:
62 #if $external_clusters
63 --external-clustering $external_clusters
64 #end if
65
66 ## viz
67 #if $cytoscape:
68 --cytoscape
69 #end if
70 #if $viz.microreact:
71 --microreact
72 --rapidnj rapidnj
73 --perplexity $viz.perplexity
74 #end if
75 #if ($cytoscape or $viz.microreact) and $info_csv:
76 --info-csv $info_csv
77 #end if
78 #end if
79
80 " > poppunk_2.sh
81
82 && sh poppunk_2.sh
83
84 ## command line 3 (refine)
85 #if $refine.refine_model:
86 && echo "
87 poppunk
88 --refine-model
89 --distances poppunk_db/poppunk_db.dists
90 --ref-db poppunk_db
91 --output poppunk_db
92 --threads \${GALAXY_SLOTS:-1}
93 --pos-shift $refine.pos_shift
94 --neg-shift $refine.neg_shift
95
96 #if not $no_full_db
97 --full-db
98 #end if
99
100 #if $external_clusters
101 --external-clustering $external_clusters
102 #end if
103
104 ## viz
105 #if $cytoscape:
106 --cytoscape
107 #end if
108 #if $viz.microreact:
109 --microreact
110 --rapidnj rapidnj
111 --perplexity $viz.perplexity
112 #end if
113 #if ($cytoscape or $viz.microreact) and $info_csv:
114 --info-csv $info_csv
115 #end if
116
117 " > poppunk_3.sh
118
119 && sh poppunk_3.sh;
120 #end if
121
122 ]]></command>
123
124 <inputs>
125
126 <!-- input files -->
127 <param name="input_assemblies" type="data" format="fasta" multiple="true" label="FASTA datasets (assemblies)">
128 </param>
129
130 <!-- model type -->
131 <conditional name="model">
132 <param name="model_mode" type="select" label="Choose a model to use" help="See documentation or description below for advice, if default does not work." display="radio">
133 <option value="gmm" selected="true">GMM</option>
134 <option value="dbscan">DBSCAN</option>
135 </param>
136 <!-- model options -->
137 <when value="gmm">
138 <param name="K" type="integer" value="3" min="2" max="10" label="Number of mixture components">
139 </param>
140 </when>
141 <when value="dbscan">
142 <param name="D" type="integer" value="100" min="2" max="500" label="Maximum number of spatial clusters">
143 </param>
144 <param name="min_cluster_prop" type="float" value="0.0001" min="0.00001" max="0.1" label="Minimum proportion of points in a cluster">
145 </param>
146 </when>
147 </conditional>
148
149 <!-- refine model options -->
150 <conditional name="refine">
151 <param name="refine_model" type="boolean" checked="false" label="Run model refinement after model fit">
152 </param>
153 <when value="true">
154 <param name="pos_shift" type="float" value="0.2" min="0.0" max="1.0" label="Maximum amount to move the boundary away from origin">
155 </param>
156 <param name="neg_shift" type="float" value="0.4" min="0.0" max="1.0" label="Minimum amount to move the boundary away from origin">
157 </param>
158 </when>
159 <when value='false' />
160 </conditional>
161
162 <!-- further analysis options -->
163 <conditional name="viz">
164 <param name="microreact" type="boolean" checked="true" label="Make visualisations for microreact (recommended)">
165 </param>
166 <when value="true">
167 <param name="perplexity" type="float" value="20.0" min="5.0" max="100.0" label="Perplexity parameter for accessory plot t-SNE">
168 </param>
169 </when>
170 <when value='false' />
171 </conditional>
172 <param name="cytoscape" type="boolean" checked="false" label="Make visualisations for cytoscape">
173 </param>
174
175 <!-- output options -->
176 <param name="no_full_db" type="boolean" checked="true" label="Select representative references">
177 </param>
178
179 <param name="external_clusters" type="data" format="csv" optional="true" label="External cluster labels to add (e.g. MLST/serotype)">
180 </param>
181 <param name="info_csv" type="data" format="csv" optional="true" label="Epidemiological information CSV formatted for microreact">
182 </param>
183
184 <!-- kmer comparison options -->
185 <param name="min_k" type="integer" value="13" min="7" max="31" label="Minimum k-mer length">
186 </param>
187 <param name="max_k" type="integer" value="29" min="7" max="31" label="Maximum k-mer length">
188 </param>
189 <param name="k_step" type="integer" value="3" min="2" max="5" label="Step size between k-mer lengths">
190 </param>
191 <param name="sketch_size" type="integer" value="10000" min="1000" max="2000000" label="Sketch size">
192 </param>
193
194 <!-- quality control options -->
195 <param name="max_a_dist" type="float" value="0.5" min="0.0" max="1.0" label="Maximum accessory distance to permit">
196 </param>
197 <param name="ignore_length" type="boolean" checked="false" label="Ignore assembly length outliers">
198 </param>
199
200 </inputs>
201
202 <outputs>
203 <data name="clusters" format="csv" from_work_dir="poppunk_db/poppunk_db_clusters.csv" label="${tool.name} on ${on_string} (cluster assignment)" />
204 <data name="distances" format="png" from_work_dir="poppunk_db/poppunk_db_distanceDistribution.png" label="${tool.name} on ${on_string} (distance plot)" />
205 <data name="references" format="txt" from_work_dir="poppunk_db/poppunk_db.refs" label="${tool.name} on ${on_string} (selected references)">
206 <filter>no_full_db == True</filter>
207 </data>
208 <data name="gmm_plot" format="png" from_work_dir="poppunk_db/poppunk_db_DPGMM_fit.png" label="${tool.name} on ${on_string} (GMM cluster plot)">
209 <filter>model['model_mode'] == 'gmm'</filter>
210 </data>
211 <data name="gmm_contours" format="pdf" from_work_dir="poppunk_db/poppunk_db_DPGMM_fit_contours.pdf" label="${tool.name} on ${on_string} (GMM contour plot)">
212 <filter>model['model_mode'] == 'gmm'</filter>
213 </data>
214 <data name="dbscan_plot" format="png" from_work_dir="poppunk_db/poppunk_db_dbscan.png" label="${tool.name} on ${on_string} (DBSCAN cluster plot)">
215 <filter>model['model_mode'] == 'dbscan'</filter>
216 </data>
217 <data name="refine_plot" format="png" from_work_dir="poppunk_db/poppunk_db_refined_fit.png" label="${tool.name} on ${on_string} (refine model plot)">
218 <filter>refine['refine_model'] == True</filter>
219 </data>
220 <data name="cytoscape_network" format="data" from_work_dir="poppunk_db/poppunk_db_cytoscape.graphml" label="${tool.name} on ${on_string} (cytoscape network)">
221 <filter>cytoscape == True</filter>
222 </data>
223 <data name="cytoscape_clusters" format="csv" from_work_dir="poppunk_db/poppunk_db_cytoscape.csv" label="${tool.name} on ${on_string} (cytoscape csv)">
224 <filter>cytoscape == True</filter>
225 </data>
226 <data name="microreact_clusters" format="csv" from_work_dir="poppunk_db/poppunk_db_microreact_clusters.csv" label="${tool.name} on ${on_string} (microreact csv)">
227 <filter>viz['microreact'] == True</filter>
228 </data>
229 <data name="microreact_tree" format="newick" from_work_dir="poppunk_db/poppunk_db_core_NJ.nwk" label="${tool.name} on ${on_string} (microreact tree)">
230 <filter>viz['microreact'] == True</filter>
231 </data>
232 <data name="microreact_dot" format="graph_dot" from_work_dir="poppunk_db/poppunk_db_perplexity${perplexity}_accessory_tsne.dot" label="${tool.name} on ${on_string} (microreact dot)">
233 <filter>viz['microreact'] == True</filter>
234 </data>
235 </outputs>
236
237 <tests>
238 <test>
239 <param name='input_assemblies' value='12673_8_24.contigs_velvet.fa,12673_8_34.contigs_velvet.fa,12673_8_43.contigs_velvet.fa,12754_4_71.contigs_velvet.fa,12754_4_77.contigs_velvet.fa' />
240 <param name='model_mode' value='gmm' />
241 <param name='K' value='4' />
242 <param name='microreact' value='false' />
243 <param name='no_full_db' value='false' />
244 <output name="clusters" ftype='csv' file="clusters.csv" />
245 <output name="distances" ftype='png' file="distances.png" />
246 <output name="references" file="refs.txt" />
247 <output name="gmm_plot" ftype='png' file="gmm_fit.png" />
248 <output name="gmm_contours" ftype='pdf' file="gmm_contours.pdf" />
249 </test>
250 </tests>
251
252 <help><![CDATA[
253 **What it does**
254
255 PopPUNK will calculate core and accessory distance between input assemblies using variable length k-mers. A model will be fitted to all of these distances to determine genetic clusters for all inpits.
256
257 ------
258
259 **Description**
260
261 The most important thing to check is that in the output plot the component (blob) closest to the origin has been correctly identified - this should be checked in the cluster/model plot output. If it has not, you may wish to try another model. Some broad advice:
262
263 * DBSCAN is a good default, but may lead to unclassified points (black). If there are a large number of these consider another model.
264 * GMM will work well with well-separated components and an appropriate choice of K (consider increasing it based on the number of components that can be seen).
265 * The refine mode should be added in recombining species, which can be seen from the output plots if the coloured components are overlapping, or if there is a blur of points rather than discrete blobs of points..
266 ]]></help>
267
268 <citations>
269 <citation type='bibtex'>
270 @article{Lees01022019,
271 author = {Lees, John A. and Harris, Simon R. and Tonkin-Hill, Gerry and Gladstone, Rebecca A. and Lo, Stephanie W. and Weiser, Jeffrey N. and Corander, Jukka and Bentley, Stephen D. and Croucher, Nicholas J.},
272 title = {Fast and flexible bacterial genomic epidemiology with PopPUNK},
273 volume = {29},
274 number = {2},
275 pages = {304-316},
276 year = {2019},
277 doi = {10.1101/gr.241455.118},
278 abstract ={The routine use of genomics for disease surveillance provides the opportunity for high-resolution bacterial epidemiology. Current whole-genome clustering and multilocus typing approaches do not fully exploit core and accessory genomic variation, and they cannot both automatically identify, and subsequently expand, clusters of significantly similar isolates in large data sets spanning entire species. Here, we describe PopPUNK (Population Partitioning Using Nucleotide K-mers), a software implementing scalable and expandable annotation- and alignment-free methods for population analysis and clustering. Variable-length k-mer comparisons are used to distinguish isolates’ divergence in shared sequence and gene content, which we demonstrate to be accurate over multiple orders of magnitude using data from both simulations and genomic collections representing 10 taxonomically widespread species. Connections between closely related isolates of the same strain are robustly identified, despite interspecies variation in the pairwise distance distributions that reflects species’ diverse evolutionary patterns. PopPUNK can process 103–104 genomes in a single batch, with minimal memory use and runtimes up to 200-fold faster than existing model-based methods. Clusters of strains remain consistent as new batches of genomes are added, which is achieved without needing to reanalyze all genomes de novo. This facilitates real-time surveillance with consistent cluster naming between studies and allows for outbreak detection using hundreds of genomes in minutes. Interactive visualization and online publication is streamlined through the automatic output of results to multiple platforms. PopPUNK has been designed as a flexible platform that addresses important issues with currently used whole-genome clustering and typing methods, and has potential uses across bacterial genetics and public health research.},
279 URL = {http://genome.cshlp.org/content/29/2/304.abstract},
280 eprint = {http://genome.cshlp.org/content/29/2/304.full.pdf+html},
281 journal = {Genome Research}
282 }</citation>
283 </citations>
284 </tool>