Read-mapping against the contig catalogue from metagenomics by illumina and nanopore
Help improve this workflow!
This workflow has been published but could be further improved with some additional meta data:- Keyword(s) in categories input, output, operation, topic
You can help improve this workflow by suggesting the addition or removal of keywords, suggest changes and report issues, or request to become a maintainer of the Workflow .
Snakemake workflow:
snakemap
A Snakemake workflow for
snakemap
A snakemake workflow for read-mapping against the contig catalogue from metagenomics by illumina and nanopore
Usage
- Init
python init.py -i /path/to/illumina_fqs -n /path/to/nanopore_fqs -w /path/to/workdir
- Run
snakemake all -j6 --snakefile /path/to/Snakefile --configfile /path/to/config.yaml --directory /path/to/workdir --use-conda
Code Snippets
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | __author__ = "Johannes Köster" __copyright__ = "Copyright 2016, Johannes Köster" __email__ = "koester@jimmy.harvard.edu" __license__ = "MIT" import os from snakemake.shell import shell from snakemake_wrapper_utils.samtools import get_samtools_opts samtools_opts = get_samtools_opts(snakemake) extra = snakemake.params.get("extra", "") log = snakemake.log_fmt_shell(stdout=True, stderr=True) n = len(snakemake.input.sample) assert ( n == 1 or n == 2 ), "input->sample must have 1 (single-end) or 2 (paired-end) elements." if n == 1: reads = "-U {}".format(*snakemake.input.sample) else: reads = "-1 {} -2 {}".format(*snakemake.input.sample) index = os.path.commonprefix(snakemake.input.idx).rstrip(".") shell( "(bowtie2" " --threads {snakemake.threads}" " {reads} " " -x {index}" " {extra}" "| samtools view" " {samtools_opts}" " -" ") {log}" ) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | __author__ = "Daniel Standage" __copyright__ = "Copyright 2020, Daniel Standage" __email__ = "daniel.standage@nbacc.dhs.gov" __license__ = "MIT" import os from snakemake.shell import shell extra = snakemake.params.get("extra", "") log = snakemake.log_fmt_shell(stdout=True, stderr=True) index = os.path.commonprefix(snakemake.output).rstrip(".") shell( "bowtie2-build" " --threads {snakemake.threads}" " {extra}" " {snakemake.input.ref}" " {index}" " {log}" ) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | __author__ = "Johannes Köster" __copyright__ = "Copyright 2016, Johannes Köster" __email__ = "koester@jimmy.harvard.edu" __license__ = "MIT" from snakemake.shell import shell extra = snakemake.params.get("extra", "") log = snakemake.log_fmt_shell(stdout=True, stderr=True) # Samtools takes additional threads through its option -@ # One thread for samtools merge # Other threads are *additional* threads passed to the '-@' argument threads = "" if snakemake.threads <= 1 else " -@ {} ".format(snakemake.threads - 1) shell( "samtools index {threads} {extra} {snakemake.input[0]} {snakemake.output[0]} {log}" ) |
7 8 9 10 11 12 13 14 15 | run: with open(output[0], "w") as out: with open (input[0], "r") as inp: i = 1 for line in inp: if line.startswith(">"): line = ">id_" + str(i) + "\n" i += 1 out.write(line) |
26 | wrapper: "v1.12.2/bio/bowtie2/build" |
38 | wrapper: "v1.12.2/bio/bowtie2/align" |
45 46 | shell: "(samtools view -h {input} | {workflow.basedir}/scripts/read_count_bam.pl | samtools view -Su -q30 - | samtools sort -O BAM -o {output} -) 2>> {log}" |
54 | wrapper: "v1.12.2/bio/samtools/index" |
63 64 65 66 67 | shell: """ echo '#OTU ID' > {output} samtools idxstats $(ls {input.bam} | head -n 1) | grep -v "*" | cut -f1 >> {output} """ |
76 77 78 79 80 | shell: """ echo '{wildcards.sample}' > {output} samtools idxstats {input.bam} | grep -v "*" | cut -f3 >> {output} """ |
88 89 90 91 92 93 94 95 96 97 | shell: """ cp {input.ids} {output} # split if exceed 1000 (max 1024 by default in most OS) while read fs; do paste {output} $fs > {output}.tmp # redirection first mv {output}.tmp {output} done < <(echo {input.counts} | xargs -n 1000) """ |
17 | shell: "minimap2 -I {params.index_size} -d {output} {input} 2> {log}" |
24 | shell: "samtools dict {input} | cut -f1-3 > {output} 2> {log}" |
37 38 39 40 41 | shell: """ minimap2 -t {threads} -ax {params.x} --secondary=no {input.mmi} {input.fq} 2> {log} | \ grep -v "^@" | cat {input.dict} - > {output} 2>> {log} """ |
51 52 | shell: "samtools view -F 3584 -b {input} | samtools sort - -T {params.prefix} -m {params.m} -o {output} 2>{log}" |
Support
Do you know this workflow well? If so, you can
request seller status , and start supporting this workflow.
Created: 1yr ago
Updated: 1yr ago
Maitainers:
public
URL:
https://github.com/yanhui09/snakemap
Name:
snakemap
Version:
1
Downloaded:
0
Copyright:
Public Domain
License:
GNU General Public License v3.0
Keywords:
- Future updates
Related Workflows

ENCODE pipeline for histone marks developed for the psychENCODE project
psychip pipeline is an improved version of the ENCODE pipeline for histone marks developed for the psychENCODE project.
The o...

Near-real time tracking of SARS-CoV-2 in Connecticut
Repository containing scripts to perform near-real time tracking of SARS-CoV-2 in Connecticut using genomic data. This pipeli...

snakemake workflow to run cellranger on a given bucket using gke.
A Snakemake workflow for running cellranger on a given bucket using Google Kubernetes Engine. The usage of this workflow ...

ATLAS - Three commands to start analyzing your metagenome data
Metagenome-atlas is a easy-to-use metagenomic pipeline based on snakemake. It handles all steps from QC, Assembly, Binning, t...
raw sequence reads
Genome assembly
Annotation track
checkm2
gunc
prodigal
snakemake-wrapper-utils
MEGAHIT
Atlas
BBMap
Biopython
BioRuby
Bwa-mem2
cd-hit
CheckM
DAS
Diamond
eggNOG-mapper v2
MetaBAT 2
Minimap2
MMseqs
MultiQC
Pandas
Picard
pyfastx
SAMtools
SemiBin
Snakemake
SPAdes
SqueezeMeta
TADpole
VAMB
CONCOCT
ete3
gtdbtk
h5py
networkx
numpy
plotly
psutil
utils
metagenomics

RNA-seq workflow using STAR and DESeq2
This workflow performs a differential gene expression analysis with STAR and Deseq2. The usage of this workflow is described ...

This Snakemake pipeline implements the GATK best-practices workflow
This Snakemake pipeline implements the GATK best-practices workflow for calling small germline variants. The usage of thi...