From a4836ae3c3badacf0ec3affd6d19a4a09ca0f227 Mon Sep 17 00:00:00 2001 From: Jeremy1805 Date: Thu, 5 Mar 2020 16:06:25 +0000 Subject: [PATCH 1/3] Added tools/bwa/mem --- .gitignore | 1 + tools/bwa/mem/Dockerfile | 9 +++++++ tools/bwa/mem/environment.yml | 10 +++++++ tools/bwa/mem/main.nf | 27 +++++++++++++++++++ tools/bwa/mem/meta.yml | 43 ++++++++++++++++++++++++++++++ tools/bwa/mem/test/main.nf | 13 +++++++++ tools/bwa/mem/test/nextflow.config | 2 ++ 7 files changed, 105 insertions(+) create mode 100644 tools/bwa/mem/Dockerfile create mode 100644 tools/bwa/mem/environment.yml create mode 100644 tools/bwa/mem/main.nf create mode 100644 tools/bwa/mem/meta.yml create mode 100644 tools/bwa/mem/test/main.nf create mode 100644 tools/bwa/mem/test/nextflow.config diff --git a/.gitignore b/.gitignore index 07c0144a..d832e231 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ work/ data/ results/ +tools/bwa/mem_ignore .DS_Store diff --git a/tools/bwa/mem/Dockerfile b/tools/bwa/mem/Dockerfile new file mode 100644 index 00000000..0be4dc78 --- /dev/null +++ b/tools/bwa/mem/Dockerfile @@ -0,0 +1,9 @@ +FROM nfcore/base +LABEL authors="Jeremy Guntoro" \ + description="Docker image containing all requirements for nf-core/modules/bwa/mem module" + +COPY environment.yml / +RUN conda env create -f /environment.yml && conda clean -a +ENV PATH /opt/conda/envs/nf-core-bwa-mem/bin:$PATH + + diff --git a/tools/bwa/mem/environment.yml b/tools/bwa/mem/environment.yml new file mode 100644 index 00000000..b48b7c2d --- /dev/null +++ b/tools/bwa/mem/environment.yml @@ -0,0 +1,10 @@ +# You can use this file to create a conda environment for this pipeline: +# conda env create -f environment.yml +name: nf-core-bwa-mem +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - bioconda::bwa=0.7.17 + - bioconda::samtools=1.9 diff --git a/tools/bwa/mem/main.nf b/tools/bwa/mem/main.nf new file mode 100644 index 00000000..457d86be --- /dev/null +++ b/tools/bwa/mem/main.nf @@ -0,0 +1,27 @@ +params.bwa_options = "-M -B 2" +params.sequencer = "ILLUMINA" + +process bwa_mem { + tag {id} + + publishDir "${params.outdir}/bwa_mem", mode: 'copy' + + //TO-DO: Change container declaration, for now a test container is present in my personal docker acccount + container 'jeremy1805/bwa-mem-img' + + input: + tuple val(id), path(reads) + path genomeindex + val indexprefix + + output: + tuple path("*.bam"), path("*.bai") + + script: + """ + bwa mem -t ${task.cpus} -R "@RG\\tID:${id}\\tLB:${id}\\tSM:${id}\\tPL:${params.sequencer}" \\ + ${params.bwa_options} ${indexprefix} ${reads} | samtools sort -@8 -O BAM -o ${id}.bam - + + samtools index ${id}.bam + """ +} diff --git a/tools/bwa/mem/meta.yml b/tools/bwa/mem/meta.yml new file mode 100644 index 00000000..4f8fe44d --- /dev/null +++ b/tools/bwa/mem/meta.yml @@ -0,0 +1,43 @@ +name: bwa mem +description: Performs fastq alignment to a fasta reference using the burrows-wheeler aligner +keywords: + - mem + - bwa + - alignment +tools: + - bwa: + description: | + BWA is a software package for mapping DNA sequences against a large reference genome, such as the human genome. + homepage: http://bio-bwa.sourceforge.net/ + documentation: http://www.htslib.org/doc/samtools.html + arxiv: arXiv:1303.3997 +input: + - + - id: + type: val + description: read id for paired-end sequences + - reads: + type: file + description: Input fastq file + pattern: *.{fastq,fq} + - genome: + type: file + description: Input fasta reference genome + pattern: *.{fasta,fa} + - index: + type: file + description: bwa indexes file + pattern: *.{fasta,fa}.{amb,ann,bwt,pac,sa} +output: + - + - bam: + type: file + description: Output bam file + pattern: *.bam + - bamindex: + type: file + description: Output bam index file + pattern: *.bai + +authors: + - @jeremy1805 diff --git a/tools/bwa/mem/test/main.nf b/tools/bwa/mem/test/main.nf new file mode 100644 index 00000000..49ec1efc --- /dev/null +++ b/tools/bwa/mem/test/main.nf @@ -0,0 +1,13 @@ +#!/usr/bin/env nextflow +nextflow.preview.dsl = 2 +include '../../../../nf-core/module_testing/check_process_outputs.nf' params(params) +include '../main.nf' params(params) + +reads = '../../../../test-datasets/tools/bwa/mem/reads/*_R{1,2}_001.fastq.gz' +index = '../../../../test-datasets/tools/bwa/mem/index/H3N2.{amb,ann,bwt,pac,sa}' +prefix = 'H3N2' + +workflow { + read_input=Channel.fromFilePairs(reads) + bwa_mem(read_input,file(index),prefix) +} diff --git a/tools/bwa/mem/test/nextflow.config b/tools/bwa/mem/test/nextflow.config new file mode 100644 index 00000000..c137a138 --- /dev/null +++ b/tools/bwa/mem/test/nextflow.config @@ -0,0 +1,2 @@ +docker.enabled = true +params.outdir = './results' From 356e23823c84eb552e5c716885dfdcb404d7b535 Mon Sep 17 00:00:00 2001 From: Jeremy1805 Date: Thu, 5 Mar 2020 16:31:46 +0000 Subject: [PATCH 2/3] Updated tools/bwa/mem/meta.yml --- .gitignore | 1 - tools/bwa/mem/meta.yml | 9 ++++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index d832e231..07c0144a 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,4 @@ work/ data/ results/ -tools/bwa/mem_ignore .DS_Store diff --git a/tools/bwa/mem/meta.yml b/tools/bwa/mem/meta.yml index 4f8fe44d..1887cd38 100644 --- a/tools/bwa/mem/meta.yml +++ b/tools/bwa/mem/meta.yml @@ -15,19 +15,18 @@ input: - - id: type: val - description: read id for paired-end sequences + description: read/read pair id - reads: type: file description: Input fastq file pattern: *.{fastq,fq} - - genome: - type: file - description: Input fasta reference genome - pattern: *.{fasta,fa} - index: type: file description: bwa indexes file pattern: *.{fasta,fa}.{amb,ann,bwt,pac,sa} + - prefix: + type: val + description: bwa index prefix, equivalent to index file names without extensions. Usually the reference genome file name unless otherwise specified. output: - - bam: From 60f1d3b7a15796a9a282e097ed032494189364a0 Mon Sep 17 00:00:00 2001 From: Jeremy1805 Date: Thu, 5 Mar 2020 16:35:56 +0000 Subject: [PATCH 3/3] Updated tools/bwa/mem/meta.yml --- tools/bwa/mem/meta.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/bwa/mem/meta.yml b/tools/bwa/mem/meta.yml index 1887cd38..2ea48a28 100644 --- a/tools/bwa/mem/meta.yml +++ b/tools/bwa/mem/meta.yml @@ -23,7 +23,7 @@ input: - index: type: file description: bwa indexes file - pattern: *.{fasta,fa}.{amb,ann,bwt,pac,sa} + pattern: *.{amb,ann,bwt,pac,sa} - prefix: type: val description: bwa index prefix, equivalent to index file names without extensions. Usually the reference genome file name unless otherwise specified.