Skip to content

Commit 6409cbf

Browse files
committed
Updated versions and README
1 parent 9b79149 commit 6409cbf

File tree

68 files changed

+4449
-198
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+4449
-198
lines changed

Metagenomics/Illumina/Pipeline_GL-DPPD-7107_Versions/GL-DPPD-7107-A.md

Lines changed: 1117 additions & 0 deletions
Large diffs are not rendered by default.

Metagenomics/Illumina/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
# GeneLab bioinformatics processing pipeline for Illumina metagenomics sequencing data
33

4-
> **The document [`GL-DPPD-7107.md`](Pipeline_GL-DPPD-7107_Versions/GL-DPPD-7107.md) holds an overview and example commands for how GeneLab processes Illumina metagenomics sequencing datasets. See the [Repository Links](#repository-links) descriptions below for more information. Processed data output files and processing code are provided for each GLDS dataset in the [Open Science Data Repository (OSDR)](https://osdr.nasa.gov/bio/repo/).**
4+
> **The document [`GL-DPPD-7107-A.md`](Pipeline_GL-DPPD-7107_Versions/GL-DPPD-7107-A.md) holds an overview and example commands for how GeneLab processes Illumina metagenomics sequencing datasets. See the [Repository Links](#repository-links) descriptions below for more information. Processed data output files and processing code are provided for each GLDS dataset in the [Open Science Data Repository (OSDR)](https://osdr.nasa.gov/bio/repo/).**
55
>
66
> Note: The exact processing commands and MGIllumina version used for specific GLDS datasets can be found in the *_processing_info.zip file under "Files" for each respective GLDS dataset in the [Open Science Data Repository (OSDR)](https://osdr.nasa.gov/bio/repo/).
77
@@ -26,4 +26,4 @@
2626
---
2727

2828
**Developed and maintained by:**
29-
Michael D. Lee (Mike.Lee@nasa.gov)
29+
Michael D. Lee (Mike.Lee@nasa.gov) and Olabiyi A.Obayomi (olabiyi.a.obayomi@nasa.gov)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Workflow change log
2+
3+
## [1.0.0](https://github.com/nasa/GeneLab_Data_Processing/tree/NF_MGIllumina_1.0.0/Metagenomics/Illumina/Workflow_Documentation/NF_MGIllumina)
4+
- workflow version that converted snakemake to nextflow
Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
# Workflow Information and Usage Instructions
2+
3+
## General Workflow Info
4+
5+
### Implementation Tools
6+
The current GeneLab Illumina metagenomics sequencing data processing pipeline (MGIllumina), [GL-DPPD-7107-A.md](../../Pipeline_GL-DPPD-7107_Versions/GL-DPPD-7107-A.md), is implemented as a [Nextflow](https://nextflow.io/) DSL2 workflow and utilizes [Singularity](https://docs.sylabs.io/guides/3.10/user-guide/introduction.html) containers or [conda](https://docs.conda.io/en/latest/) environments to install/run all tools. This workflow is run using the command line interface (CLI) of any unix-based system. While knowledge of creating workflows in nextflow is not required to run the workflow as is, [the Nextflow documentation](https://nextflow.io/docs/latest/index.html) is a useful resource for users who want to modify and/or extend this workflow.
7+
8+
> **Note on reference databases**
9+
> Many reference databases are relied upon throughout this workflow. They will be installed and setup automatically the first time the workflow is run. All together, after installed and unpacked, they will take up about about 340 GB of storage, but they may also require up to 500GB during installation and initial un-packing, so be sure there is enough room on your system before running the workflow.
10+
11+
12+
## Utilizing the Workflow
13+
14+
1. [Install Nextflow and Singularity](#1-install-nextflow-and-singularity)
15+
1a. [Install Nextflow](#1a-install-nextflow)
16+
1b. [Install Singularity](#1b-install-singularity)
17+
18+
2. [Download the workflow files](#2-download-the-workflow-files)
19+
20+
3. [Fetch Singularity Images](#3-fetch-singularity-images)
21+
22+
4. [Run the workflow](#3-run-the-workflow)
23+
3a. [Approach 1: Run slurm jobs in singularity containers with OSD accession as input](#3a-approach-1-run-slurm-jobs-in-singularity-containers-with-osd-accession-as-input)
24+
3b. [Approach 2: Run slurm jobs in singularity containers with a csv file as input](#3b-approach-2-run-slurm-jobs-in-singularity-containers-with-a-csv-file-as-input)
25+
3c. [Approach 3: Run jobs locally in conda environments and specify the path to one or more existing conda environments](#3c-approach-run-jobs-locally-in-conda-environments-and-specify-the-path-to-one-or-more-existing-conda-environments)
26+
3d. [Modify parameters and cpu resources in the nextflow config file](#3d-modify-parameters-and-cpu-resources-in-the-nextflow-config-file)
27+
28+
4. [Workflow outputs](#4-workflow-outputs)
29+
4a. [Main outputs](#4a-main-outputs)
30+
4b. [Resource logs](#4b-resource-logs)
31+
32+
<br>
33+
34+
---
35+
36+
### 1. Install Nextflow and Singularity
37+
38+
#### 1a. Install Nextflow
39+
40+
Nextflow can be installed either through [Anaconda](https://anaconda.org/bioconda/nextflow) or as documented on the [Nextflow documentation page](https://www.nextflow.io/docs/latest/getstarted.html).
41+
42+
> Note: If you want to install Anaconda, we recommend installing a Miniconda, Python3 version appropriate for your system, as instructed by [Happy Belly Bioinformatics](https://astrobiomike.github.io/unix/conda-intro#getting-and-installing-conda).
43+
>
44+
> Once conda is installed on your system, you can install the latest version of Nextflow by running the following commands:
45+
>
46+
> ```bash
47+
> conda install -c bioconda nextflow
48+
> nextflow self-update
49+
> ```
50+
51+
<br>
52+
53+
#### 1b. Install Singularity
54+
55+
Singularity is a container platform that allows usage of containerized software. This enables the GeneLab workflow to retrieve and use all software required for processing without the need to install the software directly on the user's system.
56+
57+
We recommend installing Singularity on a system wide level as per the associated [documentation](https://docs.sylabs.io/guides/3.10/admin-guide/admin_quickstart.html).
58+
59+
> Note: Singularity is also available through [Anaconda](https://anaconda.org/conda-forge/singularity).
60+
61+
<br>
62+
63+
---
64+
65+
### 2. Download the workflow files
66+
67+
All files required for utilizing the NF_XXX GeneLab workflow for processing metagenomics illumina data are in the [workflow_code](workflow_code) directory. To get a copy of latest *NF_XXX* version on to your system, the code can be downloaded as a zip file from the release page then unzipped after downloading by running the following commands:
68+
69+
```bash
70+
wget https://github.com/nasa/GeneLab_Data_Processing/releases/download/NF_MGIllumina/NF_MGIllumina.zip
71+
unzip NF_MGIllumina.zip && cd NF_XXX-X_X.X.X
72+
```
73+
<br>
74+
75+
---
76+
77+
### 3. Fetch Singularity Images
78+
79+
Although Nextflow can fetch Singularity images from a url, doing so may cause issues as detailed [here](https://github.com/nextflow-io/nextflow/issues/1210).
80+
81+
To avoid this issue, run the following command to fetch the Singularity images prior to running the NF_MGIllumina workflow:
82+
> Note: This command should be run in the location containing the `NF_MGIllumina` directory that was downloaded in [step 2](#2-download-the-workflow-files) above.
83+
84+
```bash
85+
bash ./bin/prepull_singularity.sh nextflow.config
86+
```
87+
88+
89+
Once complete, a `singularity` folder containing the Singularity images will be created. Run the following command to export this folder as a Nextflow configuration environment variable to ensure Nextflow can locate the fetched images:
90+
91+
```bash
92+
export NXF_SINGULARITY_CACHEDIR=$(pwd)/singularity
93+
```
94+
95+
<br>
96+
97+
---
98+
99+
### 4. Run the Workflow
100+
101+
For options and detailed help on how to run the workflow, run the following command:
102+
103+
```bash
104+
nextflow run main.nf --help
105+
```
106+
107+
> Note: Nextflow commands use both single hyphen arguments (e.g. -help) that denote general nextflow arguments and double hyphen arguments (e.g. --csv_file) that denote workflow specific parameters. Take care to use the proper number of hyphens for each argument.
108+
109+
<br>
110+
111+
#### 4a. Approach 1: Run slurm jobs in singularity containers with OSD accession as input
112+
113+
```bash
114+
nextflow run main.nf -resume -profile slurm,singularity --GLDS_accession OSD-574
115+
```
116+
117+
<br>
118+
119+
#### 4b. Approach 2: Run slurm jobs in singularity containers with a csv file as input
120+
121+
```bash
122+
nextflow run main.nf -resume -profile slurm,singularity --csv_file PE_file.csv
123+
```
124+
125+
<br>
126+
127+
#### 4c. Approach 3: Run jobs locally in conda environments and specify the path to one or more existing conda environment(s)
128+
129+
```bash
130+
nextflow run main.nf -resume -profile conda --csv_file SE_file.csv --conda.qc <path/to/existing/conda/environment>
131+
```
132+
133+
<br>
134+
135+
**Required Parameters For All Approaches:**
136+
137+
* `-run main.nf` - Instructs nextflow to run the NF_XXX workflow
138+
* `-resume` - Resumes workflow execution using previously cached results
139+
* `-profile` – Specifies the configuration profile(s) to load, `singularity` instructs nextflow to setup and use singularity for all software called in the workflow
140+
141+
142+
*Required only if you would like to pull and process data directly from OSDR*
143+
144+
* `--GLDS_accession` – A Genelab / OSD accession number e.g. OSD-574.
145+
146+
*Required only if --GLDS_accession is not passed as an argument*
147+
148+
* `--csv_file` – A 3-column (single-end) or 4-column (paired-end) input csv file (sample_id, forward, [reverse,] paired). Please see the sample [SE_file.csv](workflow_code/SE_file.csv)and [PE_file.csv]((workflow_code/PE_file.csv) in this repository for examples on how to format this file.
149+
150+
> See `nextflow run -h` and [Nextflow's CLI run command documentation](https://nextflow.io/docs/latest/cli.html#run) for more options and details on how to run nextflow.
151+
152+
<br>
153+
154+
#### 4d. Modify parameters and cpu resources in the nextflow config file
155+
156+
Additionally, the parameters and workflow resources can be directly specified in the nextflow.config file. For detailed instructions on how to modify and set parameters in the nextflow.config file, please see the [documentation here](https://www.nextflow.io/docs/latest/config.html).
157+
158+
Once you've downloaded the workflow template, you can modify the parameters in the `params` scope and cpus/memory requirements in the `process` scope in your downloaded version of the [nextflow.config](workflow_code/nextflow.config) file as needed in order to match your dataset and system setup. For example, you can directly set the the full paths to available conda environments in the `conda` scope within the `params` scope. Additionally, if necessary, you'll need to modify each variable in the [nextflow.config](workflow_code/nextflow.config) file to be consistent with the study you want to process and the machine you're using.
159+
160+
<br>
161+
162+
---
163+
164+
### 5. Workflow outputs
165+
166+
#### 5a. Main outputs
167+
168+
The outputs from this pipeline are documented in the [GL-DPPD-7107-A](../../Pipeline_GL-DPPD-7107_Versions/GL-DPPD-7107-A.md) processing protocol.
169+
170+
#### 5b. Resource logs
171+
172+
Standard nextflow resource usage logs are also produced as follows:
173+
174+
- Output:
175+
- Resource_Usage/execution_report_{timestamp}.html (an html report that includes metrics about the workflow execution including computational resources and exact workflow process commands)
176+
- Resource_Usage/execution_timeline_{timestamp}.html (an html timeline for all processes executed in the workflow)
177+
- Resource_Usage/execution_trace_{timestamp}.txt (an execution tracing file that contains information about each process executed in the workflow, including: submission time, start time, completion time, cpu and memory used, machine-readable output)
178+
179+
> Further details about these logs can also found within [this Nextflow documentation page](https://www.nextflow.io/docs/latest/tracing.html#execution-report).
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
# only built for use on N288 cluster
5+
6+
# example usage: bash clean-paths.sh <input-file> <workflow-dir>
7+
8+
# making sure by chance we are not overwriting a wanted file called 't'
9+
10+
if [ -s t ]; then
11+
printf "\n This simple program temporarily writes to a file called 't'\n"
12+
printf " Since that exists already here, we are not going to continue.\n\n"
13+
exit
14+
fi
15+
16+
17+
ROOT_DIR=$(echo $2 | awk '{N=split($0,a,"/"); for(i=0; i < N-1; i++) printf "%s/", a[i]}' | sed 's|//|/|')
18+
19+
20+
sed -E 's|.*/GLDS_Datasets/(.+)|\1|g' ${1} \
21+
| sed -E 's|.+/miniconda.+/envs/[^/]*/||g' \
22+
| sed -E 's|/[^ ]*/GLDS-|GLDS-|g' \
23+
| sed -E 's|/[a-z]{6}/[^ ]*|<path-removed-for-security-purposes>|g' \
24+
| sed -E "s|${ROOT_DIR}||g" > t && mv t ${1}

0 commit comments

Comments
 (0)