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

Workflow output DSL (channel selectors) #302

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ workflow NFCORE_FETCHNGS {
//
SRA ( ids )

emit:
runinfo_tsv = SRA.out.runinfo_tsv
fastq = SRA.out.fastq
fastq_md5 = SRA.out.fastq_md5
samplesheet = SRA.out.samplesheet
mappings = SRA.out.mappings
sample_mappings = SRA.out.sample_mappings
sra_metadata = SRA.out.sra_metadata

}

/*
Expand Down Expand Up @@ -81,6 +90,28 @@ workflow {
params.monochrome_logs,
params.hook_url
)

output:
path(params.outdir, mode: params.publish_dir_mode) {
path('fastq') {
select NFCORE_FETCHNGS.out.fastq
}

path('fastq/md5') {
select NFCORE_FETCHNGS.out.fastq_md5
}

path('metadata') {
select NFCORE_FETCHNGS.out.runinfo_tsv
}

path('samplesheet') {
select NFCORE_FETCHNGS.out.samplesheet, schema: 'assets/schema_samplesheet.yml'
select NFCORE_FETCHNGS.out.mappings, schema: 'assets/schema_mappings.yml'
select NFCORE_FETCHNGS.out.sample_mappings
}
}

}

/*
Expand Down
27 changes: 25 additions & 2 deletions workflows/sra/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ workflow SRA {
SRA_RUNINFO_TO_FTP
.out
.tsv
.tap { ch_runinfo_tsv }
.splitCsv(header:true, sep:'\t')
.map {
meta ->
Expand Down Expand Up @@ -123,6 +124,13 @@ workflow SRA {
.fastq
.mix(SRA_FASTQ_FTP.out.fastq)
.mix(FASTQ_DOWNLOAD_PREFETCH_FASTERQDUMP_SRATOOLS.out.reads)
.set { ch_fastq_records }

ch_fastq_records
.flatMap { meta, fastq -> fastq }
.set { ch_fastq }

ch_fastq_records
.map {
meta, fastq ->
def reads = fastq instanceof List ? fastq.flatten() : [ fastq ]
Expand All @@ -134,6 +142,18 @@ workflow SRA {
return meta_clone
}
.set { ch_sra_metadata }

// Isolate MD5 channel which will be added to emit block
ASPERA_CLI
.out
.md5
.mix(SRA_FASTQ_FTP.out.md5)
.flatMap { meta, md5 -> md5 }
.set { ch_fastq_md5 }
}
else {
ch_fastq = Channel.empty()
ch_fastq_md5 = Channel.empty()
}

//
Expand All @@ -153,7 +173,7 @@ workflow SRA {
.map { it[1] }
.collectFile(name:'tmp_samplesheet.csv', newLine: true, keepHeader: true, sort: { it.baseName })
.map { it.text.tokenize('\n').join('\n') }
.collectFile(name:'samplesheet.csv', storeDir: "${params.outdir}/samplesheet")
.collectFile(name:'samplesheet.csv')
.set { ch_samplesheet }

SRA_TO_SAMPLESHEET
Expand All @@ -162,7 +182,7 @@ workflow SRA {
.map { it[1] }
.collectFile(name:'tmp_id_mappings.csv', newLine: true, keepHeader: true, sort: { it.baseName })
.map { it.text.tokenize('\n').join('\n') }
.collectFile(name:'id_mappings.csv', storeDir: "${params.outdir}/samplesheet")
.collectFile(name:'id_mappings.csv')
.set { ch_mappings }

//
Expand All @@ -184,6 +204,9 @@ workflow SRA {
.collectFile(storeDir: "${params.outdir}/pipeline_info", name: 'nf_core_fetchngs_software_mqc_versions.yml', sort: true, newLine: true)

emit:
runinfo_tsv = ch_runinfo_tsv
fastq = ch_fastq
fastq_md5 = ch_fastq_md5
samplesheet = ch_samplesheet
mappings = ch_mappings
sample_mappings = ch_sample_mappings_yml
Expand Down
Loading