diff --git a/.gitattributes b/.gitattributes index 7a2dabc2..c1c17000 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,5 @@ *.config linguist-language=nextflow *.nf.test linguist-language=nextflow +tests/**/*nf.test.snap linguist-generated modules/nf-core/** linguist-generated subworkflows/nf-core/** linguist-generated diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d1e284f1..cdd2baf2 100755 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,31 +1,58 @@ -name: nf-core CI # This workflow runs the pipeline with the minimal test dataset to check that it completes without any syntax errors +name: nf-core CI on: push: branches: - dev pull_request: + branches: + - dev + - master release: - types: [published] + types: + - "published" env: NXF_ANSI_LOG: false + NFTEST_VER: "0.7.3" concurrency: group: "${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}" cancel-in-progress: true jobs: + define_nxf_versions: + name: Choose nextflow versions to test against depending on target branch + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.nxf_versions.outputs.matrix }} + steps: + - id: nxf_versions + run: | + if [[ "${{ github.event_name }}" == "pull_request" && "${{ github.base_ref }}" == "dev" && "${{ matrix.NXF_VER }}" != "latest-everything" ]]; then + echo matrix='["latest-everything"]' | tee -a $GITHUB_OUTPUT + else + echo matrix='["latest-everything", "22.10.1"]' | tee -a $GITHUB_OUTPUT + fi + test: - name: Run pipeline with test data - # Only run on push if this is the nf-core dev branch (merged PRs) - if: "${{ github.event_name != 'push' || (github.event_name == 'push' && github.repository == 'nf-core/chipseq') }}" + name: nf-test + needs: define_nxf_versions runs-on: ubuntu-latest strategy: + fail-fast: false matrix: - NXF_VER: - - "22.10.1" - - "latest-everything" + NXF_VER: ${{ fromJson(needs.define_nxf_versions.outputs.matrix) }} + tags: + - "test_profile" + - "test_skip_trimming" + - "test_skip_consensus_peaks" + - "test_aligner_bowtie2" + - "test_aligner_chromap" + - "test_aligner_star" + profile: + - "docker" + steps: - name: Check out pipeline code uses: actions/checkout@v3 @@ -35,51 +62,23 @@ jobs: with: version: "${{ matrix.NXF_VER }}" - - name: Run pipeline with test data + - name: Install nf-test run: | - nextflow run ${GITHUB_WORKSPACE} -profile test,docker --outdir ./results + wget -qO- https://code.askimed.com/install/nf-test | bash -s $NFTEST_VER + sudo mv nf-test /usr/local/bin/ - parameters: - name: Test workflow parameters - if: ${{ github.event_name != 'push' || (github.event_name == 'push' && github.repository == 'nf-core/chipseq') }} - runs-on: ubuntu-latest - strategy: - matrix: - parameters: - - "--skip_trimming" - - "--skip_consensus_peaks" - steps: - - name: Check out pipeline code - uses: actions/checkout@v2 - - - name: Install Nextflow + - name: Run nf-test run: | - wget -qO- get.nextflow.io | bash - sudo mv nextflow /usr/local/bin/ + nf-test test --tag ${{ matrix.tags }} --profile test,${{ matrix.profile }} --junitxml=test.xml - - name: Run pipeline with various parameters + - name: Output log on failure + if: failure() run: | - nextflow run ${GITHUB_WORKSPACE} -profile test,docker ${{ matrix.parameters }} --outdir ./results + sudo apt install bat > /dev/null + batcat --decorations=always --color=always ${{ github.workspace }}/.nf-test/tests/*/output/pipeline_info/software_versions.yml - aligners: - name: Test available aligners - if: ${{ github.event_name != 'push' || (github.event_name == 'push' && github.repository == 'nf-core/chipseq') }} - runs-on: ubuntu-latest - strategy: - matrix: - aligner: - - "bowtie2" - - "chromap" - - "star" - steps: - - name: Check out pipeline code - uses: actions/checkout@v2 - - - name: Install Nextflow - run: | - wget -qO- get.nextflow.io | bash - sudo mv nextflow /usr/local/bin/ - - - name: Run pipeline with the different aligners available - run: | - nextflow run ${GITHUB_WORKSPACE} -profile test,docker --aligner ${{ matrix.aligner }} --outdir ./results + - name: Publish Test Report + uses: mikepenz/action-junit-report@v3 + if: always() # always run even if the previous step fails + with: + report_paths: "*.xml" diff --git a/.gitignore b/.gitignore index 5124c9ac..935326a7 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,5 @@ results/ testing/ testing* *.pyc +.nf-test/ +nf-test diff --git a/.nf-core.yml b/.nf-core.yml index 3805dc81..3b337449 100644 --- a/.nf-core.yml +++ b/.nf-core.yml @@ -1 +1,5 @@ repository_type: pipeline +lint: + files_unchanged: + - .gitattributes + actions_ci: False diff --git a/nf-test.config b/nf-test.config new file mode 100644 index 00000000..cd432d43 --- /dev/null +++ b/nf-test.config @@ -0,0 +1,16 @@ +config { + // location for all nf-tests + testsDir "tests" + + // nf-test directory including temporary files for each test + workDir ".nf-test" + + // location of library folder that is added automatically to the classpath + libDir "tests/pipeline/lib/" + + // location of an optional nextflow.config file specific for executing tests + configFile "nextflow.config" + + // run all test with the defined docker profile from the main nextflow.config + profile "" +} diff --git a/tests/pipeline/lib/UTILS.groovy b/tests/pipeline/lib/UTILS.groovy new file mode 100644 index 00000000..28c78f75 --- /dev/null +++ b/tests/pipeline/lib/UTILS.groovy @@ -0,0 +1,38 @@ +// Helper functions for pipeline tests + +class UTILS { + + // Function to remove Nextflow version from software_versions.yml + public static String removeNextflowVersion(outputDir) { + def softwareVersions = path("$outputDir/pipeline_info/software_versions.yml").yaml + if (softwareVersions.containsKey("Workflow")) { + softwareVersions.Workflow.remove("Nextflow") + } + return softwareVersions + } + + // Function to filter lines from a file and return a new file + public static File filterLines(String inFilePath, int linesToSkip) { + if (linesToSkip >= 0) { + File inputFile = new File(inFilePath) + File outputFile = new File(inFilePath + ".filtered") + def lineCount = 0 + inputFile.eachLine { line -> + lineCount++ + if (lineCount > linesToSkip) { + outputFile.append(line + '\n') + } + } + return outputFile + } else { + File inputFile = new File(inFilePath) + File outputFile = new File(inFilePath + ".filtered") + def lines = inputFile.readLines() + def totalLines = lines.size() + lines.take(totalLines + linesToSkip).each { line -> + outputFile.append(line + '\n') + } + return outputFile + } + } +} diff --git a/tests/pipeline/test.nf.test b/tests/pipeline/test.nf.test new file mode 100644 index 00000000..04efbb11 --- /dev/null +++ b/tests/pipeline/test.nf.test @@ -0,0 +1,43 @@ +nextflow_pipeline { + + name "Test Workflow main.nf" + script "main.nf" + tag "test_profile" + tag "pipeline" + + test("Default Test Profile") { + + when { + params { + outdir = "$outputDir" + } + } + + then { + assertAll( + { assert workflow.success }, + { assert snapshot(UTILS.removeNextflowVersion("$outputDir")).match("software_versions") }, + { assert snapshot(path("$outputDir/bwa/mergedLibrary/SPT5_INPUT_REP1.mLb.clN.sorted.bam"), + path("$outputDir/bwa/mergedLibrary/SPT5_INPUT_REP2.mLb.clN.sorted.bam"), + path("$outputDir/bwa/mergedLibrary/SPT5_T0_REP1.mLb.clN.sorted.bam"), + path("$outputDir/bwa/mergedLibrary/SPT5_T0_REP2.mLb.clN.sorted.bam"), + path("$outputDir/bwa/mergedLibrary/SPT5_T15_REP1.mLb.clN.sorted.bam"), + path("$outputDir/bwa/mergedLibrary/SPT5_T15_REP2.mLb.clN.sorted.bam")).match("bwa/mergedLibrary/") }, + { assert new File("$outputDir/bwa/mergedLibrary/bigwig/").exists() }, + { assert new File("$outputDir/bwa/mergedLibrary/deepTools/").exists() }, + { assert new File("$outputDir/bwa/mergedLibrary/macs2/").exists() }, + { assert new File("$outputDir/bwa/mergedLibrary/phantompeakqualtools/").exists() }, + { assert new File("$outputDir/bwa/mergedLibrary/picard_metrics/").exists() }, + { assert new File("$outputDir/bwa/mergedLibrary/samtools_stats/").exists() }, + { assert new File("$outputDir/fastqc/").exists() }, + { assert snapshot(path("$outputDir/genome").list()).match("genome") }, + { assert new File("$outputDir/igv/").exists() }, + { assert new File("$outputDir/multiqc/").exists() }, + { assert new File("$outputDir/pipeline_info/").exists() }, + { assert new File("$outputDir/trimgalore/").exists() } + ) + } + + } + +} diff --git a/tests/pipeline/test.nf.test.snap b/tests/pipeline/test.nf.test.snap new file mode 100644 index 00000000..a3897eba --- /dev/null +++ b/tests/pipeline/test.nf.test.snap @@ -0,0 +1,28 @@ +{ + "genome": { + "content": [ + "genome.fa:md5,4bad9f4b18056156a81f7f952abbe125", + "genome.fa.fai:md5,6f4c0ce5258e6948135ad006e1f9ee1b", + "genome.fa.sizes:md5,e122f8021a5ef14104c32785cb9b7adc", + "genome.include_regions.bed:md5,58b27f8faf81d116a596c37be421ce01" + ], + "timestamp": "2023-06-25T23:19:20+0000" + }, + "software_versions": { + "content": [ + "{ANNOTATE_BOOLEAN_PEAKS={sed=4.7}, BAMTOOLS_FILTER={bamtools=2.5.2, samtools=1.15.1}, BAM_REMOVE_ORPHANS={samtools=1.15.1}, BEDTOOLS_GENOMECOV={bedtools=2.30.0}, BWA_INDEX={bwa=0.7.17-r1188}, BWA_MEM={bwa=0.7.17-r1188, samtools=1.16.1}, CUSTOM_DUMPSOFTWAREVERSIONS={python=3.11.0, yaml=6.0}, CUSTOM_GETCHROMSIZES={getchromsizes=1.16.1}, DEEPTOOLS_COMPUTEMATRIX={deeptools=3.5.1}, DEEPTOOLS_PLOTFINGERPRINT={deeptools=3.5.1}, DEEPTOOLS_PLOTHEATMAP={deeptools=3.5.1}, DEEPTOOLS_PLOTPROFILE={deeptools=3.5.1}, FASTQC={fastqc=0.11.9}, FRIP_SCORE={bedtools=2.30.0, samtools=1.15.1}, GENOME_BLACKLIST_REGIONS={bedtools=2.30.0}, GTF2BED={perl=5.26.2}, HOMER_ANNOTATEPEAKS_CONSENSUS={homer=4.11}, HOMER_ANNOTATEPEAKS_MACS2={homer=4.11}, IGV={python=3.8.3}, MACS2_CALLPEAK={macs2=2.2.7.1}, MACS2_CONSENSUS={python=3.10.0, r-base=4.1.1}, PHANTOMPEAKQUALTOOLS={phantompeakqualtools=1.2.2}, PICARD_COLLECTMULTIPLEMETRICS={picard=3.0.0}, PICARD_MARKDUPLICATES={picard=3.0.0}, PICARD_MERGESAMFILES={picard=3.0.0}, PLOT_HOMER_ANNOTATEPEAKS={r-base=4.0.3}, PLOT_MACS2_QC={r-base=4.0.3}, SAMPLESHEET_CHECK={python=3.8.3}, SAMTOOLS_FLAGSTAT={samtools=1.17}, SAMTOOLS_IDXSTATS={samtools=1.17}, SAMTOOLS_INDEX={samtools=1.17}, SAMTOOLS_SORT={samtools=1.17}, SAMTOOLS_STATS={samtools=1.17}, SUBREAD_FEATURECOUNTS={subread=2.0.1}, TRIMGALORE={cutadapt=3.4, trimgalore=0.6.7}, UCSC_BEDGRAPHTOBIGWIG={ucsc=377}, Workflow={nf-core/chipseq=2.1.0dev}}" + ], + "timestamp": "2023-06-25T23:19:20+0000" + }, + "bwa/mergedLibrary/": { + "content": [ + "SPT5_INPUT_REP1.mLb.clN.sorted.bam:md5,d7bee922bf952cf61386fc16ca4caa97", + "SPT5_INPUT_REP2.mLb.clN.sorted.bam:md5,77546d38f90715f72970ee79115867e8", + "SPT5_T0_REP1.mLb.clN.sorted.bam:md5,9e08abe685744dfbc007b98f75e35a6b", + "SPT5_T0_REP2.mLb.clN.sorted.bam:md5,7a633fa29c9dd0572c20f71c10f3b0e7", + "SPT5_T15_REP1.mLb.clN.sorted.bam:md5,dbfc6b58eee6d28dc56aac5fa38703b1", + "SPT5_T15_REP2.mLb.clN.sorted.bam:md5,b61cb600c3866477c0c3957b779bf5f0" + ], + "timestamp": "2023-06-25T23:19:21+0000" + } +} \ No newline at end of file diff --git a/tests/pipeline/test_aligner_bowtie2.nf.test b/tests/pipeline/test_aligner_bowtie2.nf.test new file mode 100644 index 00000000..0637717f --- /dev/null +++ b/tests/pipeline/test_aligner_bowtie2.nf.test @@ -0,0 +1,44 @@ +nextflow_pipeline { + + name "Test Workflow main.nf" + script "main.nf" + tag "test_aligner_bowtie2" + tag "pipeline" + + test("Aligner - Bowtie2") { + + when { + params { + outdir = "$outputDir" + aligner = "bowtie2" + } + } + + then { + assertAll( + { assert workflow.success }, + { assert snapshot(UTILS.removeNextflowVersion("$outputDir")).match("software_versions") }, + { assert new File("$outputDir/bowtie2/mergedLibrary/SPT5_INPUT_REP1.mLb.clN.sorted.bam").exists() }, + { assert new File("$outputDir/bowtie2/mergedLibrary/SPT5_INPUT_REP2.mLb.clN.sorted.bam").exists() }, + { assert new File("$outputDir/bowtie2/mergedLibrary/SPT5_T0_REP1.mLb.clN.sorted.bam").exists() }, + { assert new File("$outputDir/bowtie2/mergedLibrary/SPT5_T0_REP2.mLb.clN.sorted.bam").exists() }, + { assert new File("$outputDir/bowtie2/mergedLibrary/SPT5_T15_REP1.mLb.clN.sorted.bam").exists() }, + { assert new File("$outputDir/bowtie2/mergedLibrary/SPT5_T15_REP2.mLb.clN.sorted.bam").exists() }, + { assert new File("$outputDir/bowtie2/mergedLibrary/bigwig/").exists() }, + { assert new File("$outputDir/bowtie2/mergedLibrary/deepTools/").exists() }, + { assert new File("$outputDir/bowtie2/mergedLibrary/macs2/").exists() }, + { assert new File("$outputDir/bowtie2/mergedLibrary/phantompeakqualtools/").exists() }, + { assert new File("$outputDir/bowtie2/mergedLibrary/picard_metrics/").exists() }, + { assert new File("$outputDir/bowtie2/mergedLibrary/samtools_stats/").exists() }, + { assert new File("$outputDir/fastqc/").exists() }, + { assert snapshot(path("$outputDir/genome").list()).match("genome") }, + { assert new File("$outputDir/igv/").exists() }, + { assert new File("$outputDir/multiqc/").exists() }, + { assert new File("$outputDir/pipeline_info/").exists() }, + { assert new File("$outputDir/trimgalore/").exists() } + ) + } + + } + +} diff --git a/tests/pipeline/test_aligner_bowtie2.nf.test.snap b/tests/pipeline/test_aligner_bowtie2.nf.test.snap new file mode 100644 index 00000000..fc7d34be --- /dev/null +++ b/tests/pipeline/test_aligner_bowtie2.nf.test.snap @@ -0,0 +1,17 @@ +{ + "genome": { + "content": [ + "genome.fa:md5,4bad9f4b18056156a81f7f952abbe125", + "genome.fa.fai:md5,6f4c0ce5258e6948135ad006e1f9ee1b", + "genome.fa.sizes:md5,e122f8021a5ef14104c32785cb9b7adc", + "genome.include_regions.bed:md5,58b27f8faf81d116a596c37be421ce01" + ], + "timestamp": "2023-06-26T00:54:15+0000" + }, + "software_versions": { + "content": [ + "{ANNOTATE_BOOLEAN_PEAKS={sed=4.7}, BAMTOOLS_FILTER={bamtools=2.5.2, samtools=1.15.1}, BAM_REMOVE_ORPHANS={samtools=1.15.1}, BEDTOOLS_GENOMECOV={bedtools=2.30.0}, BOWTIE2_ALIGN={bowtie2=2.4.4, pigz=2.6, samtools=1.16.1}, BOWTIE2_BUILD={bowtie2=2.4.4}, CUSTOM_DUMPSOFTWAREVERSIONS={python=3.11.0, yaml=6.0}, CUSTOM_GETCHROMSIZES={getchromsizes=1.16.1}, DEEPTOOLS_COMPUTEMATRIX={deeptools=3.5.1}, DEEPTOOLS_PLOTFINGERPRINT={deeptools=3.5.1}, DEEPTOOLS_PLOTHEATMAP={deeptools=3.5.1}, DEEPTOOLS_PLOTPROFILE={deeptools=3.5.1}, FASTQC={fastqc=0.11.9}, FRIP_SCORE={bedtools=2.30.0, samtools=1.15.1}, GENOME_BLACKLIST_REGIONS={bedtools=2.30.0}, GTF2BED={perl=5.26.2}, HOMER_ANNOTATEPEAKS_CONSENSUS={homer=4.11}, HOMER_ANNOTATEPEAKS_MACS2={homer=4.11}, IGV={python=3.8.3}, MACS2_CALLPEAK={macs2=2.2.7.1}, MACS2_CONSENSUS={python=3.10.0, r-base=4.1.1}, PHANTOMPEAKQUALTOOLS={phantompeakqualtools=1.2.2}, PICARD_COLLECTMULTIPLEMETRICS={picard=3.0.0}, PICARD_MARKDUPLICATES={picard=3.0.0}, PICARD_MERGESAMFILES={picard=3.0.0}, PLOT_HOMER_ANNOTATEPEAKS={r-base=4.0.3}, PLOT_MACS2_QC={r-base=4.0.3}, SAMPLESHEET_CHECK={python=3.8.3}, SAMTOOLS_FLAGSTAT={samtools=1.17}, SAMTOOLS_IDXSTATS={samtools=1.17}, SAMTOOLS_INDEX={samtools=1.17}, SAMTOOLS_SORT={samtools=1.17}, SAMTOOLS_STATS={samtools=1.17}, SUBREAD_FEATURECOUNTS={subread=2.0.1}, TRIMGALORE={cutadapt=3.4, trimgalore=0.6.7}, UCSC_BEDGRAPHTOBIGWIG={ucsc=377}, Workflow={nf-core/chipseq=2.1.0dev}}" + ], + "timestamp": "2023-06-26T00:54:15+0000" + } +} \ No newline at end of file diff --git a/tests/pipeline/test_aligner_chromap.nf.test b/tests/pipeline/test_aligner_chromap.nf.test new file mode 100644 index 00000000..f433943a --- /dev/null +++ b/tests/pipeline/test_aligner_chromap.nf.test @@ -0,0 +1,44 @@ +nextflow_pipeline { + + name "Test Workflow main.nf" + script "main.nf" + tag "test_aligner_chromap" + tag "pipeline" + + test("Aligner - Chromap") { + + when { + params { + outdir = "$outputDir" + aligner = "chromap" + } + } + + then { + assertAll( + { assert workflow.success }, + { assert snapshot(UTILS.removeNextflowVersion("$outputDir")).match("software_versions") }, + { assert snapshot(path("$outputDir/chromap/mergedLibrary/SPT5_INPUT_REP1.mLb.clN.sorted.bam"), + path("$outputDir/chromap/mergedLibrary/SPT5_INPUT_REP2.mLb.clN.sorted.bam"), + path("$outputDir/chromap/mergedLibrary/SPT5_T0_REP1.mLb.clN.sorted.bam"), + path("$outputDir/chromap/mergedLibrary/SPT5_T0_REP2.mLb.clN.sorted.bam"), + path("$outputDir/chromap/mergedLibrary/SPT5_T15_REP1.mLb.clN.sorted.bam"), + path("$outputDir/chromap/mergedLibrary/SPT5_T15_REP2.mLb.clN.sorted.bam")).match("bwa/mergedLibrary/") }, + { assert new File("$outputDir/chromap/mergedLibrary/bigwig/").exists() }, + { assert new File("$outputDir/chromap/mergedLibrary/deepTools/").exists() }, + { assert new File("$outputDir/chromap/mergedLibrary/macs2/").exists() }, + { assert new File("$outputDir/chromap/mergedLibrary/phantompeakqualtools/").exists() }, + { assert new File("$outputDir/chromap/mergedLibrary/picard_metrics/").exists() }, + { assert new File("$outputDir/chromap/mergedLibrary/samtools_stats/").exists() }, + { assert new File("$outputDir/fastqc/").exists() }, + { assert snapshot(path("$outputDir/genome").list()).match("genome") }, + { assert new File("$outputDir/igv/").exists() }, + { assert new File("$outputDir/multiqc/").exists() }, + { assert new File("$outputDir/pipeline_info/").exists() }, + { assert new File("$outputDir/trimgalore/").exists() } + ) + } + + } + +} diff --git a/tests/pipeline/test_aligner_chromap.nf.test.snap b/tests/pipeline/test_aligner_chromap.nf.test.snap new file mode 100644 index 00000000..a7f4e53f --- /dev/null +++ b/tests/pipeline/test_aligner_chromap.nf.test.snap @@ -0,0 +1,28 @@ +{ + "genome": { + "content": [ + "genome.fa:md5,4bad9f4b18056156a81f7f952abbe125", + "genome.fa.fai:md5,6f4c0ce5258e6948135ad006e1f9ee1b", + "genome.fa.sizes:md5,e122f8021a5ef14104c32785cb9b7adc", + "genome.include_regions.bed:md5,58b27f8faf81d116a596c37be421ce01" + ], + "timestamp": "2023-06-25T22:30:14+0000" + }, + "software_versions": { + "content": [ + "{ANNOTATE_BOOLEAN_PEAKS={sed=4.7}, BAMTOOLS_FILTER={bamtools=2.5.2, samtools=1.15.1}, BAM_REMOVE_ORPHANS={samtools=1.15.1}, BEDTOOLS_GENOMECOV={bedtools=2.30.0}, CHROMAP_CHROMAP={chromap=0.2.4-r467, samtools=1.16.1}, CHROMAP_INDEX={chromap=0.2.4-r467}, CUSTOM_DUMPSOFTWAREVERSIONS={python=3.11.0, yaml=6.0}, CUSTOM_GETCHROMSIZES={getchromsizes=1.16.1}, DEEPTOOLS_COMPUTEMATRIX={deeptools=3.5.1}, DEEPTOOLS_PLOTFINGERPRINT={deeptools=3.5.1}, DEEPTOOLS_PLOTHEATMAP={deeptools=3.5.1}, DEEPTOOLS_PLOTPROFILE={deeptools=3.5.1}, FASTQC={fastqc=0.11.9}, FRIP_SCORE={bedtools=2.30.0, samtools=1.15.1}, GENOME_BLACKLIST_REGIONS={bedtools=2.30.0}, GTF2BED={perl=5.26.2}, HOMER_ANNOTATEPEAKS_CONSENSUS={homer=4.11}, HOMER_ANNOTATEPEAKS_MACS2={homer=4.11}, IGV={python=3.8.3}, MACS2_CALLPEAK={macs2=2.2.7.1}, MACS2_CONSENSUS={python=3.10.0, r-base=4.1.1}, PHANTOMPEAKQUALTOOLS={phantompeakqualtools=1.2.2}, PICARD_COLLECTMULTIPLEMETRICS={picard=3.0.0}, PICARD_MARKDUPLICATES={picard=3.0.0}, PICARD_MERGESAMFILES={picard=3.0.0}, PLOT_HOMER_ANNOTATEPEAKS={r-base=4.0.3}, PLOT_MACS2_QC={r-base=4.0.3}, SAMPLESHEET_CHECK={python=3.8.3}, SAMTOOLS_FLAGSTAT={samtools=1.17}, SAMTOOLS_IDXSTATS={samtools=1.17}, SAMTOOLS_INDEX={samtools=1.17}, SAMTOOLS_SORT={samtools=1.17}, SAMTOOLS_STATS={samtools=1.17}, SUBREAD_FEATURECOUNTS={subread=2.0.1}, TRIMGALORE={cutadapt=3.4, trimgalore=0.6.7}, UCSC_BEDGRAPHTOBIGWIG={ucsc=377}, Workflow={nf-core/chipseq=2.1.0dev}}" + ], + "timestamp": "2023-06-25T22:30:14+0000" + }, + "bwa/mergedLibrary/": { + "content": [ + "SPT5_INPUT_REP1.mLb.clN.sorted.bam:md5,aaf444d7627fe5e0d2856e3e8a416cb5", + "SPT5_INPUT_REP2.mLb.clN.sorted.bam:md5,0fee8fec43ad772baa865e38d9d37a6a", + "SPT5_T0_REP1.mLb.clN.sorted.bam:md5,7ae794cae2dd2b94c90cd1b6d49e0bb7", + "SPT5_T0_REP2.mLb.clN.sorted.bam:md5,59c588edd52f6545f0ae9dc22f3f7b99", + "SPT5_T15_REP1.mLb.clN.sorted.bam:md5,1413130a432d2c4a9c5304f1cb375237", + "SPT5_T15_REP2.mLb.clN.sorted.bam:md5,9d5d34267094cc2c306237e4794316cc" + ], + "timestamp": "2023-06-25T22:30:14+0000" + } +} \ No newline at end of file diff --git a/tests/pipeline/test_aligner_star.nf.test b/tests/pipeline/test_aligner_star.nf.test new file mode 100644 index 00000000..8c5a1d81 --- /dev/null +++ b/tests/pipeline/test_aligner_star.nf.test @@ -0,0 +1,44 @@ +nextflow_pipeline { + + name "Test Workflow main.nf" + script "main.nf" + tag "test_aligner_star" + tag "pipeline" + + test("Aligner - STAR") { + + when { + params { + outdir = "$outputDir" + aligner = "star" + } + } + + then { + assertAll( + { assert workflow.success }, + { assert snapshot(UTILS.removeNextflowVersion("$outputDir")).match("software_versions") }, + { assert snapshot(path("$outputDir/star/mergedLibrary/SPT5_INPUT_REP1.mLb.clN.sorted.bam"), + path("$outputDir/star/mergedLibrary/SPT5_INPUT_REP2.mLb.clN.sorted.bam"), + path("$outputDir/star/mergedLibrary/SPT5_T0_REP1.mLb.clN.sorted.bam"), + path("$outputDir/star/mergedLibrary/SPT5_T0_REP2.mLb.clN.sorted.bam"), + path("$outputDir/star/mergedLibrary/SPT5_T15_REP1.mLb.clN.sorted.bam"), + path("$outputDir/star/mergedLibrary/SPT5_T15_REP2.mLb.clN.sorted.bam")).match("bwa/mergedLibrary/") }, + { assert new File("$outputDir/star/mergedLibrary/bigwig/").exists() }, + { assert new File("$outputDir/star/mergedLibrary/deepTools/").exists() }, + { assert new File("$outputDir/star/mergedLibrary/macs2/").exists() }, + { assert new File("$outputDir/star/mergedLibrary/phantompeakqualtools/").exists() }, + { assert new File("$outputDir/star/mergedLibrary/picard_metrics/").exists() }, + { assert new File("$outputDir/star/mergedLibrary/samtools_stats/").exists() }, + { assert new File("$outputDir/fastqc/").exists() }, + { assert snapshot(path("$outputDir/genome").list()).match("genome") }, + { assert new File("$outputDir/igv/").exists() }, + { assert new File("$outputDir/multiqc/").exists() }, + { assert new File("$outputDir/pipeline_info/").exists() }, + { assert new File("$outputDir/trimgalore/").exists() } + ) + } + + } + +} diff --git a/tests/pipeline/test_aligner_star.nf.test.snap b/tests/pipeline/test_aligner_star.nf.test.snap new file mode 100644 index 00000000..ec5035f6 --- /dev/null +++ b/tests/pipeline/test_aligner_star.nf.test.snap @@ -0,0 +1,28 @@ +{ + "genome": { + "content": [ + "genome.fa:md5,4bad9f4b18056156a81f7f952abbe125", + "genome.fa.fai:md5,6f4c0ce5258e6948135ad006e1f9ee1b", + "genome.fa.sizes:md5,e122f8021a5ef14104c32785cb9b7adc", + "genome.include_regions.bed:md5,58b27f8faf81d116a596c37be421ce01" + ], + "timestamp": "2023-06-25T22:33:07+0000" + }, + "software_versions": { + "content": [ + "{ANNOTATE_BOOLEAN_PEAKS={sed=4.7}, BAMTOOLS_FILTER={bamtools=2.5.2, samtools=1.15.1}, BAM_REMOVE_ORPHANS={samtools=1.15.1}, BEDTOOLS_GENOMECOV={bedtools=2.30.0}, CUSTOM_DUMPSOFTWAREVERSIONS={python=3.11.0, yaml=6.0}, CUSTOM_GETCHROMSIZES={getchromsizes=1.16.1}, DEEPTOOLS_COMPUTEMATRIX={deeptools=3.5.1}, DEEPTOOLS_PLOTFINGERPRINT={deeptools=3.5.1}, DEEPTOOLS_PLOTHEATMAP={deeptools=3.5.1}, DEEPTOOLS_PLOTPROFILE={deeptools=3.5.1}, FASTQC={fastqc=0.11.9}, FRIP_SCORE={bedtools=2.30.0, samtools=1.15.1}, GENOME_BLACKLIST_REGIONS={bedtools=2.30.0}, GTF2BED={perl=5.26.2}, HOMER_ANNOTATEPEAKS_CONSENSUS={homer=4.11}, HOMER_ANNOTATEPEAKS_MACS2={homer=4.11}, IGV={python=3.8.3}, MACS2_CALLPEAK={macs2=2.2.7.1}, MACS2_CONSENSUS={python=3.10.0, r-base=4.1.1}, PHANTOMPEAKQUALTOOLS={phantompeakqualtools=1.2.2}, PICARD_COLLECTMULTIPLEMETRICS={picard=3.0.0}, PICARD_MARKDUPLICATES={picard=3.0.0}, PICARD_MERGESAMFILES={picard=3.0.0}, PLOT_HOMER_ANNOTATEPEAKS={r-base=4.0.3}, PLOT_MACS2_QC={r-base=4.0.3}, SAMPLESHEET_CHECK={python=3.8.3}, SAMTOOLS_FLAGSTAT={samtools=1.17}, SAMTOOLS_IDXSTATS={samtools=1.17}, SAMTOOLS_INDEX={samtools=1.17}, SAMTOOLS_SORT={samtools=1.17}, SAMTOOLS_STATS={samtools=1.17}, STAR_ALIGN={star=2.6.1d}, STAR_GENOMEGENERATE={star=2.6.1d}, SUBREAD_FEATURECOUNTS={subread=2.0.1}, TRIMGALORE={cutadapt=3.4, trimgalore=0.6.7}, UCSC_BEDGRAPHTOBIGWIG={ucsc=377}, Workflow={nf-core/chipseq=2.1.0dev}}" + ], + "timestamp": "2023-06-25T22:33:07+0000" + }, + "bwa/mergedLibrary/": { + "content": [ + "SPT5_INPUT_REP1.mLb.clN.sorted.bam:md5,1d6e8880d67e495dd1376d2194cec8a4", + "SPT5_INPUT_REP2.mLb.clN.sorted.bam:md5,ad0da738b20b9391a25285dffd427cb6", + "SPT5_T0_REP1.mLb.clN.sorted.bam:md5,39663f6613376984f7ed06f25bf7cedd", + "SPT5_T0_REP2.mLb.clN.sorted.bam:md5,69401828a817dbbfacadbdb20c3e8371", + "SPT5_T15_REP1.mLb.clN.sorted.bam:md5,469c1e4c6d15c4b6591a9ca36017f285", + "SPT5_T15_REP2.mLb.clN.sorted.bam:md5,6cb89042d5a81b79c797e06177a04f41" + ], + "timestamp": "2023-06-25T22:33:07+0000" + } +} \ No newline at end of file diff --git a/tests/pipeline/test_skip_consensus_peaks.nf.test b/tests/pipeline/test_skip_consensus_peaks.nf.test new file mode 100644 index 00000000..39722132 --- /dev/null +++ b/tests/pipeline/test_skip_consensus_peaks.nf.test @@ -0,0 +1,44 @@ +nextflow_pipeline { + + name "Test Workflow main.nf" + script "main.nf" + tag "test_skip_consensus_peaks" + tag "pipeline" + + test("Skip Consesus Peaks") { + + when { + params { + outdir = "$outputDir" + skip_consensus_peaks = true + } + } + + then { + assertAll( + { assert workflow.success }, + { assert snapshot(UTILS.removeNextflowVersion("$outputDir")).match("software_versions") }, + { assert snapshot(path("$outputDir/bwa/mergedLibrary/SPT5_INPUT_REP1.mLb.clN.sorted.bam"), + path("$outputDir/bwa/mergedLibrary/SPT5_INPUT_REP2.mLb.clN.sorted.bam"), + path("$outputDir/bwa/mergedLibrary/SPT5_T0_REP1.mLb.clN.sorted.bam"), + path("$outputDir/bwa/mergedLibrary/SPT5_T0_REP2.mLb.clN.sorted.bam"), + path("$outputDir/bwa/mergedLibrary/SPT5_T15_REP1.mLb.clN.sorted.bam"), + path("$outputDir/bwa/mergedLibrary/SPT5_T15_REP2.mLb.clN.sorted.bam")).match("bwa/mergedLibrary/") }, + { assert new File("$outputDir/bwa/mergedLibrary/bigwig/").exists() }, + { assert new File("$outputDir/bwa/mergedLibrary/deepTools/").exists() }, + { assert new File("$outputDir/bwa/mergedLibrary/macs2/").exists() }, + { assert new File("$outputDir/bwa/mergedLibrary/phantompeakqualtools/").exists() }, + { assert new File("$outputDir/bwa/mergedLibrary/picard_metrics/").exists() }, + { assert new File("$outputDir/bwa/mergedLibrary/samtools_stats/").exists() }, + { assert new File("$outputDir/fastqc/").exists() }, + { assert snapshot(path("$outputDir/genome").list()).match("genome") }, + { assert new File("$outputDir/igv/").exists() }, + { assert new File("$outputDir/multiqc/").exists() }, + { assert new File("$outputDir/pipeline_info/").exists() }, + { assert new File("$outputDir/trimgalore/").exists() } + ) + } + + } + +} diff --git a/tests/pipeline/test_skip_consensus_peaks.nf.test.snap b/tests/pipeline/test_skip_consensus_peaks.nf.test.snap new file mode 100644 index 00000000..217024df --- /dev/null +++ b/tests/pipeline/test_skip_consensus_peaks.nf.test.snap @@ -0,0 +1,28 @@ +{ + "genome": { + "content": [ + "genome.fa:md5,4bad9f4b18056156a81f7f952abbe125", + "genome.fa.fai:md5,6f4c0ce5258e6948135ad006e1f9ee1b", + "genome.fa.sizes:md5,e122f8021a5ef14104c32785cb9b7adc", + "genome.include_regions.bed:md5,58b27f8faf81d116a596c37be421ce01" + ], + "timestamp": "2023-06-25T23:42:37+0000" + }, + "software_versions": { + "content": [ + "{BAMTOOLS_FILTER={bamtools=2.5.2, samtools=1.15.1}, BAM_REMOVE_ORPHANS={samtools=1.15.1}, BEDTOOLS_GENOMECOV={bedtools=2.30.0}, BWA_INDEX={bwa=0.7.17-r1188}, BWA_MEM={bwa=0.7.17-r1188, samtools=1.16.1}, CUSTOM_DUMPSOFTWAREVERSIONS={python=3.11.0, yaml=6.0}, CUSTOM_GETCHROMSIZES={getchromsizes=1.16.1}, DEEPTOOLS_COMPUTEMATRIX={deeptools=3.5.1}, DEEPTOOLS_PLOTFINGERPRINT={deeptools=3.5.1}, DEEPTOOLS_PLOTHEATMAP={deeptools=3.5.1}, DEEPTOOLS_PLOTPROFILE={deeptools=3.5.1}, FASTQC={fastqc=0.11.9}, FRIP_SCORE={bedtools=2.30.0, samtools=1.15.1}, GENOME_BLACKLIST_REGIONS={bedtools=2.30.0}, GTF2BED={perl=5.26.2}, HOMER_ANNOTATEPEAKS_MACS2={homer=4.11}, IGV={python=3.8.3}, MACS2_CALLPEAK={macs2=2.2.7.1}, PHANTOMPEAKQUALTOOLS={phantompeakqualtools=1.2.2}, PICARD_COLLECTMULTIPLEMETRICS={picard=3.0.0}, PICARD_MARKDUPLICATES={picard=3.0.0}, PICARD_MERGESAMFILES={picard=3.0.0}, PLOT_HOMER_ANNOTATEPEAKS={r-base=4.0.3}, PLOT_MACS2_QC={r-base=4.0.3}, SAMPLESHEET_CHECK={python=3.8.3}, SAMTOOLS_FLAGSTAT={samtools=1.17}, SAMTOOLS_IDXSTATS={samtools=1.17}, SAMTOOLS_INDEX={samtools=1.17}, SAMTOOLS_SORT={samtools=1.17}, SAMTOOLS_STATS={samtools=1.17}, TRIMGALORE={cutadapt=3.4, trimgalore=0.6.7}, UCSC_BEDGRAPHTOBIGWIG={ucsc=377}, Workflow={nf-core/chipseq=2.1.0dev}}" + ], + "timestamp": "2023-06-25T23:42:37+0000" + }, + "bwa/mergedLibrary/": { + "content": [ + "SPT5_INPUT_REP1.mLb.clN.sorted.bam:md5,d7bee922bf952cf61386fc16ca4caa97", + "SPT5_INPUT_REP2.mLb.clN.sorted.bam:md5,77546d38f90715f72970ee79115867e8", + "SPT5_T0_REP1.mLb.clN.sorted.bam:md5,9e08abe685744dfbc007b98f75e35a6b", + "SPT5_T0_REP2.mLb.clN.sorted.bam:md5,7a633fa29c9dd0572c20f71c10f3b0e7", + "SPT5_T15_REP1.mLb.clN.sorted.bam:md5,dbfc6b58eee6d28dc56aac5fa38703b1", + "SPT5_T15_REP2.mLb.clN.sorted.bam:md5,b61cb600c3866477c0c3957b779bf5f0" + ], + "timestamp": "2023-06-25T23:42:37+0000" + } +} \ No newline at end of file diff --git a/tests/pipeline/test_skip_trimming.nf.test b/tests/pipeline/test_skip_trimming.nf.test new file mode 100644 index 00000000..554e631b --- /dev/null +++ b/tests/pipeline/test_skip_trimming.nf.test @@ -0,0 +1,44 @@ +nextflow_pipeline { + + name "Test Workflow main.nf" + script "main.nf" + tag "test_skip_trimming" + tag "pipeline" + + test("Skip Trimming") { + + when { + params { + outdir = "$outputDir" + skip_trimming = true + } + } + + then { + assertAll( + { assert workflow.success }, + { assert snapshot(UTILS.removeNextflowVersion("$outputDir")).match("software_versions") }, + { assert snapshot(path("$outputDir/bwa/mergedLibrary/SPT5_INPUT_REP1.mLb.clN.sorted.bam"), + path("$outputDir/bwa/mergedLibrary/SPT5_INPUT_REP2.mLb.clN.sorted.bam"), + path("$outputDir/bwa/mergedLibrary/SPT5_T0_REP1.mLb.clN.sorted.bam"), + path("$outputDir/bwa/mergedLibrary/SPT5_T0_REP2.mLb.clN.sorted.bam"), + path("$outputDir/bwa/mergedLibrary/SPT5_T15_REP1.mLb.clN.sorted.bam"), + path("$outputDir/bwa/mergedLibrary/SPT5_T15_REP2.mLb.clN.sorted.bam")).match("bwa/mergedLibrary/") }, + { assert new File("$outputDir/bwa/mergedLibrary/bigwig/").exists() }, + { assert new File("$outputDir/bwa/mergedLibrary/deepTools/").exists() }, + { assert new File("$outputDir/bwa/mergedLibrary/macs2/").exists() }, + { assert new File("$outputDir/bwa/mergedLibrary/phantompeakqualtools/").exists() }, + { assert new File("$outputDir/bwa/mergedLibrary/picard_metrics/").exists() }, + { assert new File("$outputDir/bwa/mergedLibrary/samtools_stats/").exists() }, + { assert new File("$outputDir/fastqc/").exists() }, + { assert snapshot(path("$outputDir/genome").list()).match("genome") }, + { assert new File("$outputDir/igv/").exists() }, + { assert new File("$outputDir/multiqc/").exists() }, + { assert new File("$outputDir/pipeline_info/").exists() }, + { assert !new File("$outputDir/trimgalore/").exists() } + ) + } + + } + +} diff --git a/tests/pipeline/test_skip_trimming.nf.test.snap b/tests/pipeline/test_skip_trimming.nf.test.snap new file mode 100644 index 00000000..4ab62e11 --- /dev/null +++ b/tests/pipeline/test_skip_trimming.nf.test.snap @@ -0,0 +1,28 @@ +{ + "genome": { + "content": [ + "genome.fa:md5,4bad9f4b18056156a81f7f952abbe125", + "genome.fa.fai:md5,6f4c0ce5258e6948135ad006e1f9ee1b", + "genome.fa.sizes:md5,e122f8021a5ef14104c32785cb9b7adc", + "genome.include_regions.bed:md5,58b27f8faf81d116a596c37be421ce01" + ], + "timestamp": "2023-06-25T23:55:28+0000" + }, + "software_versions": { + "content": [ + "{ANNOTATE_BOOLEAN_PEAKS={sed=4.7}, BAMTOOLS_FILTER={bamtools=2.5.2, samtools=1.15.1}, BAM_REMOVE_ORPHANS={samtools=1.15.1}, BEDTOOLS_GENOMECOV={bedtools=2.30.0}, BWA_INDEX={bwa=0.7.17-r1188}, BWA_MEM={bwa=0.7.17-r1188, samtools=1.16.1}, CUSTOM_DUMPSOFTWAREVERSIONS={python=3.11.0, yaml=6.0}, CUSTOM_GETCHROMSIZES={getchromsizes=1.16.1}, DEEPTOOLS_COMPUTEMATRIX={deeptools=3.5.1}, DEEPTOOLS_PLOTFINGERPRINT={deeptools=3.5.1}, DEEPTOOLS_PLOTHEATMAP={deeptools=3.5.1}, DEEPTOOLS_PLOTPROFILE={deeptools=3.5.1}, FASTQC={fastqc=0.11.9}, FRIP_SCORE={bedtools=2.30.0, samtools=1.15.1}, GENOME_BLACKLIST_REGIONS={bedtools=2.30.0}, GTF2BED={perl=5.26.2}, HOMER_ANNOTATEPEAKS_CONSENSUS={homer=4.11}, HOMER_ANNOTATEPEAKS_MACS2={homer=4.11}, IGV={python=3.8.3}, MACS2_CALLPEAK={macs2=2.2.7.1}, MACS2_CONSENSUS={python=3.10.0, r-base=4.1.1}, PHANTOMPEAKQUALTOOLS={phantompeakqualtools=1.2.2}, PICARD_COLLECTMULTIPLEMETRICS={picard=3.0.0}, PICARD_MARKDUPLICATES={picard=3.0.0}, PICARD_MERGESAMFILES={picard=3.0.0}, PLOT_HOMER_ANNOTATEPEAKS={r-base=4.0.3}, PLOT_MACS2_QC={r-base=4.0.3}, SAMPLESHEET_CHECK={python=3.8.3}, SAMTOOLS_FLAGSTAT={samtools=1.17}, SAMTOOLS_IDXSTATS={samtools=1.17}, SAMTOOLS_INDEX={samtools=1.17}, SAMTOOLS_SORT={samtools=1.17}, SAMTOOLS_STATS={samtools=1.17}, SUBREAD_FEATURECOUNTS={subread=2.0.1}, UCSC_BEDGRAPHTOBIGWIG={ucsc=377}, Workflow={nf-core/chipseq=2.1.0dev}}" + ], + "timestamp": "2023-06-25T23:55:28+0000" + }, + "bwa/mergedLibrary/": { + "content": [ + "SPT5_INPUT_REP1.mLb.clN.sorted.bam:md5,78d3f645ed745f164ca42cce6942086c", + "SPT5_INPUT_REP2.mLb.clN.sorted.bam:md5,f584d049da692581f0cafa75c6adf469", + "SPT5_T0_REP1.mLb.clN.sorted.bam:md5,927de7ba2cb30ee8235f273b3c4a86fc", + "SPT5_T0_REP2.mLb.clN.sorted.bam:md5,9e80eaea382f9fbfd8ce000d1130785f", + "SPT5_T15_REP1.mLb.clN.sorted.bam:md5,0899b798da9eb097a5b3fe29f3e5a056", + "SPT5_T15_REP2.mLb.clN.sorted.bam:md5,25707d4184d1a4a9c11bc52f65f1ce03" + ], + "timestamp": "2023-06-25T23:55:28+0000" + } +} \ No newline at end of file