diff --git a/.github/workflows/automated_tests.yml b/.github/workflows/automated_tests.yml new file mode 100644 index 0000000..db43ddc --- /dev/null +++ b/.github/workflows/automated_tests.yml @@ -0,0 +1,22 @@ +name: Automated tests + +on: [push] + +jobs: + test: + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v2 + with: + distribution: 'zulu' # See 'Supported distributions' for available options + java-version: '11' + - uses: conda-incubator/setup-miniconda@v2 + - name: Install dependencies + run: | + apt-get update && apt-get --assume-yes install wget make procps software-properties-common + wget -qO- https://get.nextflow.io | bash && cp nextflow /usr/local/bin/nextflow + - name: Run tests + run: | + make \ No newline at end of file diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index e14b36c..0000000 --- a/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM nfcore/base:1.9 -LABEL authors="Pablo Riesgo Ferreiro" \ - description="Docker image containing all software requirements for the TRON-bioinformatics/tron-bwa pipeline" - -# Install the conda environment -COPY environment.yml / -RUN conda env create -f /environment.yml && conda clean -a - -# Add conda installation dir to PATH (instead of doing 'conda activate') -ENV PATH /opt/conda/envs/tronflow-bwa-1.1.0/bin:$PATH - -# Dump the details of the installed packages to a file for posterity -RUN conda env export --name tronflow-bwa-1.1.0 > tronflow-bwa-1.1.0.yml \ No newline at end of file diff --git a/Makefile b/Makefile index b7abe15..be9a9af 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -all : clean test check +all : clean test clean: rm -rf output @@ -7,29 +7,12 @@ clean: rm -rf .nextflow* test: - nextflow main.nf --help - nextflow main.nf -profile test,conda --output output/test1 - nextflow main.nf -profile test,conda --inception --output output/test2 - nextflow main.nf -profile test,conda --library single --output output/test3 - nextflow main.nf -profile test,conda --algorithm mem --output output/test4 - nextflow main.nf -profile test,conda --algorithm mem --library single --output output/test5 - nextflow main.nf -profile test,conda --output output/test6 --input_files false \ - --input_fastq1 test_data/TESTX_S1_L001_R1_001.fastq.gz \ - --input_fastq2 test_data/TESTX_S1_L001_R2_001.fastq.gz --input_name test - nextflow main.nf -profile test,conda --output output/test7 --input_files false \ - --input_fastq1 test_data/TESTX_S1_L001_R1_001.fastq.gz \ - --library single --input_name test - -check: - test -s output/test1/TESTX_S1_L001.bam || { echo "Missing test 1 output file!"; exit 1; } - test -s output/test1/TESTX_S1_L002.bam || { echo "Missing test 1 output file!"; exit 1; } - test -s output/test2/TESTX_S1_L001.bam || { echo "Missing test 2 output file!"; exit 1; } - test -s output/test2/TESTX_S1_L002.bam || { echo "Missing test 2 output file!"; exit 1; } - test -s output/test3/TESTX_S1_L001.bam || { echo "Missing test 3 output file!"; exit 1; } - test -s output/test3/TESTX_S1_L002.bam || { echo "Missing test 3 output file!"; exit 1; } - test -s output/test4/TESTX_S1_L001.bam || { echo "Missing test 4 output file!"; exit 1; } - test -s output/test4/TESTX_S1_L002.bam || { echo "Missing test 4 output file!"; exit 1; } - test -s output/test5/TESTX_S1_L001.bam || { echo "Missing test 5 output file!"; exit 1; } - test -s output/test5/TESTX_S1_L002.bam || { echo "Missing test 5 output file!"; exit 1; } - test -s output/test6/test.bam || { echo "Missing test 6 output file!"; exit 1; } - test -s output/test7/test.bam || { echo "Missing test 7 output file!"; exit 1; } + bash tests/run_test_0.sh + bash tests/run_test_1.sh + bash tests/run_test_2.sh + bash tests/run_test_3.sh + bash tests/run_test_4.sh + bash tests/run_test_5.sh + bash tests/run_test_6.sh + bash tests/run_test_7.sh + bash tests/run_test_8.sh diff --git a/README.md b/README.md index ba528cf..17ba2c0 100755 --- a/README.md +++ b/README.md @@ -1,37 +1,40 @@ # TronFlow BWA pipeline ![GitHub tag (latest SemVer)](https://img.shields.io/github/v/release/tron-bioinformatics/tronflow-bwa?sort=semver) +[![Run tests](https://github.com/TRON-Bioinformatics/tronflow-bwa/actions/workflows/automated_tests.yml/badge.svg?branch=master)](https://github.com/TRON-Bioinformatics/tronflow-bwa/actions/workflows/automated_tests.yml) [![DOI](https://zenodo.org/badge/327943420.svg)](https://zenodo.org/badge/latestdoi/327943420) [![License](https://img.shields.io/badge/license-MIT-green)](https://opensource.org/licenses/MIT) [![Powered by Nextflow](https://img.shields.io/badge/powered%20by-Nextflow-orange.svg?style=flat&colorA=E1523D&colorB=007D8A)](https://www.nextflow.io/) Nextflow pipeline for the alignment of paired and single end FASTQ files with BWA aln and mem algorithms. +It includes an initial step of read trimming using FASTP. ## Requirements -There are two packages that are required for this pipeline. Both of this are preconfigured when using the conda or docker profiles. +There are three packages that are required for this pipeline. Both of this are preconfigured when using the conda profile. -- BWA 0.7.17 -- samtools 1.12 +- BWA +- samtools +- FASTP ## How to run it Run it from GitHub as follows: ``` -nextflow run tron-bioinformatics/tronflow-bwa --input_files $input --output $output --algorithm aln --library paired -profile conda,standard +nextflow run tron-bioinformatics/tronflow-bwa -r v1.5.0 -profile conda --input_files $input --output $output --algorithm aln --library paired ``` Otherwise download the project and run as follows: ``` -nextflow main.nf --input_files $input --output $output --algorithm aln --library paired -profile conda,standard +nextflow main.nf -profile conda --input_files $input --output $output --algorithm aln --library paired ``` Find the help as follows: ``` $ nextflow run tron-bioinformatics/tronflow-bwa --help N E X T F L O W ~ version 19.07.0 -Launching `bam_preprocessing.nf` [intergalactic_shannon] - revision: e707c77d7b +Launching `main.nf` [intergalactic_shannon] - revision: e707c77d7b Usage: nextflow main.nf --input_files input_files [--reference reference.fasta] @@ -53,12 +56,10 @@ Optional input: * cpus: determines the number of CPUs for each job, with the exception of bwa sampe and samse steps which are not parallelized (default: 8) * memory: determines the memory required by each job (default: 8g) * inception: if enabled it uses an inception, only valid for BWA aln, it requires a fast file system such as flash (default: false) + * skip_trimming: skips the read trimming step Output: * A BAM file \${name}.bam -``` - -You can run it with a conda environment using the option `-profile` such as: -``` -$ nextflow main.nf --input_files test_data/test_input.txt --reference `pwd`/test_data/ucsc.hg19.minimal.fasta -profile conda + * FASTP read trimming stats report in HTML format \${name.fastp_stats.html} + * FASTP read trimming stats report in JSON format \${name.fastp_stats.json} ``` diff --git a/environment.yml b/environment.yml deleted file mode 100644 index 3311280..0000000 --- a/environment.yml +++ /dev/null @@ -1,10 +0,0 @@ -# You can use this file to create a conda environment for this pipeline: -# conda env create -f environment.yml -name: tronflow-bwa -channels: - - conda-forge - - bioconda - - defaults -dependencies: - - bioconda::bwa=0.7.17 - - bioconda::samtools=1.12 \ No newline at end of file diff --git a/main.nf b/main.nf index aa239e2..8d48356 100755 --- a/main.nf +++ b/main.nf @@ -1,5 +1,11 @@ #!/usr/bin/env nextflow +nextflow.enable.dsl = 2 + +include { FASTP_PAIRED; FASTP_SINGLE } from './modules/fastp' +include { BWA_ALN; BWA_ALN as BWA_ALN_2; BWA_SAMPE; BWA_SAMSE; BWA_ALN_INCEPTION } from './modules/bwa_aln' +include { BWA_MEM; BWA_MEM_SE } from './modules/bwa_mem' + params.help= false params.input_files = false params.input_fastq1 = false @@ -12,6 +18,7 @@ params.library = "paired" params.cpus = 8 params.memory = "8g" params.inception = false +params.skip_trimming = false if (params.help) { @@ -69,158 +76,49 @@ else if (params.input_files) { exit 1, "--input_name is not provided!" } -if (params.algorithm == "aln" && params.library == "paired" && !params.inception) { - - input_files.into { input_files_1; input_files_2 } - - process bwaAln1 { - cpus "${params.cpus}" - memory "${params.memory}" - tag "${name}" - - input: - set name, file(fastq1), file(fastq2) from input_files_1 - - output: - set val("${name}"), file("${fastq1}"), file("${fastq1.baseName}.sai") into alignment_output1 - - """ - bwa aln -t ${task.cpus} ${params.reference} ${fastq1} > ${fastq1.baseName}.sai - """ - } - - process bwaAln2 { - cpus "${params.cpus}" - memory "${params.memory}" - tag "${name}" - - input: - set name, file(fastq1), file(fastq2) from input_files_2 - - output: - set val("${name}"), file("${fastq2}"), file("${fastq2.baseName}.sai") into alignment_output2 - - """ - bwa aln -t ${task.cpus} ${params.reference} ${fastq2} > ${fastq2.baseName}.sai - """ - } - - process bwaSampe { - cpus 1 - memory params.memory - tag "${name}" - publishDir params.output, mode: "move" - - input: - // joins both channels by key using the first element in the tuple, the name - set name, file(fastq1), file(sai1), file(fastq2), file(sai2) from alignment_output1.join(alignment_output2) - - output: - set val("${name}"), file("${name}.bam") into sampe_output - - """ - bwa sampe ${params.reference} ${sai1} ${sai2} ${fastq1} ${fastq2} | samtools view -uS - | samtools sort - > ${name}.bam - """ - } -} -else if (params.algorithm == "aln" && params.library == "single" && !params.inception) { - - process bwaAln { - cpus "${params.cpus}" - memory "${params.memory}" - tag "${name}" - - input: - set name, file(fastq) from input_files - - output: - set val("${name}"), file("${fastq}"), file("${fastq.baseName}.sai") into alignment_output - - """ - bwa aln -t ${task.cpus} ${params.reference} ${fastq} > ${fastq.baseName}.sai - """ - } - - process bwaSamse { - cpus 1 - memory "${params.memory}" - tag "${name}" - publishDir params.output, mode: "move" - - input: - // joins both channels by key using the first element in the tuple, the name - set name, file(fastq), file(sai) from alignment_output - - output: - set val("${name}"), file("${name}.bam") into samse_output - - """ - bwa samse ${params.reference} ${sai} ${fastq} | samtools view -uS - | samtools sort - > ${name}.bam - """ - } -} -else if (params.algorithm == "aln" && params.library == "paired" && params.inception) { - - process bwaAlnInception { - cpus "${params.cpus}".toInteger() * 2 - memory "${params.memory}" - tag "${name}" - publishDir params.output, mode: "move" - - input: - // joins both channels by key using the first element in the tuple, the name - set name, file(fastq1), file(fastq2) from input_files - - output: - set val("${name}"), file("${name}.bam") into sampe_output - - """ - bwa sampe ${params.reference} <( bwa aln -t ${params.cpus} ${params.reference} ${fastq1} ) \ - <( bwa aln -t ${params.cpus} ${params.reference} ${fastq2} ) ${fastq1} ${fastq2} \ - | samtools view -uS - | samtools sort - > ${name}.bam - """ +workflow { + if (params.library == "paired") { + if (params.skip_trimming) { + trimmed_fastqs = input_files + } + else { + FASTP_PAIRED(input_files) + trimmed_fastqs = FASTP_PAIRED.out.trimmed_fastqs + } + if (params.algorithm == "aln" && !params.inception) { + BWA_ALN(trimmed_fastqs.map {name, fq1, fq2 -> tuple(name, fq1)}) + BWA_ALN_2(trimmed_fastqs.map {name, fq1, fq2 -> tuple(name, fq2)}) + BWA_SAMPE(BWA_ALN.out.alignment_output.join(BWA_ALN_2.out.alignment_output)) + } + else if (params.algorithm == "aln" && params.inception) { + BWA_ALN_INCEPTION(trimmed_fastqs) + } + else if (params.algorithm == "mem") { + BWA_MEM(trimmed_fastqs) + } + else { + exit 1, "Unsupported configuration!" + } } -} -else if (params.algorithm == "mem" && params.library == "paired") { - - process bwaMem { - cpus "${params.cpus}" - memory "${params.memory}" - tag "${name}" - publishDir params.output, mode: "move" - - input: - // joins both channels by key using the first element in the tuple, the name - set name, file(fastq1), file(fastq2) from input_files - - output: - set val("${name}"), file("${name}.bam") into sampe_output - - """ - bwa mem -t ${task.cpus} ${params.reference} ${fastq1} ${fastq2} | samtools view -uS - | samtools sort - > ${name}.bam - """ + else if (params.library == "single") { + if (params.skip_trimming) { + trimmed_fastqs = input_files + } + else { + FASTP_SINGLE(input_files) + trimmed_fastqs = FASTP_SINGLE.out.trimmed_fastqs + } + if (params.algorithm == "aln" && !params.inception) { + BWA_SAMSE(BWA_ALN(trimmed_fastqs)) + } + else if (params.algorithm == "mem") { + BWA_MEM_SE(trimmed_fastqs) + } + else { + exit 1, "Unsupported configuration!" + } } -} -else if (params.algorithm == "mem" && params.library == "single") { - - process bwaMemSe { - cpus "${params.cpus}" - memory "${params.memory}" - tag "${name}" - publishDir params.output, mode: "move" - - input: - // joins both channels by key using the first element in the tuple, the name - set name, file(fastq) from input_files - - output: - set val("${name}"), file("${name}.bam") into sampe_output - - """ - bwa mem -t ${task.cpus} ${params.reference} ${fastq} | samtools view -uS - | samtools sort - > ${name}.bam - """ + else { + exit 1, "Unsupported configuration!" } } -else { - exit 1, "Unsupported configuration!" -} diff --git a/modules/bwa_aln.nf b/modules/bwa_aln.nf new file mode 100644 index 0000000..3ed7a27 --- /dev/null +++ b/modules/bwa_aln.nf @@ -0,0 +1,85 @@ +params.cpus = 8 +params.memory = "8g" +params.reference = false +params.enable_conda = false + + +process BWA_ALN { + cpus "${params.cpus}" + memory "${params.memory}" + tag "${name}" + + conda (params.enable_conda ? "bioconda::bwa=0.7.17 bioconda::samtools=1.12" : null) + + input: + tuple val(name), file(fastq) + + output: + tuple val("${name}"), file("${fastq}"), file("${fastq.baseName}.sai"), emit: alignment_output + + """ + bwa aln -t ${task.cpus} ${params.reference} ${fastq} > ${fastq.baseName}.sai + """ +} + +process BWA_SAMPE { + cpus 1 + memory params.memory + tag "${name}" + publishDir params.output, mode: "move" + + conda (params.enable_conda ? "bioconda::bwa=0.7.17 bioconda::samtools=1.12" : null) + + input: + // joins both channels by key using the first element in the tuple, the name + tuple val(name), file(fastq1), file(sai1), file(fastq2), file(sai2) + + output: + tuple val("${name}"), file("${name}.bam"), emit: sampe_output + + """ + bwa sampe ${params.reference} ${sai1} ${sai2} ${fastq1} ${fastq2} | samtools view -uS - | samtools sort - > ${name}.bam + """ +} + +process BWA_SAMSE { + cpus 1 + memory "${params.memory}" + tag "${name}" + publishDir params.output, mode: "move" + + conda (params.enable_conda ? "bioconda::bwa=0.7.17 bioconda::samtools=1.12" : null) + + input: + // joins both channels by key using the first element in the tuple, the name + tuple val(name), file(fastq), file(sai) + + output: + tuple val("${name}"), file("${name}.bam"), emit: samse_output + + """ + bwa samse ${params.reference} ${sai} ${fastq} | samtools view -uS - | samtools sort - > ${name}.bam + """ +} + +process BWA_ALN_INCEPTION { + cpus "${params.cpus}".toInteger() * 2 + memory "${params.memory}" + tag "${name}" + publishDir params.output, mode: "move" + + conda (params.enable_conda ? "bioconda::bwa=0.7.17 bioconda::samtools=1.12" : null) + + input: + // joins both channels by key using the first element in the tuple, the name + tuple val(name), file(fastq1), file(fastq2) + + output: + tuple val("${name}"), file("${name}.bam"), emit: sampe_output + + """ + bwa sampe ${params.reference} <( bwa aln -t ${params.cpus} ${params.reference} ${fastq1} ) \ + <( bwa aln -t ${params.cpus} ${params.reference} ${fastq2} ) ${fastq1} ${fastq2} \ + | samtools view -uS - | samtools sort - > ${name}.bam + """ +} diff --git a/modules/bwa_mem.nf b/modules/bwa_mem.nf new file mode 100644 index 0000000..d20c165 --- /dev/null +++ b/modules/bwa_mem.nf @@ -0,0 +1,45 @@ +params.cpus = 8 +params.memory = "8g" +params.reference = false +params.enable_conda = false + + +process BWA_MEM { + cpus "${params.cpus}" + memory "${params.memory}" + tag "${name}" + publishDir params.output, mode: "move" + + conda (params.enable_conda ? "bioconda::bwa=0.7.17 bioconda::samtools=1.12" : null) + + input: + // joins both channels by key using the first element in the tuple, the name + tuple val(name), file(fastq1), file(fastq2) + + output: + tuple val("${name}"), file("${name}.bam"), emit: sampe_output + + """ + bwa mem -t ${task.cpus} ${params.reference} ${fastq1} ${fastq2} | samtools view -uS - | samtools sort - > ${name}.bam + """ +} + +process BWA_MEM_SE { + cpus "${params.cpus}" + memory "${params.memory}" + tag "${name}" + publishDir params.output, mode: "move" + + conda (params.enable_conda ? "bioconda::bwa=0.7.17 bioconda::samtools=1.12" : null) + + input: + // joins both channels by key using the first element in the tuple, the name + tuple val(name), file(fastq) + + output: + tuple val("${name}"), file("${name}.bam"), emit: sampe_output + + """ + bwa mem -t ${task.cpus} ${params.reference} ${fastq} | samtools view -uS - | samtools sort - > ${name}.bam + """ +} diff --git a/modules/fastp.nf b/modules/fastp.nf new file mode 100644 index 0000000..49e05ec --- /dev/null +++ b/modules/fastp.nf @@ -0,0 +1,59 @@ +params.memory = "3g" +params.cpus = 1 +params.output = "." +params.enable_conda = false +params.enable_docker = true + + +process FASTP_PAIRED { + cpus params.cpus + memory params.memory + publishDir "${params.output}", mode: "copy", pattern: "*fastp_stats*" + + conda (params.enable_conda ? "bioconda::fastp=0.20.1" : null) + + input: + tuple val(name), file(fastq1), file(fastq2) + + output: + tuple val(name), file("${fastq1.baseName}.trimmed.fq.gz"), + file("${fastq2.baseName}.trimmed.fq.gz"), emit: trimmed_fastqs + file("${name}.fastp_stats.json") + file("${name}.fastp_stats.html") + + """ + # --input_files needs to be forced, otherwise it is inherited from profile in tests + fastp \ + --in1 ${fastq1} \ + --in2 ${fastq2} \ + --out1 ${fastq1.baseName}.trimmed.fq.gz \ + --out2 ${fastq2.baseName}.trimmed.fq.gz \ + --json ${name}.fastp_stats.json \ + --html ${name}.fastp_stats.html + """ +} + +process FASTP_SINGLE { + cpus params.cpus + memory params.memory + publishDir "${params.output}", mode: "copy", pattern: "*fastp_stats*" + + conda (params.enable_conda ? "bioconda::fastp=0.20.1" : null) + + input: + tuple val(name), file(fastq1) + + output: + tuple val(name), file("${fastq1.baseName}.trimmed.fq.gz"), emit: trimmed_fastqs + file("${name}.fastp_stats.json") + file("${name}.fastp_stats.html") + + """ + # --input_files needs to be forced, otherwise it is inherited from profile in tests + fastp \ + --in1 ${fastq1} \ + --out1 ${fastq1.baseName}.trimmed.fq.gz \ + --json ${name}.fastp_stats.json \ + --html ${name}.fastp_stats.html + """ +} \ No newline at end of file diff --git a/nextflow.config b/nextflow.config index 8e88248..1fc94a7 100644 --- a/nextflow.config +++ b/nextflow.config @@ -4,9 +4,10 @@ * ------------------------------------------------- */ - profiles { - conda { process.conda = "$baseDir/environment.yml" } + conda { + params.enable_conda = true + } debug { process.beforeScript = 'echo $HOSTNAME' } test { params.input_files = "test_data/test_input_paired.txt" @@ -30,7 +31,7 @@ process.shell = ['/bin/bash', '-euo', 'pipefail'] cleanup = true -VERSION = "1.4.1" +VERSION = "1.5.0" manifest { name = 'TRON-Bioinformatics/tronflow-bwa' @@ -65,7 +66,10 @@ Optional input: * cpus: determines the number of CPUs for each job, with the exception of bwa sampe and samse steps which are not parallelized (default: 8) * memory: determines the memory required by each job (default: 8g) * inception: if enabled it uses an inception, only valid for BWA aln, it requires a fast file system such as flash (default: false) + * skip_trimming: skips the read trimming step Output: * A BAM file \${name}.bam + * FASTP read trimming stats report in HTML format \${name.fastp_stats.html} + * FASTP read trimming stats report in JSON format \${name.fastp_stats.json} """ diff --git a/tests/run_test_0.sh b/tests/run_test_0.sh new file mode 100644 index 0000000..5629ccd --- /dev/null +++ b/tests/run_test_0.sh @@ -0,0 +1,4 @@ +#!/bin/bash + + +nextflow main.nf --help \ No newline at end of file diff --git a/tests/run_test_1.sh b/tests/run_test_1.sh new file mode 100644 index 0000000..9e64787 --- /dev/null +++ b/tests/run_test_1.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +output_folder=output/test1 +nextflow main.nf -profile test,conda --output $output_folder +test -s $output_folder/TESTX_S1_L001.bam || { echo "Missing test 1 output file!"; exit 1; } +test -s $output_folder/TESTX_S1_L001.fastp_stats.html || { echo "Missing test 1 output file!"; exit 1; } +test -s $output_folder/TESTX_S1_L001.fastp_stats.json || { echo "Missing test 1 output file!"; exit 1; } +test -s $output_folder/TESTX_S1_L002.bam || { echo "Missing test 1 output file!"; exit 1; } +test -s $output_folder/TESTX_S1_L002.fastp_stats.html || { echo "Missing test 1 output file!"; exit 1; } +test -s $output_folder/TESTX_S1_L002.fastp_stats.json || { echo "Missing test 1 output file!"; exit 1; } \ No newline at end of file diff --git a/tests/run_test_2.sh b/tests/run_test_2.sh new file mode 100644 index 0000000..e3f3b05 --- /dev/null +++ b/tests/run_test_2.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +output_folder=output/test2 +nextflow main.nf -profile test,conda --inception --output $output_folder +test -s $output_folder/TESTX_S1_L001.bam || { echo "Missing test 2 output file!"; exit 1; } +test -s $output_folder/TESTX_S1_L001.fastp_stats.html || { echo "Missing test 2 output file!"; exit 1; } +test -s $output_folder/TESTX_S1_L001.fastp_stats.json || { echo "Missing test 2 output file!"; exit 1; } +test -s $output_folder/TESTX_S1_L002.bam || { echo "Missing test 2 output file!"; exit 1; } +test -s $output_folder/TESTX_S1_L002.fastp_stats.html || { echo "Missing test 2 output file!"; exit 1; } +test -s $output_folder/TESTX_S1_L002.fastp_stats.json || { echo "Missing test 2 output file!"; exit 1; } \ No newline at end of file diff --git a/tests/run_test_3.sh b/tests/run_test_3.sh new file mode 100644 index 0000000..5afbec1 --- /dev/null +++ b/tests/run_test_3.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +output_folder=output/test3 +nextflow main.nf -profile test,conda --library single --output $output_folder +test -s $output_folder/TESTX_S1_L001.bam || { echo "Missing test 3 output file!"; exit 1; } +test -s $output_folder/TESTX_S1_L001.fastp_stats.html || { echo "Missing test 3 output file!"; exit 1; } +test -s $output_folder/TESTX_S1_L001.fastp_stats.json || { echo "Missing test 4 output file!"; exit 1; } +test -s $output_folder/TESTX_S1_L002.bam || { echo "Missing test 3 output file!"; exit 1; } +test -s $output_folder/TESTX_S1_L002.fastp_stats.html || { echo "Missing test 3 output file!"; exit 1; } +test -s $output_folder/TESTX_S1_L002.fastp_stats.json || { echo "Missing test 3 output file!"; exit 1; } \ No newline at end of file diff --git a/tests/run_test_4.sh b/tests/run_test_4.sh new file mode 100644 index 0000000..55c441b --- /dev/null +++ b/tests/run_test_4.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +output_folder=output/test4 +nextflow main.nf -profile test,conda --algorithm mem --output $output_folder +test -s $output_folder/TESTX_S1_L001.bam || { echo "Missing test 4 output file!"; exit 1; } +test -s $output_folder/TESTX_S1_L001.fastp_stats.html || { echo "Missing test 4 output file!"; exit 1; } +test -s $output_folder/TESTX_S1_L001.fastp_stats.json || { echo "Missing test 4 output file!"; exit 1; } +test -s $output_folder/TESTX_S1_L002.bam || { echo "Missing test 4 output file!"; exit 1; } +test -s $output_folder/TESTX_S1_L002.fastp_stats.html || { echo "Missing test 4 output file!"; exit 1; } +test -s $output_folder/TESTX_S1_L002.fastp_stats.json || { echo "Missing test 4 output file!"; exit 1; } \ No newline at end of file diff --git a/tests/run_test_5.sh b/tests/run_test_5.sh new file mode 100644 index 0000000..30bb6a2 --- /dev/null +++ b/tests/run_test_5.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +output_folder=output/test5 +nextflow main.nf -profile test,conda --algorithm mem --library single --output $output_folder +test -s $output_folder/TESTX_S1_L001.bam || { echo "Missing test 5 output file!"; exit 1; } +test -s $output_folder/TESTX_S1_L001.fastp_stats.html || { echo "Missing test 5 output file!"; exit 1; } +test -s $output_folder/TESTX_S1_L001.fastp_stats.json || { echo "Missing test 5 output file!"; exit 1; } +test -s $output_folder/TESTX_S1_L002.bam || { echo "Missing test 5 output file!"; exit 1; } +test -s $output_folder/TESTX_S1_L002.fastp_stats.html || { echo "Missing test 5 output file!"; exit 1; } +test -s $output_folder/TESTX_S1_L002.fastp_stats.json || { echo "Missing test 5 output file!"; exit 1; } \ No newline at end of file diff --git a/tests/run_test_6.sh b/tests/run_test_6.sh new file mode 100644 index 0000000..f278fcb --- /dev/null +++ b/tests/run_test_6.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +output_folder=output/test6 +nextflow main.nf -profile test,conda --output $output_folder --input_files false \ +--input_fastq1 test_data/TESTX_S1_L001_R1_001.fastq.gz \ +--input_fastq2 test_data/TESTX_S1_L001_R2_001.fastq.gz --input_name test +test -s $output_folder/test.bam || { echo "Missing test 6 output file!"; exit 1; } +test -s $output_folder/test.fastp_stats.html || { echo "Missing test 6 output file!"; exit 1; } +test -s $output_folder/test.fastp_stats.json || { echo "Missing test 6 output file!"; exit 1; } \ No newline at end of file diff --git a/tests/run_test_7.sh b/tests/run_test_7.sh new file mode 100644 index 0000000..dbf32bb --- /dev/null +++ b/tests/run_test_7.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +output_folder=output/test7 +nextflow main.nf -profile test,conda --output $output_folder --input_files false \ +--input_fastq1 test_data/TESTX_S1_L001_R1_001.fastq.gz \ +--library single --input_name test +test -s $output_folder/test.bam || { echo "Missing test 7 output file!"; exit 1; } +test -s $output_folder/test.fastp_stats.html || { echo "Missing test 7 output file!"; exit 1; } +test -s $output_folder/test.fastp_stats.json || { echo "Missing test 7 output file!"; exit 1; } \ No newline at end of file diff --git a/tests/run_test_8.sh b/tests/run_test_8.sh new file mode 100644 index 0000000..30817c0 --- /dev/null +++ b/tests/run_test_8.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +output_folder=output/test8 +nextflow main.nf -profile test,conda --algorithm mem --skip_trimming --output $output_folder +test -s $output_folder/TESTX_S1_L001.bam || { echo "Missing test 8 output file!"; exit 1; } +if [ -f $output_folder/TESTX_S1_L001.fastp_stats.html ]; then + echo "This file should not exist!"; exit 1; +fi +if [ -f $output_folder/TESTX_S1_L001.fastp_stats.json ]; then + echo "This file should not exist!"; exit 1; +fi + +test -s $output_folder/TESTX_S1_L002.bam || { echo "Missing test 8 output file!"; exit 1; } +if [ -f $output_folder/TESTX_S1_L002.fastp_stats.html ]; then + echo "This file should not exist!"; exit 1; +fi +if [ -f $output_folder/TESTX_S1_L002.fastp_stats.json ]; then + echo "This file should not exist!"; exit 1; +fi \ No newline at end of file