From 97fbd3264485b2c2fe719bc3c1bcd9d4476eda86 Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Thu, 5 Dec 2019 15:35:51 +0100 Subject: [PATCH] Added samtools sort + index Added container to FastQC --- .github/workflows/test-processes.yml | 8 ++++++ tools/fastqc/main.nf | 38 +++++++++++++++------------- tools/fastqc/meta.yml | 2 +- tools/samtools/index/main.nf | 22 ++++++++++++++++ tools/samtools/index/meta.yml | 27 ++++++++++++++++++++ tools/samtools/index/test/main.nf | 1 + tools/samtools/sort/main.nf | 18 +++++++++++++ tools/samtools/sort/meta.yml | 27 ++++++++++++++++++++ tools/samtools/sort/test/main.nf | 1 + 9 files changed, 125 insertions(+), 19 deletions(-) create mode 100644 tools/samtools/index/main.nf create mode 100644 tools/samtools/index/meta.yml create mode 100644 tools/samtools/index/test/main.nf create mode 100644 tools/samtools/sort/main.nf create mode 100644 tools/samtools/sort/meta.yml create mode 100644 tools/samtools/sort/test/main.nf diff --git a/.github/workflows/test-processes.yml b/.github/workflows/test-processes.yml index b9c56955..2fb14e95 100644 --- a/.github/workflows/test-processes.yml +++ b/.github/workflows/test-processes.yml @@ -16,3 +16,11 @@ jobs: - name: FastQC path: tools/fastqc/* run: nextflow run ./tools/fastqc/test/ + + - name: samtools sort + path: tools/samtoosl/sort* + run: nextflow run ./tools/samtools/sort/test/ + + - name: samtools index + path: tools/samtoosl/index* + run: nextflow run ./tools/samtools/index/test/ diff --git a/tools/fastqc/main.nf b/tools/fastqc/main.nf index deb570ff..6bc53a9c 100644 --- a/tools/fastqc/main.nf +++ b/tools/fastqc/main.nf @@ -1,18 +1,20 @@ -process fastqc { - tag "$sample_id" - publishDir "${params.outdir}/fastqc", mode: 'copy', - saveAs: {filename -> filename.indexOf(".zip") > 0 ? "zips/$filename" : "$filename"} - - input: - set val(sample_id), file(reads) - - output: - file "*_fastqc.{zip,html}" - - script: - """ - fastqc -q $reads - - fastqc --version &> fastqc.version.txt - """ -} +process fastqc { + tag "$sample_id" + publishDir "${params.outdir}/fastqc", mode: 'copy', + saveAs: {filename -> filename.indexOf(".zip") > 0 ? "zips/$filename" : "$filename"} + + container: 'quay.io/biocontainers/fastqc:0.11.8--2' + + input: + set val(sample_id), file(reads) + + output: + file "*_fastqc.{zip,html}" + + script: + """ + fastqc -q $reads + + fastqc --version &> fastqc.version.txt + """ +} diff --git a/tools/fastqc/meta.yml b/tools/fastqc/meta.yml index ddd0ae7f..0d5afc23 100644 --- a/tools/fastqc/meta.yml +++ b/tools/fastqc/meta.yml @@ -12,7 +12,7 @@ tools: across your reads, the per base sequence content (%A/C/G/T). You get information about adapter contamination and other overrepresented sequences. - homepage: hhttps://www.bioinformatics.babraham.ac.uk/projects/fastqc/ + homepage: https://www.bioinformatics.babraham.ac.uk/projects/fastqc/ documentation: https://www.bioinformatics.babraham.ac.uk/projects/fastqc/Help/ input: - diff --git a/tools/samtools/index/main.nf b/tools/samtools/index/main.nf new file mode 100644 index 00000000..8d29f824 --- /dev/null +++ b/tools/samtools/index/main.nf @@ -0,0 +1,22 @@ +process samtools_index { + tag "${bam.baseName}" + + container: 'quay.io/biocontainers/samtools:1.9--h10a08f8_12' + + input: + set file(bam) + + output: + file "*.sorted.bam" + + script: + def suff_mem = ("${(task.memory.toBytes() - 6000000000) / task.cpus}" > 2000000000) ? 'true' : 'false' + def avail_mem = (task.memory && suff_mem) ? "-m" + "${(task.memory.toBytes() - 6000000000) / task.cpus}" : '' + """ + samtools sort $bam \\ + -@ ${task.cpus} ${avail_mem} \\ + -o ${bam.baseName}.sorted.bam + + samtools --version &> v_samtools.txt + """ +} diff --git a/tools/samtools/index/meta.yml b/tools/samtools/index/meta.yml new file mode 100644 index 00000000..3cd7a402 --- /dev/null +++ b/tools/samtools/index/meta.yml @@ -0,0 +1,27 @@ +name: samtools sort +description: Sort a BAM or CRAM file +keywords: + - sort +tools: + - samtools: + description: | + SAMtools is a set of utilities for interacting with and post-processing + short DNA sequence read alignments in the SAM, BAM and CRAM formats, written by Heng Li. + These files are generated as output by short read aligners like BWA. + homepage: http://www.htslib.org/ + documentation: hhttp://www.htslib.org/doc/samtools.html + doi: 10.1093/bioinformatics/btp352 +input: + - + - input: + type: file + description: Input BAM or CRAM file + pattern: *.{bam,cram} +output: + - + - index: + type: file + description: BAM or CRAM index file + pattern: *.{bai} +authors: + - @ewels diff --git a/tools/samtools/index/test/main.nf b/tools/samtools/index/test/main.nf new file mode 100644 index 00000000..2e9ae0f5 --- /dev/null +++ b/tools/samtools/index/test/main.nf @@ -0,0 +1 @@ +/* A mini pipeline to test samtools index here */ diff --git a/tools/samtools/sort/main.nf b/tools/samtools/sort/main.nf new file mode 100644 index 00000000..696c8872 --- /dev/null +++ b/tools/samtools/sort/main.nf @@ -0,0 +1,18 @@ +process samtools_index { + tag "${bam.baseName}" + + container: 'quay.io/biocontainers/samtools:1.9--h10a08f8_12' + + input: + set file(bam) + + output: + file "*.bam.bai" + + script: + """ + samtools index $bam + + samtools --version &> v_samtools.txt + """ +} diff --git a/tools/samtools/sort/meta.yml b/tools/samtools/sort/meta.yml new file mode 100644 index 00000000..60f9e96b --- /dev/null +++ b/tools/samtools/sort/meta.yml @@ -0,0 +1,27 @@ +name: samtools sort +description: Sort a BAM or CRAM file +keywords: + - sort +tools: + - samtools: + description: | + SAMtools is a set of utilities for interacting with and post-processing + short DNA sequence read alignments in the SAM, BAM and CRAM formats, written by Heng Li. + These files are generated as output by short read aligners like BWA. + homepage: http://www.htslib.org/ + documentation: hhttp://www.htslib.org/doc/samtools.html + doi: 10.1093/bioinformatics/btp352 +input: + - + - input: + type: file + description: Input BAM or CRAM file + pattern: *.{bam,cram} +output: + - + - sorted_file: + type: file + description: Sorted BAM or CRAM file + pattern: *.{bam,cram} +authors: + - @ewels diff --git a/tools/samtools/sort/test/main.nf b/tools/samtools/sort/test/main.nf new file mode 100644 index 00000000..6e0055e2 --- /dev/null +++ b/tools/samtools/sort/test/main.nf @@ -0,0 +1 @@ +/* A mini pipeline to test samtools sort here */