This module is designed to function as both a standalone MAG short-read-assembly pipeline as well as a component of the larger CAMP/CAP2 metagenome analysis pipeline. As such, it is both self-contained (ex. instructions included for the setup of a versioned environment, etc.), and seamlessly compatible with other CAMP modules (ex. ingests and spawns standardized input/output config files, etc.).
Assemble short reads
- Clone repo from github <https://github.com/b-tierney/camp_short-read-assembly>_.
- Set up the conda environment (contains, Snakemake) using
configs/conda/camp_short-read-assembly.yaml.
3. Make sure the installed pipeline works correctly. pytest only generates temporary outputs so no files should be created.
cd camp_short-read-assembly conda env create -f configs/conda/camp_short-read-assembly.yaml conda activate camp_short-read-assembly pytest .tests/unit/
Input: /path/to/samples.csv provided by the user.
Output: 1) An output config file summarizing 2) the module's outputs.
/path/to/work/dir/short-read-assembly/final_reports/samples.csvfor ingestion by the next module (ex. quality-checking)
Example usage:
Structure:
└── workflow
├── Snakefile
├── short-read-assembly.py
├── utils.py
└── __init__.py
workflow/short-read-assembly.py: Click-based CLI that wraps thesnakemakeand unit test generation commands for clean management of parameters, resources, and environment variables.workflow/Snakefile: Thesnakemakepipeline.workflow/utils.py:
Instructions:
- Make your own
samples.csvbased on the template inconfigs/samples.csv. Sample test data can be found intest_data/. samples.csvrequires absolute paths to Illumina reads (currently,ingest_samplesinworkflow/utils.pyexpects FastQs) and de novo assembled contigs.
- Make your own
- Update the relevant parameters in
configs/parameters.yaml. - Update the computational resources available to the pipeline in
resources/*.yamlwhere*is either 'slurm' or 'bash'. - To run CAMP on the command line, use the following, where
/path/to/work/diris replaced with the absolute path of your chosen working directory, and/path/to/samples.csvis replaced with your copy ofsamples.csv.
- ::
- python /path/to/camp_short-read-assembly/workflow/short-read-assembly.py
- -w /path/to/camp_short-read-assembly/workflow/Snakefile -d /path/to/work/dir -s /path/to/samples.csv
- Note: This setup allows the main Snakefile to live outside of the work directory.
- To run CAMP on a job submission cluster (for now, only Slurm is supported), use the following.
--slurmis an optional flag that submits all rules in the Snakemake pipeline assbatchjobs.
sbatch -j jobname -e jobname.err.log -o jobname.out.log << "EOF"
#!/bin/bash
python /path/to/camp_short-read-assembly/workflow/short-read-assembly.py --slurm \
-w /path/to/camp_short-read-assembly/workflow/Snakefile \
-d /path/to/work/dir \
-s /path/to/samples.csv
EOF
We love to see it! This module was partially envisioned as a dependable, prepackaged sandbox for developers to test their shiny new tools in.
These instructions are meant for developers who have made a tool and want to integrate or demo its functionality as part of a standard short-read-assembly workflow, or developers who want to integrate an existing short-read-assembly tool.
- Write a module rule that wraps your tool and integrates its input and output into the pipeline.
- This is a great Snakemake tutorial for writing basic Snakemake rules.
- If you're adding new tools from an existing YAML, use
conda env update --file configs/conda/camp_short-read-assembly.yaml --prune.
- Update the
make_configinworkflow/Snakefilerule to check for your tool's output files. Updatesamples.csvto document its output if downstream modules/tools are meant to ingest it. - If applicable, update the default conda config using
conda env export > config/conda/camp_short-read-assembly.yamlwith your tool and its dependencies. - If there are dependency conflicts, make a new conda YAML under
configs/condaand specify its usage in specific rules using thecondaoption (seefirst_rulefor an example).
- If there are dependency conflicts, make a new conda YAML under
- If applicable, update the default conda config using
- Add your tool's installation and running instructions to the module documentation and (if applicable) add the repo to your Read the Docs account + turn on the Read the Docs service hook.
5. Run the pipeline once through to make sure everything works using the test data in test_data/ if appropriate, or your own appropriately-sized test data. Then, generate unit tests to ensure that others can sanity-check their installations.
python /path/to/camp_short-read-assembly/workflow/short-read-assembly.py generate_unit_tests \
-w /path/to/camp_short-read-assembly/workflow/Snakefile \
-d /path/to/work/dir \
-s /path/to/samples.csv
6. Increment the version number of the modular pipeline.
bump2version --allow-dirty --commit --tag major workflow/__init__.py \
--current-version A.C.E --new-version B.D.F
- If you want your tool integrated into the main CAP2/CAMP pipeline, send a pull request and we'll have a look at it ASAP!
- Please make it clear what your tool intends to do by including a summary in the commit/pull request (ex. "Release X.Y.Z: Integration of tool A, which does B to C and outputs D").