Skip to content

Commit

Permalink
Merge pull request #21 from CCBR/cutadapt
Browse files Browse the repository at this point in the history
Use cutadapt CCBR/nf-modules
  • Loading branch information
kelly-sovacool authored Oct 20, 2023
2 parents 15870eb + f4e0a25 commit 9446ce7
Show file tree
Hide file tree
Showing 12 changed files with 136 additions and 51 deletions.
1 change: 1 addition & 0 deletions .nf-core.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
repository_type: pipeline
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ recursive-include bin
recursive-include conf
recursive-include assets
recursive-include modules
recursive-include submodules
recursive-include subworkflows
include CITATION.cff
include LICENSE
include VERSION
Expand Down
8 changes: 4 additions & 4 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ input : ${params.input}
.stripIndent()

// SUBMODULES
include { INPUT_CHECK } from './submodules/local/input_check.nf'
include { TRIM_COUNT } from './submodules/local/trim_count.nf'
include { MAGECK } from './submodules/local/mageck.nf'
include { BAGEL } from './submodules/local/bagel.nf'
include { INPUT_CHECK } from './subworkflows/local/input_check.nf'
include { TRIM_COUNT } from './subworkflows/local/trim_count.nf'
include { MAGECK } from './subworkflows/local/mageck.nf'
include { BAGEL } from './subworkflows/local/bagel.nf'

// MODULES
include { DRUGZ } from './modules/local/drugz.nf'
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/CRUISE",
"homePage": "https://github.com/CCBR/CRUISE",
"repos": {
"https://github.com/CCBR/nf-modules": {
"modules": {
"CCBR": {
"cutadapt": {
"branch": "main",
"git_sha": "a3525c765b76400269695235bbf164a948604c4a",
"installed_by": ["modules"]
}
}
}
}
}
}
63 changes: 63 additions & 0 deletions modules/CCBR/cutadapt/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
process CUTADAPT {
tag { meta.id }
label 'process_high'

container 'nciccbr/ncigb_cutadapt_v1.18:latest'

input:
tuple val(meta), path(reads)

output:
tuple val(meta), path('*.trim.fastq.gz'), emit: reads
tuple val(meta), path('*.log') , emit: log
path "versions.yml" , emit: versions

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

script:
def prefix = task.ext.prefix ?: "${meta.id}"
def trimmed = meta.single_end ? "-o ${prefix}.trim.fastq.gz" : "-o ${prefix}_1.trim.fastq.gz -p ${prefix}_2.trim.fastq.gz"
def args = task.ext.args ?: [
'--nextseq-trim=2',
'--trim-n -n 5 -O 5',
'-q 10,10',
'-b file:/opt2/TruSeq_and_nextera_adapters.consolidated.fa'
]
if (meta.single_end) {
args += [
'-m 20'
]
} else {
args += [
'-B file:/opt2/TruSeq_and_nextera_adapters.consolidated.fa',
'-m 20:20',
]
}
args = args.join(' ').trim()
"""
cutadapt \\
--cores ${task.cpus} \\
${args} \\
${trimmed} \\
${reads} \\
> ${prefix}.cutadapt.log
cat <<-END_VERSIONS > versions.yml
"${task.process}":
cutadapt: \$(cutadapt --version)
END_VERSIONS
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
def trimmed = meta.single_end ? "${prefix}.trim.fastq.gz" : "${prefix}_1.trim.fastq.gz ${prefix}_2.trim.fastq.gz"
"""
touch ${prefix}.cutadapt.log
touch ${trimmed}
cat <<-END_VERSIONS > versions.yml
"${task.process}":
cutadapt: \$(cutadapt --version)
END_VERSIONS
"""
}
45 changes: 45 additions & 0 deletions modules/CCBR/cutadapt/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: cutadapt
description: Perform adapter/quality trimming on sequencing reads. Adapted from the nf-core cutadapt module.
keywords:
- trimming
- adapter trimming
- adapters
- quality trimming
tools:
- cuatadapt:
description: |
Cutadapt finds and removes adapter sequences, primers, poly-A tails and other types of unwanted sequence from your high-throughput sequencing reads.
documentation: https://cutadapt.readthedocs.io/en/stable/index.html
doi: 10.14806/ej.17.1.200
licence: ["MIT"]
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.
output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- reads:
type: file
description: The trimmed/modified fastq reads
pattern: "*fastq.gz"
- log:
type: file
description: cuatadapt log file
pattern: "*cutadapt.log"
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
authors:
- "@kelly-sovacool"
41 changes: 0 additions & 41 deletions modules/local/trim.nf

This file was deleted.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Changelog = "https://github.com/CCBR/CRUISE/blob/main/docs/CHANGELOG.md"
cruise = "."

[tool.setuptools.package-data]
"*" = ["CITATION.cff", "LICENSE", "VERSION", "main.nf", "nextflow.config", "assets/*", "bin/*", "conf/*", "modules/*/*", "submodules/*/*"]
"*" = ["CITATION.cff", "LICENSE", "VERSION", "main.nf", "nextflow.config", "assets/*", "bin/*", "conf/*", "modules/*/*", "subworkflows/*/*"]

[tool.setuptools.dynamic]
version = {file = "VERSION"}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include { TRIM_SE } from '../../modules/local/trim.nf'
include { CUTADAPT } from '../../modules/CCBR/cutadapt'
include { COUNT as MAGECK_COUNT } from "../../modules/local/mageck.nf"

workflow TRIM_COUNT {
Expand All @@ -7,8 +7,8 @@ workflow TRIM_COUNT {
library

main:
TRIM_SE(raw_reads)
TRIM_SE.out.reads
CUTADAPT(raw_reads)
CUTADAPT.out.reads
.multiMap { meta, fastq ->
id: meta.id
fastq: fastq
Expand All @@ -22,5 +22,5 @@ workflow TRIM_COUNT {

emit:
count = MAGECK_COUNT.out.count
trimmed_reads = TRIM_SE.out.reads
trimmed_reads = CUTADAPT.out.reads
}

0 comments on commit 9446ce7

Please sign in to comment.