1
0
Fork 0
mirror of https://github.com/MillironX/taxprofiler.git synced 2024-11-22 16:49:56 +00:00

Merge pull request #60 from nf-core/fasta-filtering

Adds filtering out of FASTA for tools that don't support it
This commit is contained in:
James A. Fellows Yates 2022-04-20 10:11:17 +02:00 committed by GitHub
commit 571495c812
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 10 deletions

View file

@ -45,6 +45,7 @@ def create_fastq_channel(LinkedHashMap row) {
meta.run_accession = row.run_accession meta.run_accession = row.run_accession
meta.instrument_platform = row.instrument_platform meta.instrument_platform = row.instrument_platform
meta.single_end = row.single_end.toBoolean() meta.single_end = row.single_end.toBoolean()
meta.is_fasta = false
// add path(s) of the fastq file(s) to the meta map // add path(s) of the fastq file(s) to the meta map
def fastq_meta = [] def fastq_meta = []
@ -75,6 +76,7 @@ def create_fasta_channel(LinkedHashMap row) {
meta.run_accession = row.run_accession meta.run_accession = row.run_accession
meta.instrument_platform = row.instrument_platform meta.instrument_platform = row.instrument_platform
meta.single_end = true meta.single_end = true
meta.is_fasta = true
def array = [] def array = []
if (!file(row.fasta).exists()) { if (!file(row.fasta).exists()) {

View file

@ -77,6 +77,10 @@ workflow PROFILING {
} }
ch_input_for_centrifuge = ch_input_for_profiling.centrifuge ch_input_for_centrifuge = ch_input_for_profiling.centrifuge
.filter{
if (it[0].is_fasta) log.warn "[nf-core/taxprofiler] Centrifuge currently does not accept FASTA files as input. Skipping Centrifuge for sample ${it[0].id}."
!it[0].is_fasta
}
.multiMap { .multiMap {
it -> it ->
reads: [ it[0] + it[2], it[1] ] reads: [ it[0] + it[2], it[1] ]
@ -84,6 +88,10 @@ workflow PROFILING {
} }
ch_input_for_metaphlan3 = ch_input_for_profiling.metaphlan3 ch_input_for_metaphlan3 = ch_input_for_profiling.metaphlan3
.filter{
if (it[0].is_fasta) log.warn "[nf-core/taxprofiler] MetaPhlAn3 currently does not accept FASTA files as input. Skipping MetaPhlAn3 for sample ${it[0].id}."
!it[0].is_fasta
}
.multiMap { .multiMap {
it -> it ->
reads: [it[0] + it[2], it[1]] reads: [it[0] + it[2], it[1]]

View file

@ -19,11 +19,11 @@ for (param in checkPathParamList) { if (param) { file(param, checkIfExists: true
// Check mandatory parameters // Check mandatory parameters
if (params.input ) { ch_input = file(params.input) } else { exit 1, 'Input samplesheet not specified!' } if (params.input ) { ch_input = file(params.input) } else { exit 1, 'Input samplesheet not specified!' }
if (params.databases) { ch_databases = file(params.databases) } else { exit 1, 'Input database sheet not specified!' } if (params.databases) { ch_databases = file(params.databases) } else { exit 1, 'Input database sheet not specified!' }
if (params.shortread_clipmerge_mergepairs && params.run_malt ) log.warn "[nf-core/taxprofiler] warning: MALT does not accept uncollapsed paired-reads. Pairs will be profiled as separate files." if (params.shortread_clipmerge_mergepairs && params.run_malt ) log.warn "[nf-core/taxprofiler] MALT does not accept uncollapsed paired-reads. Pairs will be profiled as separate files."
if (params.shortread_clipmerge_excludeunmerged && !params.shortread_clipmerge_mergepairs) exit 1, "[nf-core/taxprofiler] error: cannot include unmerged reads when merging not turned on. Please specify --shortread_clipmerge_mergepairs" if (params.shortread_clipmerge_excludeunmerged && !params.shortread_clipmerge_mergepairs) exit 1, "ERROR: [nf-core/taxprofiler] cannot include unmerged reads when merging not turned on. Please specify --shortread_clipmerge_mergepairs"
if (params.perform_shortread_hostremoval && !params.shortread_hostremoval_reference) { exit 1, "[nf-core/taxprofiler] error: --shortread_hostremoval requested but no --shortread_hostremoval_reference FASTA supplied. Check input." } if (params.perform_shortread_hostremoval && !params.shortread_hostremoval_reference) { exit 1, "ERROR: [nf-core/taxprofiler] --shortread_hostremoval requested but no --shortread_hostremoval_reference FASTA supplied. Check input." }
if (!params.shortread_hostremoval_reference && params.shortread_hostremoval_reference_index) { exit 1, "[nf-core/taxprofiler] error: --shortread_hostremoval_index provided but no --shortread_hostremoval_reference FASTA supplied. Check input." } if (!params.shortread_hostremoval_reference && params.shortread_hostremoval_reference_index) { exit 1, "ERROR: [nf-core/taxprofiler] --shortread_hostremoval_index provided but no --shortread_hostremoval_reference FASTA supplied. Check input." }
if (params.shortread_hostremoval_reference ) { ch_reference = file(params.shortread_hostremoval_reference) } if (params.shortread_hostremoval_reference ) { ch_reference = file(params.shortread_hostremoval_reference) }
if (params.shortread_hostremoval_index ) { ch_reference_index = file(params.shortread_hostremoval_index ) } else { ch_reference_index = [] } if (params.shortread_hostremoval_index ) { ch_reference_index = file(params.shortread_hostremoval_index ) } else { ch_reference_index = [] }
@ -175,10 +175,11 @@ workflow TAXPROFILER {
meta, reads -> meta, reads ->
[ meta, [ reads ].flatten() ] [ meta, [ reads ].flatten() ]
} }
.mix( INPUT_CHECK.out.fasta )
} else { } else {
ch_reads_runmerged = ch_shortreads_hostremoved ch_reads_runmerged = ch_shortreads_hostremoved
.mix( ch_longreads_preprocessed ) .mix( ch_longreads_preprocessed, INPUT_CHECK.out.fasta )
} }
/* /*