comparison 0.2.0/readme/cronology.md @ 11:a5f31c44f8c9

planemo upload
author kkonganti
date Mon, 15 Jul 2024 16:11:44 -0400
parents
children
comparison
equal deleted inserted replaced
10:ddf7a172bf30 11:a5f31c44f8c9
1 # cronology
2
3 `cronology` is an automated workflow for **_Cronobacter_** whole genome sequence assembly, subtyping and traceback based on [NCBI Pathogen Detection](https://www.ncbi.nlm.nih.gov/pathogens) Project for [Cronobacter](https://www.ncbi.nlm.nih.gov/pathogens/isolates/#taxgroup_name:%22Cronobacter%22). It uses `fastp` for read quality control, `shovill` and `polypolish` for **_de novo_** assembly and genome polishing, `prokka` for gene prediction and annotation, and `quast.py` for assembly quality metrics. User(s) can choose a gold standard reference genome as a model during gene prediction step with `prokka`. By default, `GCF_003516125` (**_Cronobacter sakazakii_**) is used.
4
5 In parallel, for each isolate, whole genome based (genome distances) traceback analysis is performed using `mash` and `mashtree` and the results are saved as a phylogenetic tree in `newick` format. Accompanying metadata generated can be uploaded to [iTOL](https://itol.embl.de/) for tree visualization.
6
7 User(s) can also run pangenome analysis using `pirate` but this will considerably increase the run time of the pipeline if the input has more than ~50 samples.
8
9 \
10  
11
12 <!-- TOC -->
13
14 - [Minimum Requirements](#minimum-requirements)
15 - [CFSAN GalaxyTrakr](#cfsan-galaxytrakr)
16 - [Usage and Examples](#usage-and-examples)
17 - [Database](#database)
18 - [Input](#input)
19 - [Output](#output)
20 - [Computational resources](#computational-resources)
21 - [Runtime profiles](#runtime-profiles)
22 - [your_institution.config](#your_institutionconfig)
23 - [Cloud computing](#cloud-computing)
24 - [Example data](#example-data)
25 - [cronology CLI Help](#cronology-cli-help)
26
27 <!-- /TOC -->
28
29 \
30 &nbsp;
31
32 ## Minimum Requirements
33
34 1. [Nextflow version 23.04.3](https://github.com/nextflow-io/nextflow/releases/download/v23.04.3/nextflow).
35 - Make the `nextflow` binary executable (`chmod 755 nextflow`) and also make sure that it is made available in your `$PATH`.
36 - If your existing `JAVA` install does not support the newest **Nextflow** version, you can try **Amazon**'s `JAVA` (OpenJDK): [Corretto](https://corretto.aws/downloads/latest/amazon-corretto-17-x64-linux-jdk.tar.gz).
37 2. Either of `micromamba` (version `1.0.0`) or `docker` or `singularity` installed and made available in your `$PATH`.
38 - Running the workflow via `micromamba` software provisioning is **preferred** as it does not require any `sudo` or `admin` privileges or any other configurations with respect to the various container providers.
39 - To install `micromamba` for your system type, please follow these [installation steps](https://mamba.readthedocs.io/en/latest/installation/micromamba-installation.html#linux-and-macos) and make sure that the `micromamba` binary is made available in your `$PATH`.
40 - Just the `curl` step is sufficient to download the binary as far as running the workflows are concerned.
41 - Once you have finished the installation, **it is important that you downgrade `micromamba` to version `1.0.0`**.
42
43 ```bash
44 micromamba self-update --version 1.0.0
45 ```
46
47 3. Minimum of 10 CPU cores and about 60 GBs for main workflow steps. More memory may be required if your **FASTQ** files are big.
48
49 \
50 &nbsp;
51
52 ## CFSAN GalaxyTrakr
53
54 The `cronology` pipeline is also available for use on the [Galaxy instance supported by CFSAN, FDA](https://galaxytrakr.org/). If you wish to run the analysis using **Galaxy**, please register for an account, after which you can run the workflow by selecting `cronology` under [`Metagenomics:CPIPES`](../assets/cronology_on_galaxytrakr.PNG) tool section.
55
56 Please note that the pipeline on [CFSAN GalaxyTrakr](https://galaxytrakr.org) in most cases may be a version older than the one on **GitHub** due to testing prioritization.
57
58 \
59 &nbsp;
60
61 ## Usage and Examples
62
63 Clone or download this repository and then call `cpipes`.
64
65 ```bash
66 cpipes --pipeline cronology [options]
67 ```
68
69 Alternatively, you can use `nextflow` to directly pull and run the pipeline.
70
71 ```bash
72 nextflow pull CFSAN-Biostatistics/cronology
73 nextflow list
74 nextflow info CFSAN-Biostatistics/cronology
75 nextflow run CFSAN-Biostatistics/cronology --pipeline cronology_db --help
76 nextflow run CFSAN-Biostatistics/cronology --pipeline cronology --help
77 ```
78
79 \
80 &nbsp;
81
82 **Example**: Run the default `cronology` pipeline in single-end mode.
83
84 ```bash
85 cd /data/scratch/$USER
86 mkdir nf-cpipes
87 cd nf-cpipes
88 cpipes
89 --pipeline cronology \
90 --input /path/to/illumina/fastq/dir \
91 --output /path/to/output \
92 --cronology_root_dbdir /data/Kranti_Konganti/cronology_db/PDG000000043.213 \
93 --fq_single_end true
94 ```
95
96 \
97 &nbsp;
98
99 **Example**: Run the `cronology` pipeline in paired-end mode.
100
101 ```bash
102 cd /data/scratch/$USER
103 mkdir nf-cpipes
104 cd nf-cpipes
105 cpipes \
106 --pipeline cronology \
107 --input /path/to/illumina/fastq/dir \
108 --output /path/to/output \
109 --cronology_root_dbdir /data/Kranti_Konganti/cronology_db/PDG000000043.213 \
110 --fq_single_end false
111 ```
112
113 \
114 &nbsp;
115
116 ### Database
117
118 ---
119
120 Although users can choose to run the `cronology_db` pipeline, it requires access to HPC Cluster or a similar cloud setting. Since `GUNC` and `CheckM2` tools are used to filter out low quality assemblies, which require its own databases, the runtime is longer than usual. Therefore, the pre-formatted databases will be provided for download.
121
122 - Download the `PDG000000043.213` version of **NCBI Pathogens release** for **_Cronobacter_**: <https://research.foodsafetyrisk.org/cronology/PDG000000043.213.tar.bz2>.
123
124 \
125 &nbsp;
126
127 ### Input
128
129 ---
130
131 The input to the workflow is a folder containing compressed (`.gz`) FASTQ files. Please note that the sample grouping happens automatically by the file name of the FASTQ file. If for example, a single sample is sequenced across multiple sequencing lanes, you can choose to group those FASTQ files into one sample by using the `--fq_filename_delim` and `--fq_filename_delim_idx` options. By default, `--fq_filename_delim` is set to `_` (underscore) and `--fq_filename_delim_idx` is set to 1.
132
133 For example, if the directory contains FASTQ files as shown below:
134
135 - KB-01_apple_L001_R1.fastq.gz
136 - KB-01_apple_L001_R2.fastq.gz
137 - KB-01_apple_L002_R1.fastq.gz
138 - KB-01_apple_L002_R2.fastq.gz
139 - KB-02_mango_L001_R1.fastq.gz
140 - KB-02_mango_L001_R2.fastq.gz
141 - KB-02_mango_L002_R1.fastq.gz
142 - KB-02_mango_L002_R2.fastq.gz
143
144 Then, to create 2 sample groups, `apple` and `mango`, we split the file name by the delimitor (underscore in the case, which is default) and group by the first 2 words (`--fq_filename_delim_idx 2`).
145
146 This goes without saying that all the FASTQ files should have uniform naming patterns so that `--fq_filename_delim` and `--fq_filename_delim_idx` options do not have any adverse effect in collecting and creating a sample metadata sheet.
147
148 \
149 &nbsp;
150
151 ### Output
152
153 ---
154
155 All the outputs for each step are stored inside the folder mentioned with the `--output` option. A `multiqc_report.html` file inside the `cronology-multiqc` folder can be opened in any browser on your local workstation which contains a consolidated brief report. The tree metadata which can be uploaded to [iTOL](https://itol.embl.de/) for visualization will be located in the `cat_unique` folder.
156
157 \
158 &nbsp;
159
160 ### Computational resources
161
162 ---
163
164 The workflow `cronology` requires at least a minimum of 60 GBs of memory to successfully finish the workflow. By default, `cronology` uses 10 CPU cores where possible. You can change this behavior and adjust the CPU cores with `--max_cpus` option.
165
166 \
167 &nbsp;
168
169 Example:
170
171 ```bash
172 cpipes \
173 --pipeline cronology \
174 --input /path/to/cronology_sim_reads \
175 --output /path/to/cronology_sim_reads_output \
176 --cronology_root_dbdir /path/to/PDG000000043.213
177 --max_cpus 5 \
178 -profile stdkondagac \
179 -resume
180 ```
181
182 \
183 &nbsp;
184
185 ### Runtime profiles
186
187 ---
188
189 You can use different run time profiles that suit your specific compute environments i.e., you can run the workflow locally on your machine or in a grid computing infrastructure.
190
191 \
192 &nbsp;
193
194 Example:
195
196 ```bash
197 cd /data/scratch/$USER
198 mkdir nf-cpipes
199 cd nf-cpipes
200 cpipes \
201 --pipeline cronology \
202 --input /path/to/fastq_pass_dir \
203 --output /path/to/where/output/should/go \
204 -profile your_institution
205 ```
206
207 The above command would run the pipeline and store the output at the location per the `--output` flag and the **NEXTFLOW** reports are always stored in the current working directory from where `cpipes` is run. For example, for the above command, a directory called `CPIPES-cronology` would hold all the **NEXTFLOW** related logs, reports and trace files.
208
209 \
210 &nbsp;
211
212 ### `your_institution.config`
213
214 ---
215
216 In the above example, we can see that we have mentioned the run time profile as `your_institution`. For this to work, add the following lines at the end of [`computeinfra.config`](../conf/computeinfra.config) file which should be located inside the `conf` folder. For example, if your institution uses **SGE** or **UNIVA** for grid computing instead of **SLURM** and has a job queue named `normal.q`, then add these lines:
217
218 \
219 &nbsp;
220
221 ```groovy
222 your_institution {
223 process.executor = 'sge'
224 process.queue = 'normal.q'
225 singularity.enabled = false
226 singularity.autoMounts = true
227 docker.enabled = false
228 params.enable_conda = true
229 conda.enabled = true
230 conda.useMicromamba = true
231 params.enable_module = false
232 }
233 ```
234
235 In the above example, by default, all the software provisioning choices are disabled except `conda`. You can also choose to remove the `process.queue` line altogether and the `cronology` workflow will request the appropriate memory and number of CPU cores automatically, which ranges from 1 CPU, 1 GB and 1 hour for job completion up to 10 CPU cores, 1 TB and 120 hours for job completion.
236
237 \
238 &nbsp;
239
240 ### Cloud computing
241
242 ---
243
244 You can run the workflow in the cloud (works only with proper set up of AWS resources). Add new run time profiles with required parameters per [Nextflow docs](https://www.nextflow.io/docs/latest/executor.html):
245
246 \
247 &nbsp;
248
249 Example:
250
251 ```groovy
252 my_aws_batch {
253 executor = 'awsbatch'
254 queue = 'my-batch-queue'
255 aws.batch.cliPath = '/home/ec2-user/miniconda/bin/aws'
256 aws.batch.region = 'us-east-1'
257 singularity.enabled = false
258 singularity.autoMounts = true
259 docker.enabled = true
260 params.conda_enabled = false
261 params.enable_module = false
262 }
263 ```
264
265 \
266 &nbsp;
267
268 ### Example data
269
270 ---
271
272 `cronology` was tested on multiple internal sequencing runs and also on publicly available WGS run data. Please make sure that you have all the [minimum requirements](#minimum-requirements) to run the workflow.
273
274 - Download public SRA data for **_Cronobacter_**: [SRR List](../assets/runs_public_cronobacter.txt). You can download a minimized set of sequencing runs for testing purposes.
275 - Download pre-formatted full database for **NCBI Pathogens release**: [PDG000000043.213](https://research.foodsafetyrisk.org/cronology/PDG000000043.213.tar.bz2) (~500 MB).
276 - After succesful run of the workflow, your **MultiQC** report should look something like [this](https://research.foodsafetyrisk.org/cronology/627_crono_multiqc_report.html).
277 - It is always a best practice to use absolute UNIX paths and real destinations of symbolic links during pipeline execution. For example, find out the real path(s) of your absolute UNIX path(s) and use that for the `--input` and `--output` options of the pipeline.
278
279 ```bash
280 realpath /hpc/scratch/user/input
281 ```
282
283 Now, run the workflow:
284
285 \
286 &nbsp;
287
288 ```bash
289 cpipes \
290 --pipeline cronology \
291 --input /path/to/sra_reads \
292 --output /path/to/sra_reads_output \
293 --cronology_root_dbdir /path/to/PDG000000043.213 \
294 --fq_single_end false \
295 --fq_suffix '_1.fastq.gz' --fq2_suffix '_2.fastq.gz' \
296 -profile stdkondagac \
297 -resume
298 ```
299
300 Please note that the run time profile `stdkondagac` will run jobs locally using `micromamba` for software provisioning. The first time you run the command, a new folder called `kondagac_cache` will be created and subsequent runs should use this `conda` cache.
301
302 \
303 &nbsp;
304
305 ## `cronology` CLI Help
306
307 ```text
308 [Kranti_Konganti@my-unix-box ]$ cpipes --pipeline cronology --help
309 N E X T F L O W ~ version 23.04.3
310 Launching `./cronology/cpipes` [jovial_colden] DSL2 - revision: 79ea031fad
311 ================================================================================
312 (o)
313 ___ _ __ _ _ __ ___ ___
314 / __|| '_ \ | || '_ \ / _ \/ __|
315 | (__ | |_) || || |_) || __/\__ \
316 \___|| .__/ |_|| .__/ \___||___/
317 | | | |
318 |_| |_|
319 --------------------------------------------------------------------------------
320 A collection of modular pipelines at CFSAN, FDA.
321 --------------------------------------------------------------------------------
322 Name : CPIPES
323 Author : Kranti.Konganti@fda.hhs.gov
324 Version : 0.7.0
325 Center : CFSAN, FDA.
326 ================================================================================
327
328
329 --------------------------------------------------------------------------------
330 Show configurable CLI options for each tool within cronology
331 --------------------------------------------------------------------------------
332 Ex: cpipes --pipeline cronology --help
333 Ex: cpipes --pipeline cronology --help fastp
334 Ex: cpipes --pipeline cronology --help fastp,polypolish
335 --------------------------------------------------------------------------------
336 --help dpubmlstpy : Show dl_pubmlst_profiles_and_schemes.py CLI
337 options CLI options
338 --help fastp : Show fastp CLI options
339 --help spades : Show spades CLI options
340 --help shovill : Show shovill CLI options
341 --help polypolish : Show polypolish CLI options
342 --help quast : Show quast.py CLI options
343 --help prodigal : Show prodigal CLI options
344 --help prokka : Show prokka CLI options
345 --help pirate : Show priate CLI options
346 --help mlst : Show mlst CLI options
347 --help mash : Show mash `screen` CLI options
348 --help tree : Show mashtree CLI options
349 --help abricate : Show abricate CLI options
350
351 ```