Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

### `Fixed`
* [#172](https://github.com/nf-core/eager/pull/152) - DamageProfiler errors [won't crash entire pipeline anymore](https://github.com/nf-core/eager/issues/171)
* [#174](https://github.com/nf-core/eager/pull/190) - Publish DeDup files [properly](https://github.com/nf-core/eager/issues/183)
* [#174](https://github.com/nf-core/eager/pull/190) - Publish DeDup files [properly](https://github.com/nf-core/eager/issues/183)
* TBF - Fix reference [issues](https://github.com/nf-core/eager/issues/150)

### `Dependencies`

Expand Down
61 changes: 22 additions & 39 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -226,36 +226,30 @@ params.strip_input_fastq = false
params.strip_mode = 'strip'


ch_multiqc_config = Channel.fromPath(params.multiqc_config)
ch_output_docs = Channel.fromPath("$baseDir/docs/output.md")
Channel.fromPath("$baseDir/assets/where_are_my_files.txt")
.into{ ch_where_for_bwa_index; ch_where_for_fasta_index; ch_where_for_seqdict}

multiqc_config = file(params.multiqc_config)
output_docs = file("$baseDir/docs/output.md")
where_are_my_files = file("$baseDir/assets/where_are_my_files.txt")
// Validate inputs
if("${params.fasta}".endsWith(".gz")){
//Put the zip into a channel, then unzip it and forward to downstream processes. DONT unzip in all steps, this is inefficient as NXF links the files anyways from work to work dir
Channel.fromPath("${params.fasta}")
.ifEmpty { exit 1, "No genome specified! Please specify one with --fasta"}
.set {ch_unzip_fasta}
zipped_fasta = file("${params.fasta}")

process unzip_reference{
tag "$zipfasta"

input:
file zipfasta from ch_unzip_fasta
file zipped_fasta

output:
file "*.fasta" into (ch_fasta_for_bwa_indexing, ch_fasta_for_faidx_indexing, ch_fasta_for_dict_indexing, ch_fasta_for_damageprofiler, ch_fasta_for_qualimap, ch_fasta_for_pmdtools, ch_fasta_for_circularmapper_index)
file "*.fasta" into fasta_for_indexing

script:
"""
pigz -f -d -p ${task.cpus} $zipfasta
"""
}
} else {
Channel.fromPath("${params.fasta}")
.ifEmpty { exit 1, "No genome specified! Please specify one with --fasta"}
.into {ch_fasta_for_bwa_indexing;ch_fasta_for_faidx_indexing;ch_fasta_for_dict_indexing; ch_fasta_for_damageprofiler; ch_fasta_for_qualimap; ch_fasta_for_pmdtools; ch_fasta_for_circularmapper_index}
fasta_for_indexing = file("${params.fasta}")
}

//Index files provided? Then check whether they are correct and complete
Expand All @@ -280,12 +274,6 @@ if (params.skip_collapse && params.singleEnd){
exit 1, "--skip_collapse can only be set for pairedEnd samples!"
}

//AWSBatch sanity checking
if(workflow.profile == 'awsbatch'){
if (!params.awsqueue || !params.awsregion) exit 1, "Specify correct --awsqueue and --awsregion parameters on AWSBatch!"
if (!workflow.workDir.startsWith('s3') || !params.outdir.startsWith('s3')) exit 1, "Specify S3 URLs for workDir and outdir parameters on AWSBatch!"
}

//Strip mode sanity checking
if (params.strip_input_fastq){
if (!(['strip','replace'].contains(params.strip_mode))) {
Expand All @@ -311,11 +299,6 @@ if( workflow.profile == 'awsbatch') {
// Prevent trace files to be stored on S3 since S3 does not support rolling files.
if (workflow.tracedir.startsWith('s3:')) exit 1, "Specify a local tracedir or run without trace! S3 cannot be used for tracefiles."
}

// Stage config files
ch_multiqc_config = Channel.fromPath(params.multiqc_config)
ch_output_docs = Channel.fromPath("$baseDir/docs/output.md")

/*
* Create a channel for input read files
* Dump can be used for debugging purposes, e.g. using the -dump-channels operator on run
Expand Down Expand Up @@ -458,8 +441,8 @@ process makeBWAIndex {
when: !params.bwa_index && params.fasta && (params.aligner == 'bwa' || params.bwamem)

input:
file fasta from ch_fasta_for_bwa_indexing
file wherearemyfiles from ch_where_for_bwa_index
file fasta from fasta_for_indexing
file where_are_my_files

output:
file "bwa_index" into (ch_bwa_index,ch_bwa_index_bwamem)
Expand Down Expand Up @@ -491,8 +474,8 @@ process makeFastaIndex {
when: !params.fasta_index && params.fasta && params.aligner == 'bwa'

input:
file fasta from ch_fasta_for_faidx_indexing
file wherearemyfiles from ch_where_for_fasta_index
file fasta from fasta_for_indexing
file where_are_my_files

output:
file "faidx/${base}.fasta.fai" into ch_fasta_faidx_index
Expand Down Expand Up @@ -525,8 +508,8 @@ process makeSeqDict {
when: !params.seq_dict && params.fasta

input:
file fasta from ch_fasta_for_dict_indexing
file wherearemyfiles from ch_where_for_seqdict
file fasta from fasta_for_indexing
file where_are_my_files

output:
file "seq_dict/*.dict" into ch_seq_dict
Expand Down Expand Up @@ -723,7 +706,7 @@ process bwa {
input:
set val(name), file(reads) from ch_clipped_reads.mix(ch_read_files_converted_mapping_bwa)

file index from ch_bwa_index.first()
file index from ch_bwa_index


output:
Expand Down Expand Up @@ -767,7 +750,7 @@ process circulargenerator{
when: params.circularmapper

input:
file fasta from ch_fasta_for_circularmapper_index
file fasta from fasta_for_indexing

output:
file "cm_index" into ch_circularmapper_indices
Expand All @@ -793,7 +776,7 @@ process circularmapper{

input:
set val(name), file(reads) from ch_clipped_reads_circularmapper.mix(ch_read_files_converted_mapping_cm)
file index from ch_circularmapper_indices.first()
file index from ch_circularmapper_indices

output:
file "*.sorted.bam" into ch_mapped_reads_idxstats_cm,ch_mapped_reads_filter_cm,ch_mapped_reads_preseq_cm, ch_mapped_reads_damageprofiler_cm, ch_circular_mapped_reads_strip
Expand Down Expand Up @@ -836,7 +819,7 @@ process bwamem {

input:
set val(name), file(reads) from ch_clipped_reads_bwamem.mix(ch_read_files_converted_mapping_bwamem)
file index from ch_bwa_index_bwamem.first()
file index from ch_bwa_index_bwamem

output:
file "*.sorted.bam" into ch_bwamem_mapped_reads_idxstats,ch_bwamem_mapped_reads_filter,ch_bwamem_mapped_reads_preseq, ch_bwamem_mapped_reads_damageprofiler, ch_bwamem_mapped_reads_strip
Expand Down Expand Up @@ -1061,7 +1044,7 @@ process damageprofiler {

input:
file bam from ch_mapped_reads_damageprofiler.mix(ch_mapped_reads_damageprofiler_cm,ch_bwamem_mapped_reads_damageprofiler)
file fasta from ch_fasta_for_damageprofiler.first()
file fasta from fasta_for_indexing
file bai from ch_bam_index_for_damageprofiler


Expand All @@ -1088,7 +1071,7 @@ process qualimap {

input:
file bam from ch_bam_filtered_qualimap
file fasta from ch_fasta_for_qualimap.first()
file fasta from fasta_for_indexing

output:
file "*" into ch_qualimap_results
Expand Down Expand Up @@ -1152,7 +1135,7 @@ process pmdtools {

input:
file bam from ch_for_pmdtools
file fasta from ch_fasta_for_pmdtools
file fasta from fasta_for_indexing

output:
file "*.bam" into ch_bam_after_pmdfiltering
Expand Down Expand Up @@ -1237,7 +1220,7 @@ process output_documentation {
publishDir "${params.outdir}/Documentation", mode: 'copy'

input:
file output_docs from ch_output_docs
file output_docs

output:
file "results_description.html"
Expand Down Expand Up @@ -1291,7 +1274,7 @@ process multiqc {
publishDir "${params.outdir}/MultiQC", mode: 'copy'

input:
file multiqc_config from ch_multiqc_config.collect().ifEmpty([])
file multiqc_config
file ('fastqc_raw/*') from ch_fastqc_results.collect().ifEmpty([])
file('fastqc/*') from ch_fastqc_after_clipping.collect().ifEmpty([])
file ('software_versions/software_versions_mqc*') from software_versions_yaml.collect().ifEmpty([])
Expand Down