Skip to content

Commit

Permalink
Merge pull request #34 from CCBR/nf-modules
Browse files Browse the repository at this point in the history
docs: link to CCBR/nf-modules & include example
  • Loading branch information
kelly-sovacool authored Sep 13, 2024
2 parents 2937e1f + e95ed5e commit fc94aef
Show file tree
Hide file tree
Showing 5 changed files with 125 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ See the website for detailed information, documentation, and examples:
- dependencies
- project URLs
1. Write your nextflow workflow.
- Where possible, reuse existing modules and subworklows from [CCBR/nf-modules](https://github.com/CCBR/nf-modules)[^3].
Also consider contributing new modules & subworkflows to that repository!
1. Write your documentation in `docs/` and enable GitHub Pages.
- In settings, go to General > Pages and select the `gh-pages` branch.
mkdocs will build your site under the `gh-pages` branch, and GitHub Pages will make it available at `https://OWNER.github.io/TOOL_NAME`.
Expand Down Expand Up @@ -119,3 +121,4 @@ If you plan to contribute your pipeline to nf-core, don't use this template -- i

[^1]: nektool https://github.com/beardymcjohnface/nektool
[^2]: instructions for nf-core pipelines https://nf-co.re/docs/contributing/tutorials/creating_with_nf_core
[^3]: See also our reusable modules and subworkflows for CCBR nextflow pipelines: <https://github.com/CCBR/nf-modules>
1 change: 1 addition & 0 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ input : ${params.input}
.stripIndent()

include { FASTQC } from "./modules/local/qc.nf"
include { BWA_MEM } from './modules/CCBR/bwa/mem'

workflow.onComplete {
if (!workflow.stubRun && !workflow.commandLine.contains('-preview')) {
Expand Down
17 changes: 17 additions & 0 deletions modules.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "CCBR/TOOL_NAME",
"homePage": "https://github.com/CCBR/TOOL_NAME",
"repos": {
"https://github.com/CCBR/nf-modules": {
"modules": {
"CCBR": {
"bwa/mem": {
"branch": "main",
"git_sha": "490e4454c81e3fb852f7f964356f9981b6f1c439",
"installed_by": ["modules"]
}
}
}
}
}
}
53 changes: 53 additions & 0 deletions modules/CCBR/bwa/mem/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
process BWA_MEM {
tag { meta.id }
label 'process_high'

container 'nciccbr/ccbr_ubuntu_base_20.04:v5'

input:
tuple val(meta), path(fastq)
tuple val(meta_idx), path(index_files)

output:
tuple val(meta), path("*.bam"), path("*.bai"), emit: bam
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when

script:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
# current working directory is a tmpdir when 'scratch' is set
TMP=tmp/
mkdir \$TMP
trap 'rm -rf "\$TMP"' EXIT
INDEX=`find -L ./ -name "*.amb" | sed 's/\\.amb\$//'`
bwa mem \\
-t ${task.cpus} \\
-o \$TMP/align.bam \\
\$INDEX \\
${fastq}
samtools sort \\
-@ ${task.cpus} \\
-m 2G \\
-T \$TMP \\
--write-index \\
-o ${prefix}.bam##idx##${prefix}.bam.bai \\
\$TMP/align.bam
cat <<-END_VERSIONS > versions.yml
"${task.process}":
bwa: \$(echo \$(bwa 2>&1) | sed 's/^.*Version: //; s/Contact:.*\$//')
samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
END_VERSIONS
"""

stub:
"""
touch ${meta.id}.bam ${meta.id}.bam.bai versions.yml
"""
}
51 changes: 51 additions & 0 deletions modules/CCBR/bwa/mem/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: bwa_mem
description: Performs fastq alignment to a fasta reference using BWA. Adapted from the nf-core bwa-mem module.
keywords:
- mem
- bwa
- alignment
- map
- fastq
- bam
- sam
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
licence: ["GPL-3.0-or-later"]
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- reads:
type: file
description: |
List of input FastQ files of size 1 and 2 for single-end and paired-end data,
respectively.
- index:
type: file
description: BWA genome index files
pattern: "Directory containing BWA index *.{amb,ann,bwt,pac,sa}"
output:
- bam:
type: file
description: Output BAM file containing read alignments
pattern: "*.{bam}"
- bai:
type: file
description: Output BAI index file
pattern: "*.{bai}"
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
authors:
- "@kelly-sovacool"
maintainers:
- "@kelly-sovacool"

0 comments on commit fc94aef

Please sign in to comment.