-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1d3eff9
commit 2a48e7f
Showing
3 changed files
with
83 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
subworkflows/local/generate_downstream_samplesheets/main.nf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// | ||
// Subworkflow with functionality specific to the nf-core/createtaxdb pipeline | ||
// | ||
|
||
workflow GENERATE_DOWNSTREAM_SAMPLESHEETS { | ||
take: | ||
ch_databases | ||
|
||
main: | ||
ch_header = Channel.empty() | ||
format = 'csv' // most common format in nf-core | ||
format_sep = ',' | ||
|
||
// TODO -- | ||
// Make your samplesheet channel construct here depending on your downstream | ||
// pipelines | ||
if ( params.downstream_pipeline == 'taxprofiler' ) { | ||
format = 'csv' | ||
format_sep = ',' | ||
ch_list_for_samplesheet = ch_databases | ||
.map { | ||
meta, db -> | ||
def tool = meta.tool | ||
def db_name = meta.id + '-' + meta.tool | ||
def db_params = "" | ||
def db_type = "" | ||
def db_path = file(params.outdir).getParent() + '/' + meta.tool + '/' + db.getName() | ||
[ tool: tool, db_name: db_name, db_params: db_params, db_type: db_type, db_path: db_path ] | ||
} | ||
.tap{ ch_header } | ||
} | ||
// -- FINISH TODO | ||
|
||
// Constructs the header string and then the strings of each row, and | ||
// finally concatenates for saving. | ||
ch_header | ||
.first() | ||
.map{ it.keySet().join(format_sep) } | ||
.concat( ch_list_for_samplesheet.map{ it.values().join(format_sep) }) | ||
.collectFile( | ||
name:"${params.outdir}/downstream_samplesheet/${params.downstream_pipeline}.${format}", | ||
newLine: true, | ||
sort: false | ||
) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters