From af766a9cc749446b53c9e630d7d4274ce56b2eec Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Thu, 5 Dec 2019 15:53:38 +0100 Subject: [PATCH] Added TrimGalore --- .github/workflows/fastqc.yml | 4 +-- .github/workflows/samtools_index.yml | 8 +++--- .github/workflows/samtools_sort.yml | 8 +++--- .github/workflows/trim_galore.yml | 18 ++++++++++++ tools/fastqc/main.nf | 2 +- tools/trim_galore/main.nf | 35 ++++++++++++++++++++++ tools/trim_galore/meta.yml | 43 ++++++++++++++++++++++++++++ tools/trim_galore/test/main.nf | 1 + 8 files changed, 108 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/trim_galore.yml create mode 100644 tools/trim_galore/main.nf create mode 100644 tools/trim_galore/meta.yml create mode 100644 tools/trim_galore/test/main.nf diff --git a/.github/workflows/fastqc.yml b/.github/workflows/fastqc.yml index 14d75a2f..87726302 100644 --- a/.github/workflows/fastqc.yml +++ b/.github/workflows/fastqc.yml @@ -1,3 +1,4 @@ +name: FastQC on: push: paths: tools/fastqc/* @@ -14,5 +15,4 @@ jobs: - uses: actions/checkout@v1 # Test the module - - name: FastQC - run: nextflow run ./tools/fastqc/test/ + - run: nextflow run ./tools/fastqc/test/ diff --git a/.github/workflows/samtools_index.yml b/.github/workflows/samtools_index.yml index fe7da6ae..27df40d1 100644 --- a/.github/workflows/samtools_index.yml +++ b/.github/workflows/samtools_index.yml @@ -1,8 +1,9 @@ +name: samtools index on: push: - paths: tools/samtools/sort* + paths: tools/samtools/index* pull_request: - paths: tools/samtools/sort* + paths: tools/samtools/index* jobs: run_multiqc: @@ -14,5 +15,4 @@ jobs: - uses: actions/checkout@v1 # Test the module - - name: samtools sort - run: nextflow run ./tools/samtools/sort/test/ + - run: nextflow run ./tools/samtools/index/test/ diff --git a/.github/workflows/samtools_sort.yml b/.github/workflows/samtools_sort.yml index 449a27f4..ef066db8 100644 --- a/.github/workflows/samtools_sort.yml +++ b/.github/workflows/samtools_sort.yml @@ -1,8 +1,9 @@ +name: samtools sort on: push: - paths: tools/samtools/index* + paths: tools/samtools/sort* pull_request: - paths: tools/samtools/index* + paths: tools/samtools/sort* jobs: run_multiqc: @@ -14,5 +15,4 @@ jobs: - uses: actions/checkout@v1 # Test the module - - name: samtools index - run: nextflow run ./tools/samtools/index/test/ + - run: nextflow run ./tools/samtools/sort/test/ diff --git a/.github/workflows/trim_galore.yml b/.github/workflows/trim_galore.yml new file mode 100644 index 00000000..053408c4 --- /dev/null +++ b/.github/workflows/trim_galore.yml @@ -0,0 +1,18 @@ +name: Trim Galore! +on: + push: + paths: tools/trim_galore/* + pull_request: + paths: tools/trim_galore/* + +jobs: + run_multiqc: + runs-on: ubuntu-latest + + steps: + + # Check out the repository + - uses: actions/checkout@v1 + + # Test the module + - run: nextflow run ./tools/trim_galore/test/ diff --git a/tools/fastqc/main.nf b/tools/fastqc/main.nf index 6bc53a9c..8fe0db8f 100644 --- a/tools/fastqc/main.nf +++ b/tools/fastqc/main.nf @@ -3,7 +3,7 @@ process fastqc { publishDir "${params.outdir}/fastqc", mode: 'copy', saveAs: {filename -> filename.indexOf(".zip") > 0 ? "zips/$filename" : "$filename"} - container: 'quay.io/biocontainers/fastqc:0.11.8--2' + container: 'quay.io/biocontainers/fastqc:0.11.8--2' input: set val(sample_id), file(reads) diff --git a/tools/trim_galore/main.nf b/tools/trim_galore/main.nf new file mode 100644 index 00000000..ee25639c --- /dev/null +++ b/tools/trim_galore/main.nf @@ -0,0 +1,35 @@ +process fastqc { + tag "$sample_id" + publishDir "${params.outdir}/trim_galore", mode: 'copy', + saveAs: {filename -> + if (filename.indexOf("_fastqc") > 0) "FastQC/$filename" + else if (filename.indexOf("trimming_report.txt") > 0) "logs/$filename" + else filename + } + + container: 'quay.io/biocontainers/trim-galore:0.6.5--0' + + input: + set val(sample_id), file(reads) + + output: + set val(name), file("*fq.gz") + file "*trimming_report.txt" + file "*_fastqc.{zip,html}" + + script: + c_r1 = clip_r1 > 0 ? "--clip_r1 ${clip_r1}" : '' + c_r2 = clip_r2 > 0 ? "--clip_r2 ${clip_r2}" : '' + tpc_r1 = three_prime_clip_r1 > 0 ? "--three_prime_clip_r1 ${three_prime_clip_r1}" : '' + tpc_r2 = three_prime_clip_r2 > 0 ? "--three_prime_clip_r2 ${three_prime_clip_r2}" : '' + nextseq = params.trim_nextseq > 0 ? "--nextseq ${params.trim_nextseq}" : '' + if (params.singleEnd) { + """ + trim_galore --fastqc --gzip $c_r1 $tpc_r1 $nextseq $reads + """ + } else { + """ + trim_galore --paired --fastqc --gzip $c_r1 $c_r2 $tpc_r1 $tpc_r2 $nextseq $reads + """ + } +} diff --git a/tools/trim_galore/meta.yml b/tools/trim_galore/meta.yml new file mode 100644 index 00000000..45fe46fb --- /dev/null +++ b/tools/trim_galore/meta.yml @@ -0,0 +1,43 @@ +name: Trim Galore! +description: Trim FastQ files using Trim Galore! +keywords: + - trimming + - adapters + - sequencing adapters +tools: + - fastqc: + description: | + A wrapper tool around Cutadapt and FastQC to consistently apply quality + and adapter trimming to FastQ files, with some extra functionality for + MspI-digested RRBS-type (Reduced Representation Bisufite-Seq) libraries. + homepage: https://www.bioinformatics.babraham.ac.uk/projects/trim_galore/ + documentation: https://github.com/FelixKrueger/TrimGalore/blob/master/Docs/Trim_Galore_User_Guide.md +input: + - + - sample_id: + type: string + description: Sample identifier + - reads: + type: file + description: Input FastQ file, or pair of files +output: + - + - sample_id: + type: string + description: Sample identifier + - trimmed_fastq: + type: file + description: Trimmed FastQ files + pattern: *fq.gz + - + - report: + type: file + description: Trim Galore! trimming report + pattern: *trimming_report.txt + - + - fastqc_report: + type: file + description: FastQC report + pattern: *_fastqc.{zip,html} +authors: + - @ewels diff --git a/tools/trim_galore/test/main.nf b/tools/trim_galore/test/main.nf new file mode 100644 index 00000000..33242101 --- /dev/null +++ b/tools/trim_galore/test/main.nf @@ -0,0 +1 @@ +/* A mini pipeline to test FastQC here */