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

add more comments and slight style changes

This commit is contained in:
Moritz E. Beber 2023-03-07 14:57:53 +01:00
parent 5380bc18ec
commit 7c1133efb8
4 changed files with 30 additions and 27 deletions

View file

@ -45,6 +45,8 @@ workflow LONGREAD_HOSTREMOVAL {
SAMTOOLS_INDEX ( MINIMAP2_ALIGN.out.bam )
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
.join(SAMTOOLS_INDEX.out.bai)

View file

@ -35,10 +35,7 @@ workflow PROFILING {
ch_input_for_profiling = reads
.map {
meta, reads ->
def meta_new = meta.clone()
pairtype = meta_new['single_end'] ? '_se' : '_pe'
meta_new['id'] = meta_new['id'] + pairtype
[meta_new, reads]
[meta + [id: "${meta.id}${meta.single_end ? '_se' : '_pe'}"], reads]
}
.combine(databases)
.branch {
@ -68,34 +65,35 @@ workflow PROFILING {
// 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
ch_input_for_malt = ch_input_for_profiling.malt
.map {
meta, reads, db_meta, db ->
.map {
meta, reads, db_meta, db ->
// 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
// so all samples are in one run and so sample-specific metadata
// unnecessary. Set as database name to prevent `null` job ID and prefix.
def temp_meta = [ id: meta['db_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
// so all samples are in one run and so sample-specific metadata
// unnecessary. Set as database name to prevent `null` job ID and prefix.
def temp_meta = [ id: meta['db_name'] ]
// Extend database parameters to specify whether to save alignments or not
def new_db_meta = db_meta.clone()
def sam_format = params.malt_save_reads ? ' --alignments ./ -za false' : ""
new_db_meta['db_params'] = db_meta['db_params'] + sam_format
// Extend database parameters to specify whether to save alignments or not
def new_db_meta = db_meta.clone()
def sam_format = params.malt_save_reads ? ' --alignments ./ -za false' : ""
new_db_meta['db_params'] = db_meta['db_params'] + sam_format
// Combine reduced sample metadata with updated database parameters metadata,
// make sure id is db_name for publishing purposes.
def new_meta = temp_meta + new_db_meta
new_meta['id'] = new_meta['db_name']
// Combine reduced sample metadata with updated database parameters metadata,
// make sure id is db_name for publishing purposes.
def new_meta = temp_meta + new_db_meta
new_meta['id'] = new_meta['db_name']
[ new_meta, reads, db ]
[ new_meta, reads, db ]
}
.groupTuple(by: [0,2])
.multiMap {
it ->
reads: [ it[0], it[1].flatten() ]
db: it[2]
}
}
// FIXME: Groups elements in the channel using the meta map as key. Replace with grouping on specific keys.
.groupTuple(by: [0,2])
.multiMap {
meta, reads, db ->
reads: [ meta, reads.flatten() ]
db: db
}
MALT_RUN ( ch_input_for_malt.reads, ch_input_for_malt.db )
@ -323,6 +321,7 @@ workflow PROFILING {
meta, 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])
.multiMap {
single_meta, reads, db_meta, db ->

View file

@ -30,6 +30,7 @@ workflow STANDARDISATION_PROFILES {
meta_new.tool = meta.tool == 'metaphlan3' ? 'metaphlan' : meta.tool == 'malt' ? 'megan6' : meta.tool
[meta_new, profile]
}
// FIXME: Groups elements in the channel using the meta map as key. Replace with grouping on specific keys.
.groupTuple ()
.map { [ it[0], it[1].flatten() ] }

View file

@ -197,6 +197,7 @@ workflow TAXPROFILER {
meta_new.remove('run_accession')
[ meta_new, reads ]
}
// FIXME: Groups elements in the channel using the meta map as key. Replace with grouping on specific keys.
.groupTuple()
.map {
meta, reads ->