Skip to content

Commit 77271aa

Browse files
authored
Merge pull request #127 from apeltzer/add_more_tests
Improve pipeline tests
2 parents f94e1a0 + 39731ca commit 77271aa

8 files changed

Lines changed: 50 additions & 36 deletions

File tree

.travis.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ before_install:
1313
# Pull the docker image first so the test doesn't wait for this
1414
- docker pull nfcore/eager:dev
1515
# Fake the tag locally so that the pipeline runs properly
16-
- docker tag nfcore/eager:dev nfcore/eager:2.0.4
16+
- docker tag nfcore/eager:dev nfcore/eager:latest
1717

1818
install:
1919
# Install Nextflow
@@ -39,16 +39,14 @@ script:
3939
# Run the basic pipeline with the test profile
4040
- nextflow run ${TRAVIS_BUILD_DIR} -profile test,docker --pairedEnd --saveReference
4141
# Run the basic pipeline with single end data (pretending its single end actually)
42-
- nextflow run ${TRAVIS_BUILD_DIR} -profile test,docker --singleEnd --bwa_index results/reference_genome/bwa_index/
42+
- nextflow run ${TRAVIS_BUILD_DIR} -profile test,docker --singleEnd --bwa_index results/reference_genome/bwa_index/bwa_index/
4343
# Run the same pipeline testing optional step: fastp, complexity
44-
- nextflow run ${TRAVIS_BUILD_DIR} -profile test,docker --pairedEnd --complexity_filter --bwa_index results/reference_genome/bwa_index/
44+
- nextflow run ${TRAVIS_BUILD_DIR} -profile test,docker --pairedEnd --complexity_filter --bwa_index results/reference_genome/bwa_index/bwa_index/
4545
# Test BAM Trimming
46-
- nextflow run ${TRAVIS_BUILD_DIR} -profile test,docker --pairedEnd --trim_bam --bwa_index results/reference_genome/bwa_index/
46+
- nextflow run ${TRAVIS_BUILD_DIR} -profile test,docker --pairedEnd --trim_bam --bwa_index results/reference_genome/bwa_index/bwa_index/
4747
# Test running with CircularMapper
4848
- nextflow run ${TRAVIS_BUILD_DIR} -profile test,docker --pairedEnd --circularmapper --circulartarget 'NC_007596.2'
4949
# Test running with BWA Mem
50-
- nextflow run ${TRAVIS_BUILD_DIR} -profile test,docker --pairedEnd --bwamem --bwa_index results/reference_genome/bwa_index/
50+
- nextflow run ${TRAVIS_BUILD_DIR} -profile test,docker --pairedEnd --bwamem --bwa_index results/reference_genome/bwa_index/bwa_index/
5151
# Test with zipped reference input
52-
- nextflow run ${TRAVIS_BUILD_DIR} -profile test,docker --pairedEnd --fasta 'https://raw.githubusercontent.com/nf-core/test-datasets/eager2/reference/Test.fasta.gz'
53-
# Test basic pipeline with Conda too
54-
- travis_wait 25 nextflow run ${TRAVIS_BUILD_DIR} -profile test,conda --pairedEnd --bwa_index results/reference_genome/bwa_index/
52+
- nextflow run ${TRAVIS_BUILD_DIR} -profile test,docker --pairedEnd --fasta 'https://raw.githubusercontent.com/nf-core/test-datasets/eager2/reference/Test.fasta.gz'

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
66

77
## [Unpublished / Dev Branch]
88

9+
### `Added`
10+
* [#127](https://github.com/nf-core/eager/pull/127) - Added a second testcase for testing the pipeline properly
11+
12+
### `Fixed`
13+
* [#128](https://github.com/nf-core/eager/issues/128) - Fixed reference genome handling errors
14+
915
## [2.0.4] - 2019-01-09
1016

1117
### `Added`

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ FROM nfcore/base
33
LABEL description="Docker image containing all requirements for nf-core/eager pipeline"
44
COPY environment.yml /
55
RUN conda env create -f /environment.yml && conda clean -a
6-
ENV PATH /opt/conda/envs/nf-core-eager-2.0.4/bin:$PATH
6+
ENV PATH /opt/conda/envs/nf-core-eager-2.0.5dev/bin:$PATH

Singularity

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ Bootstrap:docker
44
%labels
55
MAINTAINER Alexander Peltzer <alexander.peltzer@qbic.uni-tuebingen.de>
66
DESCRIPTION Container image containing all requirements for the nf-core/eager pipeline
7-
VERSION 2.0.4
7+
VERSION 2.0.5dev
88

99
%environment
10-
PATH=/opt/conda/envs/nf-core-eager-2.0.4/bin:$PATH
10+
PATH=/opt/conda/envs/nf-core-eager-2.0.5dev/bin:$PATH
1111
export PATH
1212

1313
%files

conf/test.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ params {
1515
//Input data
1616
singleEnd = false
1717
readPaths = [['JK2782_TGGCCGATCAACGA_L008', ['https://github.com/nf-core/test-datasets/raw/eager2/testdata/Mammoth/JK2782_TGGCCGATCAACGA_L008_R1_001.fastq.gz.tengrand.fq.gz','https://github.com/nf-core/test-datasets/raw/eager2/testdata/Mammoth/JK2782_TGGCCGATCAACGA_L008_R2_001.fastq.gz.tengrand.fq.gz']],
18+
['JK2785_TGGCCGATCAACGA_L008', ['https://github.com/nf-core/test-datasets/raw/eager2/testdata/Mammoth/JK2785_TGGCCGATCAACGA_L008_R1_001.fastq.gz.tengrand.fq.gz','https://github.com/nf-core/test-datasets/raw/eager2/testdata/Mammoth/JK2785_TGGCCGATCAACGA_L008_R2_001.fastq.gz.tengrand.fq.gz']],
1819
]
1920
// Genome references
2021
fasta = 'https://raw.githubusercontent.com/nf-core/test-datasets/eager2/reference/Mammoth_MT_Krause.fasta'

environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: nf-core-eager-2.0.4
1+
name: nf-core-eager-2.0.5dev
22
channels:
33
- defaults
44
- bioconda

main.nf

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ if("${params.fasta}".endsWith(".gz")){
228228
file zipfasta from ch_unzip_fasta
229229

230230
output:
231-
file "*.fasta" into (ch_fasta_for_bwa_indexing, ch_fasta_for_faidx_indexing, ch_fasta_for_dict_indexing, ch_fasta_for_bwa_mapping, ch_fasta_for_damageprofiler, ch_fasta_for_qualimap, ch_fasta_for_pmdtools, ch_fasta_for_circularmapper, ch_fasta_for_circularmapper_index,ch_fasta_for_bwamem_mapping)
231+
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)
232232

233233
script:
234234
"""
@@ -238,7 +238,7 @@ if("${params.fasta}".endsWith(".gz")){
238238
} else {
239239
Channel.fromPath("${params.fasta}")
240240
.ifEmpty { exit 1, "No genome specified! Please specify one with --fasta"}
241-
.into {ch_fasta_for_bwa_indexing;ch_fasta_for_faidx_indexing;ch_fasta_for_dict_indexing; ch_fasta_for_bwa_mapping; ch_fasta_for_damageprofiler; ch_fasta_for_qualimap; ch_fasta_for_pmdtools; ch_fasta_for_circularmapper; ch_fasta_for_circularmapper_index;ch_fasta_for_bwamem_mapping}
241+
.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}
242242
}
243243

244244

@@ -253,14 +253,10 @@ if (params.aligner != 'bwa' && !params.circularmapper && !params.bwamem){
253253
}
254254
if( params.bwa_index && (params.aligner == 'bwa' | params.bwamem)){
255255
bwa_index = Channel
256-
.fromPath("${params.bwa_index}/**.*")
257-
.ifEmpty { exit 1, "BWA index not found: ${params.bwa_index}" }
258-
.into{ch_bwa_index_existing;ch_bwa_index_bwamem_existing}
259-
} else {
260-
//Create empty channels to make sure later mix() does not fail
261-
ch_bwa_index_existing = Channel.empty()
262-
ch_bwa_index_bwamem_existing = Channel.empty()
263-
}
256+
.fromPath("${params.bwa_index}",checkIfExists: true)
257+
.ifEmpty { exit 1, "BWA index not found: ${params.bwa_index}"}
258+
.into{ch_bwa_index;ch_bwa_index_bwamem}
259+
}
264260

265261
//Validate that either pairedEnd or singleEnd has been specified by the user!
266262
if( params.singleEnd || params.pairedEnd ){
@@ -376,6 +372,9 @@ ${summary.collect { k,v -> " <dt>$k</dt><dd><samp>${v ?: '<span style
376372
/*
377373
* Create BWA indices if they are not present
378374
*/
375+
376+
if(!params.bwa_index && params.fasta && (params.aligner =='bwa' || params.bwamem)) {
377+
379378
process makeBWAIndex {
380379
tag {fasta}
381380
publishDir path: "${params.outdir}/reference_genome/bwa_index", mode: 'copy', saveAs: { filename ->
@@ -391,15 +390,20 @@ process makeBWAIndex {
391390
file wherearemyfiles from ch_where_for_bwa_index
392391

393392
output:
394-
file "*.{amb,ann,bwt,pac,sa,fasta,fa}" into (ch_bwa_index,ch_bwa_index_bwamem)
393+
file "bwa_index" into (ch_bwa_index,ch_bwa_index_bwamem)
395394
file "where_are_my_files.txt"
396395

397396
script:
398397
"""
398+
mkdir bwa_index
399+
cp "${fasta}" bwa_index/
400+
cd bwa_index
399401
bwa index $fasta
400402
"""
401403
}
402404

405+
}
406+
403407

404408
/*
405409
* PREPROCESSING - Index Fasta file if not specified on CLI
@@ -581,8 +585,7 @@ process bwa {
581585

582586
input:
583587
file(reads) from ch_clipped_reads
584-
file "*" from ch_bwa_index.mix(ch_bwa_index_existing).collect()
585-
file fasta from ch_fasta_for_bwa_mapping
588+
file index from ch_bwa_index.first()
586589

587590
output:
588591
file "*.sorted.bam" into ch_mapped_reads_idxstats,ch_mapped_reads_filter,ch_mapped_reads_preseq, ch_mapped_reads_damageprofiler
@@ -591,6 +594,7 @@ process bwa {
591594

592595
script:
593596
prefix = reads[0].toString() - ~/(_R1)?(\.combined\.)?(prefixed)?(_trimmed)?(_val_1)?(\.fq)?(\.fastq)?(\.gz)?$/
597+
fasta = "${index}/*.fasta"
594598
"""
595599
bwa aln -t ${task.cpus} $fasta $reads -n ${params.bwaalnn} -l ${params.bwaalnl} -k ${params.bwaalnk} -f "${reads.baseName}.sai"
596600
bwa samse -r "@RG\\tID:ILLUMINA-${prefix}\\tSM:${prefix}\\tPL:illumina" $fasta "${reads.baseName}".sai $reads | samtools sort -@ ${task.cpus} -O bam - > "${prefix}".sorted.bam
@@ -612,12 +616,16 @@ process circulargenerator{
612616
file fasta from ch_fasta_for_circularmapper_index
613617

614618
output:
615-
file "*.fasta*" into ch_circularmapper_indices
619+
file "cm_index" into ch_circularmapper_indices
616620

617621
script:
622+
prefix = "${fasta.baseName}_${params.circularextension}.fasta"
618623
"""
624+
mkdir cm_index
619625
circulargenerator -e ${params.circularextension} -i $fasta -s ${params.circulartarget}
620-
bwa index "${fasta.baseName}_${params.circularextension}.fasta"
626+
cp "${fasta.baseName}_${params.circularextension}.fasta" cm_index/
627+
cd cm_index
628+
bwa index $prefix
621629
"""
622630

623631
}
@@ -631,8 +639,7 @@ process circularmapper{
631639

632640
input:
633641
file reads from ch_clipped_reads_circularmapper
634-
file fasta from ch_fasta_for_circularmapper
635-
file "*" from ch_circularmapper_indices
642+
file index from ch_circularmapper_indices.first()
636643

637644
output:
638645
file "*.sorted.bam" into ch_mapped_reads_idxstats_cm,ch_mapped_reads_filter_cm,ch_mapped_reads_preseq_cm, ch_mapped_reads_damageprofiler_cm
@@ -641,9 +648,11 @@ process circularmapper{
641648
script:
642649
filter = "${params.circularfilter}" ? '' : '-f true -x false'
643650
prefix = reads[0].toString() - ~/(_R1)?(\.combined\.)?(prefixed)?(_trimmed)?(_val_1)?(\.fq)?(\.fastq)?(\.gz)?$/
651+
fasta = "${index}/*_*.fasta"
652+
644653
"""
645-
bwa aln -t ${task.cpus} "${fasta.baseName}_${params.circularextension}.fasta" $reads -n ${params.bwaalnn} -l ${params.bwaalnl} -k ${params.bwaalnk} -f "${reads.baseName}.sai"
646-
bwa samse -r "@RG\\tID:ILLUMINA-${prefix}\\tSM:${prefix}\\tPL:illumina" "${fasta.baseName}_${params.circularextension}.fasta" "${reads.baseName}".sai $reads > tmp.out
654+
bwa aln -t ${task.cpus} $fasta $reads -n ${params.bwaalnn} -l ${params.bwaalnl} -k ${params.bwaalnk} -f "${reads.baseName}.sai"
655+
bwa samse -r "@RG\\tID:ILLUMINA-${prefix}\\tSM:${prefix}\\tPL:illumina" $fasta "${reads.baseName}".sai $reads > tmp.out
647656
realignsamfile -e ${params.circularextension} -i tmp.out -r $fasta $filter
648657
samtools sort -@ ${task.cpus} -O bam tmp_realigned.bam > "${prefix}".sorted.bam
649658
samtools index "${prefix}".sorted.bam
@@ -658,8 +667,7 @@ process bwamem {
658667

659668
input:
660669
file(reads) from ch_clipped_reads_bwamem
661-
file "*" from ch_bwa_index_bwamem.mix(ch_bwa_index_bwamem_existing).collect()
662-
file fasta from ch_fasta_for_bwamem_mapping
670+
file index from ch_bwa_index_bwamem.first()
663671

664672
output:
665673
file "*.sorted.bam" into ch_bwamem_mapped_reads_idxstats,ch_bwamem_mapped_reads_filter,ch_bwamem_mapped_reads_preseq, ch_bwamem_mapped_reads_damageprofiler
@@ -668,6 +676,7 @@ process bwamem {
668676

669677
script:
670678
prefix = reads[0].toString() - ~/(_R1)?(\.combined\.)?(prefixed)?(_trimmed)?(_val_1)?(\.fq)?(\.fastq)?(\.gz)?$/
679+
fasta = "${index}/*.fasta"
671680
"""
672681
bwa mem -t ${task.cpus} $fasta $reads -R "@RG\\tID:ILLUMINA-${prefix}\\tSM:${prefix}\\tPL:illumina" | samtools sort -@ ${task.cpus} -O bam - > "${prefix}".sorted.bam
673682
samtools index -@ ${task.cpus} "${prefix}".sorted.bam
@@ -1077,7 +1086,7 @@ process multiqc {
10771086
file ('damageprofiler/*') from ch_damageprofiler_results.collect().ifEmpty([])
10781087
file ('qualimap/*') from ch_qualimap_results.collect().ifEmpty([])
10791088
file ('markdup/*') from ch_markdup_results_for_multiqc.collect().ifEmpty([])
1080-
file ('dedup/*') from ch_dedup_results_for_multiqc.collect().ifEmpty([])
1089+
file ('dedup*/*') from ch_dedup_results_for_multiqc.collect().ifEmpty([])
10811090
file ('fastp/*') from ch_fastp_for_multiqc.collect().ifEmpty([])
10821091

10831092
file workflow_summary from create_workflow_summary(summary)

nextflow.config

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// Global default params, used in configs
1212
params {
13-
container = 'nfcore/eager:2.0.4'
13+
container = 'nfcore/eager:latest'
1414

1515
//Pipeline options
1616
aligner = 'bwa'
@@ -85,7 +85,7 @@ manifest {
8585
name = 'nf-core/eager'
8686
author = 'Alexander Peltzer, Stephen Clayton, James A Fellows-Yates'
8787
homePage = 'https://github.com/nf-core/eager'
88-
version = '2.0.4'
88+
version = '2.0.5dev'
8989
description = 'A fully reproducible and modern ancient DNA pipeline in Nextflow and with cloud support.'
9090
mainScript = 'main.nf'
9191
nextflowVersion = '>=0.32.0'

0 commit comments

Comments
 (0)