Skip to content

Commit d6f038e

Browse files
authored
Merge pull request #196 from apeltzer/dev
Fix remaining issues with indices for non-fasta endings
2 parents 7a21c1b + 3d99bc8 commit d6f038e

2 files changed

Lines changed: 13 additions & 17 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1818
* [#176](https://github.com/nf-core/eager/pull/176) - Increase runtime for DamageProfiler on [large reference genomes](https://github.com/nf-core/eager/issues/173)
1919
* [#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)
2020
* [#174](https://github.com/nf-core/eager/pull/190) - Publish DeDup files [properly](https://github.com/nf-core/eager/issues/183)
21-
* TBF - Fix reference [issues](https://github.com/nf-core/eager/issues/150)
21+
* [#196](https://github.com/nf-core/eager/pull/190) - Fix reference [issues](https://github.com/nf-core/eager/issues/150)
22+
* [#196](https://github.com/nf-core/eager/pull/190) - Fix issues with PE data being mapped incompletely
2223

2324
### `Dependencies`
2425

main.nf

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,10 @@ if("${params.fasta}".endsWith(".gz")){
245245
file zipped_fasta
246246

247247
output:
248-
file "*.fasta" into fasta_for_indexing
248+
file "*.{fa,fn,fna,fasta}" into fasta_for_indexing
249249

250250
script:
251+
rm_zip = zipped_fasta - '.gz'
251252
"""
252253
pigz -f -d -p ${task.cpus} $zipped_fasta
253254
"""
@@ -486,13 +487,12 @@ process makeFastaIndex {
486487
file where_are_my_files
487488

488489
output:
489-
file "${base}.fasta.fai" into ch_fasta_faidx_index
490+
file "*.fai" into ch_fasta_faidx_index
490491
file "where_are_my_files.txt"
491492

492493
script:
493-
base = "${fasta.baseName}"
494494
"""
495-
samtools faidx "${base}.fasta"
495+
samtools faidx $fasta
496496
"""
497497
}
498498

@@ -516,16 +516,12 @@ process makeSeqDict {
516516
file where_are_my_files
517517

518518
output:
519-
file "seq_dict/*.dict" into ch_seq_dict
519+
file "*.dict" into ch_seq_dict
520520
file "where_are_my_files.txt"
521521

522522
script:
523-
base = "${fasta.baseName}.fasta"
524523
"""
525-
mkdir -p seq_dict
526-
mv $fasta "seq_dict/${base}"
527-
cd seq_dict
528-
picard -Xmx${task.memory.toMega()}M -Xms${task.memory.toMega()}M CreateSequenceDictionary R=$base O="${fasta.baseName}.dict"
524+
picard -Xmx${task.memory.toMega()}M -Xms${task.memory.toMega()}M CreateSequenceDictionary R=$fasta O="${fasta.baseName}.dict"
529525
"""
530526
}
531527

@@ -679,7 +675,7 @@ process adapter_removal {
679675
* STEP 2.1 - FastQC after clipping/merging (if applied!)
680676
*/
681677
process fastqc_after_clipping {
682-
tag "${prefix}"
678+
tag "${name}"
683679
publishDir "${params.outdir}/FastQC/after_clipping", mode: 'copy',
684680
saveAs: {filename -> filename.indexOf(".zip") > 0 ? "zips/$filename" : "$filename"}
685681

@@ -692,7 +688,6 @@ process fastqc_after_clipping {
692688
file "*_fastqc.{zip,html}" optional true into ch_fastqc_after_clipping
693689

694690
script:
695-
prefix = reads[0].toString().tokenize('.')[0]
696691
"""
697692
fastqc -q $reads
698693
"""
@@ -703,7 +698,7 @@ Step 3: Mapping with BWA, SAM to BAM, Sort BAM
703698
*/
704699

705700
process bwa {
706-
tag "$prefix"
701+
tag "${name}"
707702
publishDir "${params.outdir}/mapping/bwa", mode: 'copy'
708703

709704
when: !params.circularmapper && !params.bwamem
@@ -723,8 +718,8 @@ process bwa {
723718
fasta = "${index}/${bwa_base}"
724719

725720
//PE data without merging, PE data without any AR applied
726-
if (!params.singleEnd && (params.skip_collapse || params.skip_adapterremoval)){
727-
prefix = reads[0].toString().tokenize('.')[0]
721+
if (!params.singleEnd && (params.skip_collapse || params.skip_adapterremoval || params.skip_trim)){
722+
prefix = "${reads[0].baseName}"
728723
"""
729724
bwa aln -t ${task.cpus} $fasta ${reads[0]} -n ${params.bwaalnn} -l ${params.bwaalnl} -k ${params.bwaalnk} -f ${prefix}.r1.sai
730725
bwa aln -t ${task.cpus} $fasta ${reads[1]} -n ${params.bwaalnn} -l ${params.bwaalnl} -k ${params.bwaalnk} -f ${prefix}.r2.sai
@@ -733,7 +728,7 @@ process bwa {
733728
"""
734729
} else {
735730
//PE collapsed, or SE data
736-
prefix = reads[0].toString().tokenize('.')[0]
731+
prefix = "${reads}.baseName}"
737732
"""
738733
bwa aln -t ${task.cpus} $fasta $reads -n ${params.bwaalnn} -l ${params.bwaalnl} -k ${params.bwaalnk} -f ${prefix}.sai
739734
bwa samse -r "@RG\\tID:ILLUMINA-${prefix}\\tSM:${prefix}\\tPL:illumina" $fasta ${prefix}.sai $reads | samtools sort -@ ${task.cpus} -O bam - > "${prefix}".sorted.bam

0 commit comments

Comments
 (0)