Publish refs for IGV only when necessary [CW-7280]
This commit is contained in:
parent
d73b9a2721
commit
262f49944e
42
main.nf
42
main.nf
@ -293,28 +293,31 @@ workflow {
|
|||||||
pipeline_run = wf(processed_samples, sample_sheet, ref_genome, ref_annotation)
|
pipeline_run = wf(processed_samples, sample_sheet, ref_genome, ref_annotation)
|
||||||
results = pipeline_run.results
|
results = pipeline_run.results
|
||||||
|
|
||||||
reference_basename = file(params.ref_genome).getName()
|
|
||||||
if (params.igv) {
|
if (params.igv) {
|
||||||
results = results
|
// TODO lib/ref should be responsible for writing NEW outputs to a location of our choosing
|
||||||
.concat(ref_genome.map { fasta, faidx -> [fasta, "igv_reference"] })
|
// until then, we'll handle emission here. we'll emit (path:str, to_publish:bool) tuples for ref-related files
|
||||||
.concat(ref_genome.map { fasta, faidx -> [faidx, "igv_reference"] })
|
// and pass those to both igv_ref_paths and results (for publishing)
|
||||||
|
|
||||||
is_compressed = params.ref_genome.toLowerCase().endsWith("gz")
|
is_compressed = params.ref_genome.toLowerCase().endsWith("gz")
|
||||||
|
|
||||||
if (is_compressed) {
|
if (is_compressed) {
|
||||||
// ref files are directly publish into output
|
ref_files = prepared_reference.ref_gzidx | flatten | map {
|
||||||
igv_files = Channel.of("${reference_basename}")
|
boolean to_publish = it.toString().startsWith("${workflow.workDir}")
|
||||||
igv_index_paths = prepared_reference.ref_gzidx.map {
|
[it, to_publish]
|
||||||
fasta, faidx, gzidx -> "${faidx.getName()}"
|
}
|
||||||
}
|
|
||||||
.concat(prepared_reference.ref_gzidx.map {
|
|
||||||
fasta, faidx, gzidx -> "${gzidx.getName()}"
|
|
||||||
})
|
|
||||||
} else {
|
} else {
|
||||||
igv_files = Channel.of("igv_reference/${reference_basename}")
|
ref_files = ref_genome | flatten | map {
|
||||||
igv_index_paths = ref_genome.map { fasta, faidx -> "igv_reference/${faidx.getName()}"}
|
boolean to_publish = it.toString().startsWith("${workflow.workDir}")
|
||||||
|
[it, to_publish]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// convert files set to_publish to their IGV location
|
||||||
|
igv_ref_paths = ref_files.map {
|
||||||
|
path, to_publish -> to_publish ? "reference/${path.getName()}" : path.toString()
|
||||||
|
}
|
||||||
|
publish_ref_paths = ref_files
|
||||||
|
.filter { it[1] } // select files set to_publish
|
||||||
|
.map { [ it[0], "reference" ] }
|
||||||
|
|
||||||
igv_alignment_paths = processed_samples
|
igv_alignment_paths = processed_samples
|
||||||
.map { meta, bam, bai, stat -> [
|
.map { meta, bam, bai, stat -> [
|
||||||
meta.src_xam ?: "${meta.alias},samples/${meta.alias}/alignment/reads.bam",
|
meta.src_xam ?: "${meta.alias},samples/${meta.alias}/alignment/reads.bam",
|
||||||
@ -330,8 +333,7 @@ workflow {
|
|||||||
(paths instanceof List ? paths : [paths]).collect { path -> "${alias},samples/${alias}/mods/${path.name}" }
|
(paths instanceof List ? paths : [paths]).collect { path -> "${alias},samples/${alias}/mods/${path.name}" }
|
||||||
}
|
}
|
||||||
|
|
||||||
igv_files = igv_files
|
igv_files = igv_ref_paths
|
||||||
.concat(igv_index_paths)
|
|
||||||
.concat(igv_alignment_paths)
|
.concat(igv_alignment_paths)
|
||||||
.concat(igv_bigwigs)
|
.concat(igv_bigwigs)
|
||||||
.collectFile(name: "igv-files.txt", newLine: true, sort: false)
|
.collectFile(name: "igv-files.txt", newLine: true, sort: false)
|
||||||
@ -343,7 +345,9 @@ workflow {
|
|||||||
[:],
|
[:],
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
results = results.concat(igv_conf.map { [it, null] })
|
results = results
|
||||||
|
.concat(publish_ref_paths)
|
||||||
|
.concat(igv_conf.map { [it, null] })
|
||||||
}
|
}
|
||||||
publishResults(results)
|
publishResults(results)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user