Assembly and annotation of metatranscriptomic data

public public 1yr ago Version: dev 0 bookmarks
Loading...

Introduction

nf-core/metatdenovo is a bioinformatics best-practice analysis pipeline for Assembly and annotation of metatranscriptomic data, both prokaryotic and eukaryotic.

The pipeline is built using Nextflow , a workflow tool to run tasks across multiple compute infrastructures in a very portable manner. It uses Docker/Singularity containers making installation trivial and results highly reproducible. The Nextflow DSL2 implementation of this pipeline uses one container per process which makes it much easier to maintain and update software dependencies. Where possible, these processes have been submitted to and installed from nf-core/modules in order to make them available to all nf-core pipelines, and to everyone within the Nextflow community!

On release, automated continuous integration tests run the pipeline on a full-sized dataset on the AWS cloud infrastructure. This ensures that the pipeline runs on AWS, has sensible resource allocation defaults set to run on real-world datasets, and permits the persistent storage of results to benchmark between pipeline releases and other analysis sources.The results obtained from the full-sized test can be viewed on the nf-core website .

Pipeline summary

nf-core/rnaseq metro map

  1. Read QC ( FastQC )

  2. Present QC for raw reads ( MultiQC )

  3. Quality trimming and adapters removal for raw reads Trimm Galore!

  4. Filter sequences with BBduk

  5. Normalize the sequences with khmer or BBnorm

  6. Merge trimmed, pair-end reads ( Seqtk )

  7. Choice of de novo assembly programs:

    1. RNAspade suggested for Eukaryotes de novo assembly

    2. Megahit suggested for Prokaryotes de novo assembly

  8. Choice of orf caller:

    1. TransDecoder suggested for Eukaryotes

    2. Prokka suggested for Prokaryotes

    3. Prodigal suggested for Prokaryotes

  9. Quantification of genes identified in assemblies:

    1. generate index of assembly BBmap index

    2. Mapping cleaned reads to the assembly for quantification BBmap

    3. Get raw counts per each gene present in the assembly Featurecounts -> TSV table with collected featurecounts output

  10. Functional annotation:

    1. Eggnog -> Reformat TSV output "eggnog table"

    2. KOfamscan

    3. HMMERsearch -> Ranking orfs based on HMMprofile with Hmmrank

  11. Taxonomical annotation:

    1. EUKulele -> Reformat TSV output "Reformat_tax.R"

    2. CAT

    3. Choice of functional annotation: 1. Eggnog-mapper 2. Run-DBcan 3. Hmmsearch . Besides searching the ORFs, each ORF's hits will be ranked.

  12. Summary statistics table. Collect_stats.R

Usage

Note If you are new to Nextflow and nf-core, please refer to this page on how to set-up Nextflow. Make sure to test your setup with -profile test before running the workflow on actual data.

First, prepare a samplesheet with your input data that looks as follows:

samplesheet.csv :

sample,fastq_1,fastq_2
CONTROL_REP1,AEG588A1_S1_L002_R1_001.fastq.gz,AEG588A1_S1_L002_R2_001.fastq.gz

Each row represents a fastq file (single-end) or a pair of fastq files (paired end).

-->

Now, you can run the pipeline using:

nextflow run nf-core/metatdenovo \
 --input samplesheet.csv \
 -profile <docker/singularity/.../institute> \
 --input samplesheet.csv \
 --outdir <OUTDIR>

Warning: Please provide pipeline parameters via the CLI or Nextflow -params-file option. Custom config files including those provided by the -c Nextflow option can be used to provide any configuration except for parameters ; see docs .

For more details and further functionality, please refer to the usage documentation and the parameter documentation .

Pipeline output

To see the results of an example test run with a full size dataset refer to the results tab on the nf-core website pipeline page. For more details about the output files and reports, please refer to the output documentation .

Credits

nf-core/metatdenovo was originally written by Danilo Di Leo (@danilodileo), Emelie Nilsson (@emnilsson) & Daniel Lundin (@erikrikarddaniel).

Contributions and Support

If you would like to contribute to this pipeline, please see the contributing guidelines .

For further information or help, don't hesitate to get in touch on the Slack #metatdenovo channel (you can join with this invite ).

Citations

An extensive list of references for the tools used by the pipeline can be found in the CITATIONS.md file.

You can cite the nf-core publication as follows:

The nf-core framework for community-curated bioinformatics pipelines.

Philip Ewels, Alexander Peltzer, Sven Fillinger, Harshil Patel, Johannes Alneberg, Andreas Wilm, Maxime Ulysse Garcia, Paolo Di Tommaso & Sven Nahnsen.

Nat Biotechnol. 2020 Feb 13. doi: 10.1038/s41587-020-0439-x .

Code Snippets

25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
"""
CAT contigs -c "$assembly" -d database/ -t taxonomy/ -n 4 -o "${meta.id}" --top 11 --I_know_what_Im_doing
CAT add_names -i "${meta.id}.ORF2LCA.txt" -o "${meta.id}.ORF2LCA.names.txt" -t taxonomy/ ${official_taxonomy}
CAT add_names -i "${meta.id}.contig2classification.txt" -o "${meta.id}.contig2classification.names.txt" -t taxonomy/ ${official_taxonomy}

mkdir raw
mv *.ORF2LCA.txt *.predicted_proteins.faa *.predicted_proteins.gff *.log *.contig2classification.txt raw/
gzip \
    "raw/${meta.id}.predicted_proteins.faa" \
    "raw/${meta.id}.predicted_proteins.gff" \
    "raw/${meta.id}.contig2classification.txt" \
    "${meta.id}.ORF2LCA.names.txt" \
    "raw/${meta.id}.ORF2LCA.txt" \
    "${meta.id}.contig2classification.names.txt"

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    CAT_CONTIGS: \$(CAT --version | sed "s/CAT v//; s/(.*//")
    diamond: \$(diamond --version 2>&1 | tail -n 1 | sed 's/^diamond version //')
END_VERSIONS
"""
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"""
CAT prepare --fresh

# get name/date of generated datase
out=(*_taxonomy/)
[[ \$out =~ (.*)_taxonomy/ ]];
DB_NAME="CAT_prepare_\${BASH_REMATCH[1]}"

mv *_taxonomy taxonomy
mv *_database database
rm database/*.nr.gz
if [ ${save_db} = "Y" ] ; then
    tar -cf - taxonomy database | gzip > "\${DB_NAME}".tar.gz
fi

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    CAT: \$(CAT --version | sed "s/CAT v//; s/(.*//")
    diamond: \$(diamond --version 2>&1 | tail -n 1 | sed 's/^diamond version //')
END_VERSIONS
"""
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"""
if [[ ${database} != *.tar.gz ]]; then
    ln -sr `find ${database}/ -type d -name "*taxonomy*"` taxonomy
    ln -sr `find ${database}/ -type d -name "*database*"` database
else
    mkdir catDB
    tar -xf ${database} -C catDB
    mv `find catDB/ -type d -name "*taxonomy*"` taxonomy/
    mv `find catDB/ -type d -name "*database*"` database/
fi

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    tar: \$(tar --version 2>&1 | sed -n 1p | sed 's/tar (GNU tar) //')
END_VERSIONS
"""
NextFlow From line 17 of cat/cat_db.nf
18
19
20
21
22
23
24
25
26
27
28
"""
# use find as sometimes these are empty and need to fail gracefully
find -L -type f -name "*contig2classification.names.txt.gz" -exec sh -c 'for f do gunzip -c \$f > \${f%.*}; done' find-sh {} +

bioawk '(NR == 1) || (FNR > 1)' *.txt > ${prefix}.tsv

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    bioawk: \$(bioawk --version | cut -f 3 -d ' ' )
END_VERSIONS
"""
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
"""

mkdir eggnog

download_eggnog_data.py \\
    $args \\
    -y \\
    --data_dir ./eggnog/

ln -s ./eggnog/* ./

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    eggnog: \$( echo \$(emapper.py --version 2>&1)| sed 's/.* emapper-//' )
END_VERSIONS


"""
45
46
47
48
49
50
51
52
53
54
55
56
57
58
"""

mkdir eggnog
touch ./eggnog/eggnog.db
touch ./eggnog/eggnog.taxa.db
touch ./eggnog/eggnog.taxa.db.traverse.pkl
ln -s eggnog/* ./

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    eggnog: \$( echo \$(emapper.py --version 2>&1)| sed 's/.* emapper-//' )
END_VERSIONS

"""
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
"""
$gunzip

emapper.py \\
    $args \\
    --cpu $task.cpus \\
    --data_dir $db \\
    --output $prefix \\
    -i $input

gzip ${prefix}.emapper.*
zgrep -v '^##' ${prefix}.emapper.annotations |sed 's/^#//' | sed 's/query/orf/' | gzip -c > ${prefix}.emapper.tsv.gz

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    eggnog: \$( echo \$(emapper.py --version 2>&1)| sed 's/.* emapper-//' | sed 's/ \\/ Expected.*//')
END_VERSIONS
"""
53
54
55
56
57
58
59
60
61
62
"""
touch test.emapper.hits
touch test.emapper.seed_orthologs
touch test.emapper.annotations

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    eggnog: \$( echo \$(emapper.py --version 2>&1)| sed 's/.* emapper-//' | sed 's/\\/ Expected eggNOG DB version: 5.0.2 \\/ Installed eggNOG DB version: unknown \\/ Diamond version found: diamond version 2.1.4 \\/ MMseqs2 version found: 13.45111//g' )
END_VERSIONS
"""
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
"""
pushd $directory

EUKulele \\
    download \\
    $args \\
    --database $db

popd
touch $db

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    eukulele: \$(echo \$(EUKulele --version 2>&1) | sed 's/Running EUKulele with command line arguments, as no valid configuration file was provided.//; s/The current EUKulele version is//g')
END_VERSIONS

"""
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
"""
rc=0
mkdir contigs
$gunzip


EUKulele \\
    $args \\
    $database \\
    --reference_dir $eukdb \\
    -o ${prefix} \\
    --CPUs ${task.cpus} \\
    -s \\
    contigs || rc=\$?

gzip ${prefix}/mets_full/diamond/*.out
gzip ${prefix}/taxonomy_counts/*.csv
gzip ${prefix}/taxonomy_estimation/*.out

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    eukulele: \$(echo \$(EUKulele --version 2>&1) | sed 's/Running EUKulele with command line arguments, as no valid configuration file was provided.//; s/The current EUKulele version is//g')
END_VERSIONS

if [ \$rc -le 1 ]; then
    exit 0
else
    exit \$rc;
fi
"""
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
"""
#!/usr/bin/env Rscript

library(data.table)
library(readr)
library(dtplyr)
library(dplyr)
library(purrr)
library(tidyr)
library(stringr)

setDTthreads($task.cpus)

# create a table with taxonomy categories in each column
tax <- list.files(pattern = "*.out") %>%
            map_df(~read.table(.,  sep = "\t", header = TRUE, fill = TRUE))

tax <- tax[,-c(1,3,5,6,7,8)]

colnames(tax)[1] <- "orf"

tax <- tax %>%
        separate('full_classification',c("Domain","Phylum", "Class", "Order", "Family", "Genus", "Species"), ";") %>%
        mutate(
            Domain = ifelse(is.na(Domain)   | Domain == '',  sprintf("%s uncl.", Domain), Domain),
            Phylum = ifelse(is.na(Phylum)   | Phylum == '',  sprintf("%s uncl.", Phylum), Phylum),
            Class = ifelse(is.na(Class)     | Class == '',   sprintf("%s uncl.", str_remove(Phylum, ' unclassified')), Class),
            Order = ifelse(is.na(Order)     | Order == '',   sprintf("%s uncl.", str_remove(Class,  ' unclassified')),  Order),
            Family = ifelse(is.na(Family)   | Family == '',  sprintf("%s uncl.", str_remove(Order,  ' unclassified')),  Family),
            Genus = ifelse(is.na(Genus)     | Genus == '',   sprintf("%s uncl.", str_remove(Family, ' unclassified')), Genus),
            Species = ifelse(is.na(Species) | Species == '', sprintf("%s uncl.", str_remove(Genus, ' unclassified')),  Species)
        ) %>%
        na.omit() %>%
        write_tsv("${prefix}.taxonomy_classification.tsv.gz")

writeLines(c("\\"${task.process}\\":", paste0("    R: ", paste0(R.Version()[c("major","minor")], collapse = ".")),paste0("    dplyr: ", packageVersion("dplyr")) ), "versions.yml")
"""
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
"""
if [ ! -e ${kofam_dir}/ko_list ]; then
    wget https://www.genome.jp/ftp/db/kofam/ko_list.gz
    gunzip -c ko_list.gz > ${kofam_dir}/ko_list
fi

if [ ! -e ${kofam_dir}/profiles ]; then
    wget -P ${kofam_dir} -c https://www.genome.jp/ftp/db/kofam/profiles.tar.gz
    gunzip -c ${kofam_dir}/profiles.tar.gz | tar vxf - -C ${kofam_dir}/
fi

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    wget: \$(wget --version | grep 'GNU Wget' | sed 's/GNU Wget \\([0-9.]\\+\\) .*/\\1/')
END_VERSIONS
"""
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
"""
$gunzip

exec_annotation \\
    --profile $koprofiles \\
    --ko-list $ko_list \\
    --format detail-tsv \\
    --cpu $task.cpus \\
    $input \\
    -o kofamscan_output.tsv

echo "orf	ko	thrshld	score	evalue	ko_definition" | gzip -c > kofamscan.tsv.gz
grep -v '#' kofamscan_output.tsv | cut -f 2-7|sed 's/\t"/\t/' | sed 's/"\$//' | gzip -c >> kofamscan.tsv.gz
gzip kofamscan_output.tsv

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    kofamscan: \$(echo \$(exec_annotation --version 2>&1) | sed 's/^.*exec_annotation//' )
END_VERSIONS
"""
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
"""
megahit \\
    $pair_ends \\
    ${single_ends} \\
    -t $task.cpus \\
    $args \\
    --out-prefix $assembly

pigz \\
    --no-name \\
    -p $task.cpus \\
    $args2 \\
    megahit_out/*.fa \\
    megahit_out/intermediate_contigs/*.fa

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    megahit_interleaved: \$(echo \$(megahit -v 2>&1) | sed 's/MEGAHIT v//')
END_VERSIONS
"""
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
"""
#!/usr/bin/env Rscript

library(dplyr)
library(readr)
library(tidyr)
library(stringr)
library(tidyverse)

# call the tables into variables
kofams <- read_tsv("kofamscan_output.tsv.gz", show_col_types = FALSE ) %>%
    select(-"#") %>%
    slice(-1) %>%
    rename(orf = "gene name") %>%
    distinct(orf, .keep_all = TRUE)

counts <- list.files(pattern = "*.counts.tsv.gz") %>%
    map_df(~read_tsv(.,  show_col_types  = FALSE)) %>%
    mutate(sample = as.character(sample))

counts %>% select(1, 7) %>%
    right_join(kofams, by = 'orf') %>%
    group_by(sample) %>%
    drop_na() %>%
    count(orf) %>%
    summarise( value = sum(n), .groups = 'drop') %>%
    add_column(database = "kofamscan", field = "n_orfs") %>%
    relocate(value, .after = last_col()) %>%
    write_tsv('${meta.id}.kofamscan_summary.tsv.gz')

writeLines(c("\\"${task.process}\\":", paste0("    R: ", paste0(R.Version()[c("major","minor")], collapse = ".")), paste0("    dplyr: ", packageVersion('dplyr')),
    paste0("    dtplyr: ", packageVersion('dtplyr')), paste0("    data.table: ", packageVersion('data.table')), paste0("    readr: ", packageVersion('readr')),
    paste0("    purrr: ", packageVersion('purrr')), paste0("    tidyr: ", packageVersion('tidyr')), paste0("    stringr: ", packageVersion('stringr')) ),
    "versions.yml")
"""
27
28
29
30
31
32
33
34
35
36
"""
cat <<-YAML > spades.yaml
[ $reads ]
YAML

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    writespadesyaml: \$(echo \$(bash --version | grep 'GNU bash' | sed 's/.*version //' | sed 's/ .*//'))
END_VERSIONS
"""
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
"""
bbmap.sh \\
    $db \\
    $input \\
    out=${prefix}.bam \\
    $args \\
    threads=$task.cpus \\
    -Xmx${task.memory.toGiga()}g \\
    &> ${prefix}.bbmap.log

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    bbmap: \$(bbversion.sh | grep -v "Duplicate cpuset")
    samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
    pigz: \$( pigz --version 2>&1 | sed 's/pigz //g' )
END_VERSIONS
"""
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
"""
maxmem=\$(echo \"$task.memory\"| sed 's/ GB/g/g')
bbduk.sh \\
    -Xmx\$maxmem \\
    $raw \\
    $trimmed \\
    threads=$task.cpus \\
    $args \\
    $contaminants_fa \\
    &> ${prefix}.bbduk.log
cat <<-END_VERSIONS > versions.yml
"${task.process}":
    bbmap: \$(bbversion.sh | grep -v "Duplicate cpuset")
END_VERSIONS
"""
28
29
30
31
32
33
34
35
36
37
38
39
40
41
"""
bbnorm.sh \\
    $input \\
    $output \\
    $args \\
    threads=$task.cpus \\
    -Xmx${task.memory.toGiga()}g \\
    &> ${prefix}.bbnorm.log

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    bbmap: \$(bbversion.sh | grep -v "Duplicate cpuset")
END_VERSIONS
"""
NextFlow From line 28 of bbnorm/main.nf
22
23
24
25
26
27
28
29
30
31
32
33
"""
bbmap.sh \\
    ref=${fasta} \\
    $args \\
    threads=$task.cpus \\
    -Xmx${task.memory.toGiga()}g

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    bbmap: \$(bbversion.sh | grep -v "Duplicate cpuset")
END_VERSIONS
"""
38
39
40
41
42
43
44
45
46
47
48
49
"""
$command1 \\
    $args \\
    ${file_list.join(' ')} \\
    $command2 \\
    > ${prefix}

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    pigz: \$( pigz --version 2>&1 | sed 's/pigz //g' )
END_VERSIONS
"""
NextFlow From line 38 of cat/main.nf
54
55
56
57
58
59
60
61
"""
touch $prefix

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    pigz: \$( pigz --version 2>&1 | sed 's/pigz //g' )
END_VERSIONS
"""
NextFlow From line 54 of cat/main.nf
26
27
28
29
30
31
32
33
"""
cat ${readList.join(' ')} > ${prefix}.merged.fastq.gz

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    cat: \$(echo \$(cat --version 2>&1) | sed 's/^.*coreutils) //; s/ .*\$//')
END_VERSIONS
"""
NextFlow From line 26 of fastq/main.nf
40
41
42
43
44
45
46
47
48
"""
cat ${read1.join(' ')} > ${prefix}_1.merged.fastq.gz
cat ${read2.join(' ')} > ${prefix}_2.merged.fastq.gz

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    cat: \$(echo \$(cat --version 2>&1) | sed 's/^.*coreutils) //; s/ .*\$//')
END_VERSIONS
"""
NextFlow From line 40 of fastq/main.nf
57
58
59
60
61
62
63
64
"""
touch ${prefix}.merged.fastq.gz

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    cat: \$(echo \$(cat --version 2>&1) | sed 's/^.*coreutils) //; s/ .*\$//')
END_VERSIONS
"""
NextFlow From line 57 of fastq/main.nf
68
69
70
71
72
73
74
75
76
"""
touch ${prefix}_1.merged.fastq.gz
touch ${prefix}_2.merged.fastq.gz

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    cat: \$(echo \$(cat --version 2>&1) | sed 's/^.*coreutils) //; s/ .*\$//')
END_VERSIONS
"""
NextFlow From line 68 of fastq/main.nf
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
"""
printf "%s %s\\n" $rename_to | while read old_name new_name; do
    [ -f "\${new_name}" ] || ln -s \$old_name \$new_name
done

fastqc \\
    $args \\
    --threads $task.cpus \\
    $renamed_files

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    fastqc: \$( fastqc --version | sed -e "s/FastQC v//g" )
END_VERSIONS
"""
46
47
48
49
50
51
52
53
54
"""
touch ${prefix}.html
touch ${prefix}.zip

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    fastqc: \$( fastqc --version | sed -e "s/FastQC v//g" )
END_VERSIONS
"""
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
"""
hmmsearch \\
    $args \\
    --cpu $task.cpus \\
    -o $output \\
    $alignment \\
    $target_summary \\
    $domain_summary \\
    $hmmfile \\
    $seqdb

gzip --no-name *.txt \\
    ${write_align ? '*.sto' : ''} \\
    ${write_target ? '*.tbl' : ''} \\
    ${write_domain ? '*.domtbl' : ''}

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    hmmer: \$(hmmsearch -h | grep -o '^# HMMER [0-9.]*' | sed 's/^# HMMER *//')
END_VERSIONS
"""
28
29
30
31
32
33
34
35
36
37
38
39
40
"""
multiqc \\
    --force \\
    $args \\
    $config \\
    $extra_config \\
    .

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    multiqc: \$( multiqc --version | sed -e "s/multiqc, version //g" )
END_VERSIONS
"""
43
44
45
46
47
48
49
50
51
52
"""
touch multiqc_data
touch multiqc_plots
touch multiqc_report.html

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    multiqc: \$( multiqc --version | sed -e "s/multiqc, version //g" )
END_VERSIONS
"""
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
"""
pigz -cdf ${genome} | prodigal \\
    $args \\
    -f $output_format \\
    -d "${prefix}.fna" \\
    -o "${prefix}.${output_format}" \\
    -a "${prefix}.faa" \\
    -s "${prefix}_all.txt"

pigz -nm ${prefix}*

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    prodigal: \$(prodigal -v 2>&1 | sed -n 's/Prodigal V\\(.*\\):.*/\\1/p')
    pigz: \$(pigz -V 2>&1 | sed 's/pigz //g')
END_VERSIONS
"""
38
39
40
41
42
43
44
45
46
47
48
49
50
51
"""
prokka \\
    $args \\
    --cpus $task.cpus \\
    --prefix $prefix \\
    $proteins_opt \\
    $prodigal_tf \\
    $fasta

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    prokka: \$(echo \$(prokka --version 2>&1) | sed 's/^.*prokka //')
END_VERSIONS
"""
23
24
25
26
27
28
29
30
31
32
33
34
"""
samtools \\
    flagstat \\
    --threads ${task.cpus} \\
    $bam \\
    > ${prefix}.flagstat

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
END_VERSIONS
"""
38
39
40
41
42
43
44
45
"""
touch ${prefix}.flagstat

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
END_VERSIONS
"""
24
25
26
27
28
29
30
31
32
33
34
35
"""
samtools \\
    idxstats \\
    --threads ${task.cpus-1} \\
    $bam \\
    > ${prefix}.idxstats

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
END_VERSIONS
"""
40
41
42
43
44
45
46
47
"""
touch ${prefix}.idxstats

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
END_VERSIONS
"""
24
25
26
27
28
29
30
31
32
33
34
35
"""
samtools \\
    index \\
    -@ ${task.cpus-1} \\
    $args \\
    $input

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
END_VERSIONS
"""
38
39
40
41
42
43
44
45
46
47
"""
touch ${input}.bai
touch ${input}.crai
touch ${input}.csi

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
END_VERSIONS
"""
NextFlow From line 38 of index/main.nf
25
26
27
28
29
30
31
32
33
34
35
36
37
"""
samtools sort \\
    $args \\
    -@ $task.cpus \\
    -o ${prefix}.bam \\
    -T $prefix \\
    $bam

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
END_VERSIONS
"""
41
42
43
44
45
46
47
48
"""
touch ${prefix}.bam

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
END_VERSIONS
"""
NextFlow From line 41 of sort/main.nf
25
26
27
28
29
30
31
32
33
34
35
36
37
"""
samtools \\
    stats \\
    --threads ${task.cpus} \\
    ${reference} \\
    ${input} \\
    > ${prefix}.stats

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
END_VERSIONS
"""
41
42
43
44
45
46
47
48
"""
touch ${prefix}.stats

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
END_VERSIONS
"""
NextFlow From line 41 of stats/main.nf
24
25
26
27
28
29
30
31
"""
ln -s ${reads} ${prefix}.fastq.gz

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    seqtk: \$(echo \$(seqtk 2>&1) | sed 's/^.*Version: //; s/ .*\$//')
END_VERSIONS
"""
NextFlow From line 24 of mergepe/main.nf
33
34
35
36
37
38
39
40
41
42
43
44
"""
seqtk \\
    mergepe \\
    $args \\
    ${reads} \\
    | gzip -n >> ${prefix}.fastq.gz

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    seqtk: \$(echo \$(seqtk 2>&1) | sed 's/^.*Version: //; s/ .*\$//')
END_VERSIONS
"""
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
"""
spades.py \\
    $args \\
    --threads $task.cpus \\
    --memory $maxmem \\
    $custom_hmms \\
    $reads \\
    -o ./
mv spades.log ${prefix}.spades.log

if [ -f scaffolds.fasta ]; then
    mv scaffolds.fasta ${prefix}.scaffolds.fa
    gzip -n ${prefix}.scaffolds.fa
fi
if [ -f contigs.fasta ]; then
    mv contigs.fasta ${prefix}.contigs.fa
    gzip -n ${prefix}.contigs.fa
fi
if [ -f transcripts.fasta ]; then
    mv transcripts.fasta ${prefix}.transcripts.fa
    gzip -n ${prefix}.transcripts.fa
fi
if [ -f assembly_graph_with_scaffolds.gfa ]; then
    mv assembly_graph_with_scaffolds.gfa ${prefix}.assembly.gfa
    gzip -n ${prefix}.assembly.gfa
fi

if [ -f gene_clusters.fasta ]; then
    mv gene_clusters.fasta ${prefix}.gene_clusters.fa
    gzip -n ${prefix}.gene_clusters.fa
fi

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    spades: \$(spades.py --version 2>&1 | sed 's/^.*SPAdes genome assembler v//; s/ .*\$//')
END_VERSIONS
"""
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
"""
featureCounts \\
    $args \\
    $paired_end \\
    -T $task.cpus \\
    -a $annotation \\
    -s $strandedness \\
    -o ${prefix}.featureCounts.txt \\
    ${bams.join(' ')}

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    subread: \$( echo \$(featureCounts -v 2>&1) | sed -e "s/featureCounts v//g")
END_VERSIONS
"""
28
29
30
31
32
33
34
35
36
37
38
39
"""
TransDecoder.LongOrfs \\
    $args \\
    -O $prefix \\
    -t \\
    $fasta

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    transdecoder: \$(echo \$(TransDecoder.LongOrfs --version) | sed -e "s/TransDecoder.LongOrfs //g")
END_VERSIONS
"""
28
29
30
31
32
33
34
35
36
37
38
39
"""
TransDecoder.Predict \\
    $args \\
    -O ${prefix} \\
    -t \\
    $fasta

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    transdecoder: \$(echo \$(TransDecoder.Predict --version) | sed -e "s/TransDecoder.Predict //g")
END_VERSIONS
"""
NextFlow From line 28 of predict/main.nf
42
43
44
45
46
47
48
49
50
51
52
53
54
55
"""
[ ! -f  ${prefix}.fastq.gz ] && ln -s $reads ${prefix}.fastq.gz
trim_galore \\
    ${args_list.join(' ')} \\
    --cores $cores \\
    --gzip \\
    ${prefix}.fastq.gz

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    trimgalore: \$(echo \$(trim_galore --version 2>&1) | sed 's/^.*version //; s/Last.*\$//')
    cutadapt: \$(cutadapt --version)
END_VERSIONS
"""
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
"""
[ ! -f  ${prefix}_1.fastq.gz ] && ln -s ${reads[0]} ${prefix}_1.fastq.gz
[ ! -f  ${prefix}_2.fastq.gz ] && ln -s ${reads[1]} ${prefix}_2.fastq.gz
trim_galore \\
    $args \\
    --cores $cores \\
    --paired \\
    --gzip \\
    ${prefix}_1.fastq.gz \\
    ${prefix}_2.fastq.gz

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    trimgalore: \$(echo \$(trim_galore --version 2>&1) | sed 's/^.*version //; s/Last.*\$//')
    cutadapt: \$(cutadapt --version)
END_VERSIONS
"""
33
34
35
36
37
38
39
40
41
"""
[ ! -f  ${prefix}.fastq.gz ] && ln -s $reads ${prefix}.fastq.gz
fastqc $options.args --threads $task.cpus ${prefix}.fastq.gz

cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
    ${getSoftwareName(task.process)}: \$( fastqc --version | sed -e "s/FastQC v//g" )
END_VERSIONS
"""
43
44
45
46
47
48
49
50
51
52
"""
[ ! -f  ${prefix}_1.fastq.gz ] && ln -s ${reads[0]} ${prefix}_1.fastq.gz
[ ! -f  ${prefix}_2.fastq.gz ] && ln -s ${reads[1]} ${prefix}_2.fastq.gz
fastqc $options.args --threads $task.cpus ${prefix}_1.fastq.gz ${prefix}_2.fastq.gz

cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
    ${getSoftwareName(task.process)}: \$( fastqc --version | sed -e "s/FastQC v//g" )
END_VERSIONS
"""
30
31
32
33
34
35
36
37
"""
multiqc -f $options.args .

cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
    ${getSoftwareName(task.process)}: \$( multiqc --version | sed -e "s/multiqc, version //g" )
END_VERSIONS
"""
ShowHide 33 more snippets with no or duplicated tags.

Login to post a comment if you would like to share your experience with this workflow.

Do you know this workflow well? If so, you can request seller status , and start supporting this workflow.

Free

Created: 1yr ago
Updated: 1yr ago
Maitainers: public
URL: https://nf-co.re/metatdenovo
Name: metatdenovo
Version: dev
Badge:
workflow icon

Insert copied code into your website to add a link to this workflow.

Downloaded: 0
Copyright: Public Domain
License: None
  • Future updates

Related Workflows

cellranger-snakemake-gke
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 ...