mirror of
https://github.com/MillironX/taxprofiler.git
synced 2024-11-10 23:03:10 +00:00
add more comments and slight style changes
This commit is contained in:
parent
5380bc18ec
commit
7c1133efb8
4 changed files with 30 additions and 27 deletions
|
@ -45,6 +45,8 @@ workflow LONGREAD_HOSTREMOVAL {
|
||||||
SAMTOOLS_INDEX ( MINIMAP2_ALIGN.out.bam )
|
SAMTOOLS_INDEX ( MINIMAP2_ALIGN.out.bam )
|
||||||
ch_versions = ch_versions.mix( SAMTOOLS_INDEX.out.versions.first() )
|
ch_versions = ch_versions.mix( SAMTOOLS_INDEX.out.versions.first() )
|
||||||
|
|
||||||
|
// FIXME: This join is performed using entire maps as keys.
|
||||||
|
// Please replace with joining on specific keys instead.
|
||||||
bam_bai = MINIMAP2_ALIGN.out.bam
|
bam_bai = MINIMAP2_ALIGN.out.bam
|
||||||
.join(SAMTOOLS_INDEX.out.bai)
|
.join(SAMTOOLS_INDEX.out.bai)
|
||||||
|
|
||||||
|
|
|
@ -35,10 +35,7 @@ workflow PROFILING {
|
||||||
ch_input_for_profiling = reads
|
ch_input_for_profiling = reads
|
||||||
.map {
|
.map {
|
||||||
meta, reads ->
|
meta, reads ->
|
||||||
def meta_new = meta.clone()
|
[meta + [id: "${meta.id}${meta.single_end ? '_se' : '_pe'}"], reads]
|
||||||
pairtype = meta_new['single_end'] ? '_se' : '_pe'
|
|
||||||
meta_new['id'] = meta_new['id'] + pairtype
|
|
||||||
[meta_new, reads]
|
|
||||||
}
|
}
|
||||||
.combine(databases)
|
.combine(databases)
|
||||||
.branch {
|
.branch {
|
||||||
|
@ -68,34 +65,35 @@ workflow PROFILING {
|
||||||
// MALT: We groupTuple to have all samples in one channel for MALT as database
|
// MALT: We groupTuple to have all samples in one channel for MALT as database
|
||||||
// loading takes a long time, so we only want to run it once per database
|
// loading takes a long time, so we only want to run it once per database
|
||||||
ch_input_for_malt = ch_input_for_profiling.malt
|
ch_input_for_malt = ch_input_for_profiling.malt
|
||||||
.map {
|
.map {
|
||||||
meta, reads, db_meta, db ->
|
meta, reads, db_meta, db ->
|
||||||
|
|
||||||
// Reset entire input meta for MALT to just database name,
|
// Reset entire input meta for MALT to just database name,
|
||||||
// as we don't run run on a per-sample basis due to huge datbaases
|
// as we don't run run on a per-sample basis due to huge datbaases
|
||||||
// so all samples are in one run and so sample-specific metadata
|
// so all samples are in one run and so sample-specific metadata
|
||||||
// unnecessary. Set as database name to prevent `null` job ID and prefix.
|
// unnecessary. Set as database name to prevent `null` job ID and prefix.
|
||||||
def temp_meta = [ id: meta['db_name'] ]
|
def temp_meta = [ id: meta['db_name'] ]
|
||||||
|
|
||||||
// Extend database parameters to specify whether to save alignments or not
|
// Extend database parameters to specify whether to save alignments or not
|
||||||
def new_db_meta = db_meta.clone()
|
def new_db_meta = db_meta.clone()
|
||||||
def sam_format = params.malt_save_reads ? ' --alignments ./ -za false' : ""
|
def sam_format = params.malt_save_reads ? ' --alignments ./ -za false' : ""
|
||||||
new_db_meta['db_params'] = db_meta['db_params'] + sam_format
|
new_db_meta['db_params'] = db_meta['db_params'] + sam_format
|
||||||
|
|
||||||
// Combine reduced sample metadata with updated database parameters metadata,
|
// Combine reduced sample metadata with updated database parameters metadata,
|
||||||
// make sure id is db_name for publishing purposes.
|
// make sure id is db_name for publishing purposes.
|
||||||
def new_meta = temp_meta + new_db_meta
|
def new_meta = temp_meta + new_db_meta
|
||||||
new_meta['id'] = new_meta['db_name']
|
new_meta['id'] = new_meta['db_name']
|
||||||
|
|
||||||
[ new_meta, reads, db ]
|
[ new_meta, reads, db ]
|
||||||
|
|
||||||
}
|
}
|
||||||
.groupTuple(by: [0,2])
|
// FIXME: Groups elements in the channel using the meta map as key. Replace with grouping on specific keys.
|
||||||
.multiMap {
|
.groupTuple(by: [0,2])
|
||||||
it ->
|
.multiMap {
|
||||||
reads: [ it[0], it[1].flatten() ]
|
meta, reads, db ->
|
||||||
db: it[2]
|
reads: [ meta, reads.flatten() ]
|
||||||
}
|
db: db
|
||||||
|
}
|
||||||
|
|
||||||
MALT_RUN ( ch_input_for_malt.reads, ch_input_for_malt.db )
|
MALT_RUN ( ch_input_for_malt.reads, ch_input_for_malt.db )
|
||||||
|
|
||||||
|
@ -323,6 +321,7 @@ workflow PROFILING {
|
||||||
meta, reads, db_meta, db ->
|
meta, reads, db_meta, db ->
|
||||||
[[id: db_meta.db_name, single_end: meta.single_end], reads, db_meta, db]
|
[[id: db_meta.db_name, single_end: meta.single_end], reads, db_meta, db]
|
||||||
}
|
}
|
||||||
|
// FIXME: Groups elements in the channel using the meta map as key. Replace with grouping on specific keys.
|
||||||
.groupTuple(by: [0,2,3])
|
.groupTuple(by: [0,2,3])
|
||||||
.multiMap {
|
.multiMap {
|
||||||
single_meta, reads, db_meta, db ->
|
single_meta, reads, db_meta, db ->
|
||||||
|
|
|
@ -30,6 +30,7 @@ workflow STANDARDISATION_PROFILES {
|
||||||
meta_new.tool = meta.tool == 'metaphlan3' ? 'metaphlan' : meta.tool == 'malt' ? 'megan6' : meta.tool
|
meta_new.tool = meta.tool == 'metaphlan3' ? 'metaphlan' : meta.tool == 'malt' ? 'megan6' : meta.tool
|
||||||
[meta_new, profile]
|
[meta_new, profile]
|
||||||
}
|
}
|
||||||
|
// FIXME: Groups elements in the channel using the meta map as key. Replace with grouping on specific keys.
|
||||||
.groupTuple ()
|
.groupTuple ()
|
||||||
.map { [ it[0], it[1].flatten() ] }
|
.map { [ it[0], it[1].flatten() ] }
|
||||||
|
|
||||||
|
|
|
@ -197,6 +197,7 @@ workflow TAXPROFILER {
|
||||||
meta_new.remove('run_accession')
|
meta_new.remove('run_accession')
|
||||||
[ meta_new, reads ]
|
[ meta_new, reads ]
|
||||||
}
|
}
|
||||||
|
// FIXME: Groups elements in the channel using the meta map as key. Replace with grouping on specific keys.
|
||||||
.groupTuple()
|
.groupTuple()
|
||||||
.map {
|
.map {
|
||||||
meta, reads ->
|
meta, reads ->
|
||||||
|
|
Loading…
Reference in a new issue