Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make addSpecies optional also when using cut_its #372

Merged
merged 5 commits into from Jan 26, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### `Added`

* [#](https://github.com/nf-core/ampliseq/pull/) - Make `--skip_dada_addspecies` compatible with `--cut_its`
* [#352](https://github.com/nf-core/ampliseq/pull/352) - `--skip_dada_addspecies` allows to skip species level classification to reduce memory requirements, incompatible with `--sbdiexport` and `--cut_its` that expect species annotation
jtangrot marked this conversation as resolved.
Show resolved Hide resolved
* [#354](https://github.com/nf-core/ampliseq/pull/354) - Input files and files after primer trimming with cutadapt are required to be >1KB (i.e. not empty) and either the pipeline will stop if at least one sample file fails or the failing samples will be ignored when using `--ignore_empty_input_files` or `--ignore_failed_trimming`, respectively.
* [#364](https://github.com/nf-core/ampliseq/pull/364) - Adonis in QIIME2 for testing feature importance in beta diversity distances, `--qiime_adonis_formula` can be set to provide a custom formula.
Expand Down
4 changes: 0 additions & 4 deletions lib/WorkflowAmpliseq.groovy
Expand Up @@ -38,10 +38,6 @@ class WorkflowAmpliseq {
System.exit(1)
}

if (params.skip_dada_addspecies && params.cut_its) {
log.error "Incompatible parameters: `--cut_its` expects species annotation and therefore excludes `--skip_dada_addspecies`."
System.exit(1)
}
}

//
Expand Down
6 changes: 2 additions & 4 deletions modules/local/format_taxresults.nf
Expand Up @@ -8,16 +8,14 @@ process FORMAT_TAXRESULTS {

input:
path(taxtable)
path(taxtable_species)
path(fastafile)
val(outfile)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be sort of more obvious and functional when

outfile = taxfile.replace("ASV_ITS_", "ASV_")
# Join taxonomy and full sequence, write to file
tax = tax.set_index('ASV_ID').join(seqs.set_index('id'), how='outer')
tax.to_csv(outfile, sep='\t',na_rep="", index_label="ASV_ID")

would actually use the value coming in here I think. But it works the way you are doing it right now I guess.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works, but you are right. Thanks for the suggestion!


output:
path("ASV_tax.tsv")
path("ASV_tax_species.tsv"), emit: tsv
path(outfile), emit: tsv

script:
"""
add_full_sequence_to_taxfile.py $taxtable $fastafile
add_full_sequence_to_taxfile.py $taxtable_species $fastafile
"""
}
2 changes: 1 addition & 1 deletion nextflow_schema.json
Expand Up @@ -342,7 +342,7 @@
},
"skip_dada_addspecies": {
"type": "boolean",
"description": "Skip species level when using DADA2 for taxonomic classification, that reduces required memory dramatically under certain conditions. Incompatible with `--sbdiexport` and `--cut_its`"
"description": "Skip species level when using DADA2 for taxonomic classification, that reduces required memory dramatically under certain conditions. Incompatible with `--sbdiexport`"
},
"skip_barplot": {
"type": "boolean",
Expand Down
12 changes: 9 additions & 3 deletions workflows/ampliseq.nf
Expand Up @@ -97,6 +97,7 @@ include { MERGE_STATS } from '../modules/local/merge_stats'
include { DADA2_TAXONOMY } from '../modules/local/dada2_taxonomy'
include { DADA2_ADDSPECIES } from '../modules/local/dada2_addspecies'
include { FORMAT_TAXRESULTS } from '../modules/local/format_taxresults'
include { FORMAT_TAXRESULTS as FORMAT_TAXRESULTS_ADDSP } from '../modules/local/format_taxresults'
jtangrot marked this conversation as resolved.
Show resolved Hide resolved
include { QIIME2_INSEQ } from '../modules/local/qiime2_inseq'
include { QIIME2_FILTERTAXA } from '../modules/local/qiime2_filtertaxa'
include { QIIME2_INASV } from '../modules/local/qiime2_inasv'
Expand Down Expand Up @@ -328,9 +329,14 @@ workflow AMPLISEQ {
ch_versions = ch_versions.mix(ITSX_CUTASV.out.versions.ifEmpty(null))
ch_cut_fasta = ITSX_CUTASV.out.fasta
DADA2_TAXONOMY ( ch_cut_fasta, ch_assigntax, 'ASV_ITS_tax.tsv' )
DADA2_ADDSPECIES ( DADA2_TAXONOMY.out.rds, ch_addspecies, 'ASV_ITS_tax_species.tsv' )
FORMAT_TAXRESULTS ( DADA2_TAXONOMY.out.tsv, DADA2_ADDSPECIES.out.tsv, ch_fasta )
ch_dada2_tax = FORMAT_TAXRESULTS.out.tsv
FORMAT_TAXRESULTS ( DADA2_TAXONOMY.out.tsv, ch_fasta, 'ASV_tax.tsv' )
if (!params.skip_dada_addspecies) {
DADA2_ADDSPECIES ( DADA2_TAXONOMY.out.rds, ch_addspecies, 'ASV_ITS_tax_species.tsv' )
FORMAT_TAXRESULTS_ADDSP ( DADA2_ADDSPECIES.out.tsv, ch_fasta, 'ASV_tax_species.tsv' )
ch_dada2_tax = FORMAT_TAXRESULTS_ADDSP.out.tsv
} else {
ch_dada2_tax = FORMAT_TAXRESULTS.out.tsv
}
}
}

Expand Down