Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New module ctat splicing #587

Merged
merged 23 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,18 @@ process {
]
}

withName: 'CTATSPLICING_STARTOCANCERINTRONS' {
ext.args = {[
bam ? "--vis" : "",
"--sample_name ${meta.id}",
].join(" ")}
publishDir = [
path: { "${params.outdir}/ctatsplicing" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
}

withName: 'ENSEMBL_DOWNLOAD' {
publishDir = [
path: { "${params.genomes_base}/ensembl" },
Expand Down
9 changes: 9 additions & 0 deletions conf/test.config
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,12 @@ params {
// Input data
input = 'https://raw.githubusercontent.com/nf-core/test-datasets/rnafusion/testdata/human/samplesheet_valid.csv'
}

// Limit and standardize resources for github actions and reproducibility
process {
resourceLimits = [
cpus: 4,
memory: '15.GB',
time: '1.h'
]
}
9 changes: 9 additions & 0 deletions conf/test_build.config
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,12 @@ params {

skip_salmon_index = true
}

// Limit and standardize resources for github actions and reproducibility
process {
resourceLimits = [
cpus: 4,
memory: '15.GB',
time: '1.h'
]
}
9 changes: 9 additions & 0 deletions conf/test_cosmic.config
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,12 @@ params {
cosmic_username = secrets.COSMIC_USERNAME
cosmic_passwd = secrets.COSMIC_PASSWD
}

// Limit and standardize resources for github actions and reproducibility
process {
resourceLimits = [
cpus: 4,
memory: '15.GB',
time: '1.h'
]
}
71 changes: 71 additions & 0 deletions modules/local/ctatsplicing/startocancerintrons/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
process CTATSPLICING_STARTOCANCERINTRONS {
tag "$meta.id"
label 'process_single'

container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://data.broadinstitute.org/Trinity/CTAT_SINGULARITY/CTAT-SPLICING/ctat_splicing.v0.0.2.simg' :
'docker.io/trinityctat/ctat_splicing:0.0.2' }"

input:
tuple val(meta), path(split_junction), path(junction), path(bam), path(bai)
tuple val(meta2), path(genome_lib)

output:
tuple val(meta), path("*.cancer_intron_reads.sorted.bam") , emit: cancer_introns_sorted_bam
tuple val(meta), path("*.cancer_intron_reads.sorted.bam.bai") , emit: cancer_introns_sorted_bai
tuple val(meta), path("*.gene_reads.sorted.sifted.bam") , emit: gene_reads_sorted_bam
tuple val(meta), path("*.gene_reads.sorted.sifted.bam.bai") , emit: gene_reads_sorted_bai
tuple val(meta), path("*.cancer.introns") , emit: cancer_introns
tuple val(meta), path("*.cancer.introns.prelim") , emit: cancer_introns_prelim
tuple val(meta), path("*${prefix}.introns") , emit: introns
tuple val(meta), path("*.introns.for_IGV.bed") , emit: introns_igv_bed, optional: true
tuple val(meta), path("*.ctat-splicing.igv.html") , emit: igv_html, optional: true
tuple val(meta), path("*.igv.tracks") , emit: igv_tracks, optional: true
tuple val(meta), path("*.chckpts") , emit: chckpts
path "versions.yml" , emit: versions

script:
def args = task.ext.args ?: ''
prefix = task.ext.prefix ?: "${meta.id}"
rannick marked this conversation as resolved.
Show resolved Hide resolved
def bam_arg = bam ? "--bam_file ${bam}" : ""
def VERSION = '0.0.2' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions.
def create_index = bam && !bai ? "samtools index ${bam}" : ""
rannick marked this conversation as resolved.
Show resolved Hide resolved
"""
${create_index}
/usr/local/src/CTAT-SPLICING/STAR_to_cancer_introns.py \\
--SJ_tab_file ${split_junction} \\
--chimJ_file ${junction} \\
${bam_arg} \\
--output_prefix ${prefix} \\
--ctat_genome_lib ${genome_lib} \\
${args}

cat <<-END_VERSIONS > versions.yml
"${task.process}":
ctat-splicing: $VERSION
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
prefix = task.ext.prefix ?: "${meta.id}"
rannick marked this conversation as resolved.
Show resolved Hide resolved
def VERSION = '0.0.2' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions.
def create_igv_files = args.contains("--vis") ? "touch ${prefix}.introns.for_IGV.bed && touch ${prefix}.ctat-splicing.igv.html && touch ${prefix}.igv.tracks" : ""
"""
${create_igv_files}
touch ${prefix}.cancer_intron_reads.sorted.bam
touch ${prefix}.cancer_intron_reads.sorted.bam.bai
touch ${prefix}.gene_reads.sorted.sifted.bam
touch ${prefix}.gene_reads.sorted.sifted.bam.bai
touch ${prefix}.cancer.introns
touch ${prefix}.cancer.introns.prelim
touch ${prefix}.introns
touch ${prefix}.chckpts


cat <<-END_VERSIONS > versions.yml
"${task.process}":
ctat-splicing: $VERSION
END_VERSIONS
"""
}
69 changes: 69 additions & 0 deletions modules/local/ctatsplicing/startocancerintrons/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
nextflow_process {

name "Test Process CTATSPLICING_STARTOCANCERINTRONS"
script "../main.nf"
process "CTATSPLICING_STARTOCANCERINTRONS"
options "-stub"

test("test without BAM") {

when {
params {
outdir = "tests/results"
}
process {
"""
input[0] = [
[id:"test"],
file("test.SJ.out.tab"),
file("test.Chimeric.out.junctions"),
[],
[]
]
input[1] = [
[id:"reference"],
file("ctat_genome_lib")
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out.findAll { key, value -> !key.isNumber() }).match() }
)
}
}

test("test with BAM") {

when {
params {
outdir = "tests/results"
}
process {
"""
input[0] = [
[id:"test"],
file("test.SJ.out.tab"),
file("test.Chimeric.out.junctions"),
file("test.Aligned.sortedByCoord.out.bam"),
[]
]
input[1] = [
[id:"reference"],
file("ctat_genome_lib")
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out.findAll { key, value -> !key.isNumber() }).match() }
)
}
}
}
191 changes: 191 additions & 0 deletions modules/local/ctatsplicing/startocancerintrons/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
{
"test without BAM": {
"content": [
{
"cancer_introns": [
[
{
"id": "test"
},
"test.cancer.introns:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"cancer_introns_prelim": [
[
{
"id": "test"
},
"test.cancer.introns.prelim:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"cancer_introns_sorted_bai": [
[
{
"id": "test"
},
"test.cancer_intron_reads.sorted.bam.bai:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"cancer_introns_sorted_bam": [
[
{
"id": "test"
},
"test.cancer_intron_reads.sorted.bam:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"chckpts": [
[
{
"id": "test"
},
"test.chckpts:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"gene_reads_sorted_bai": [
[
{
"id": "test"
},
"test.gene_reads.sorted.sifted.bam.bai:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"gene_reads_sorted_bam": [
[
{
"id": "test"
},
"test.gene_reads.sorted.sifted.bam:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"igv_html": [

],
"igv_tracks": [

],
"introns": [
[
{
"id": "test"
},
"test.introns:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"introns_igv_bed": [

],
"versions": [
"versions.yml:md5,fcf861a15f9951342a874b6bc476a37e"
]
}
],
"meta": {
"nf-test": "0.9.1",
"nextflow": "24.10.1"
},
"timestamp": "2024-12-17T13:35:13.723215847"
},
"test with BAM": {
"content": [
{
"cancer_introns": [
[
{
"id": "test"
},
"test.cancer.introns:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"cancer_introns_prelim": [
[
{
"id": "test"
},
"test.cancer.introns.prelim:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"cancer_introns_sorted_bai": [
[
{
"id": "test"
},
"test.cancer_intron_reads.sorted.bam.bai:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"cancer_introns_sorted_bam": [
[
{
"id": "test"
},
"test.cancer_intron_reads.sorted.bam:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"chckpts": [
[
{
"id": "test"
},
"test.chckpts:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"gene_reads_sorted_bai": [
[
{
"id": "test"
},
"test.gene_reads.sorted.sifted.bam.bai:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"gene_reads_sorted_bam": [
[
{
"id": "test"
},
"test.gene_reads.sorted.sifted.bam:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"igv_html": [
[
{
"id": "test"
},
"test.ctat-splicing.igv.html:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"igv_tracks": [
[
{
"id": "test"
},
"test.igv.tracks:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"introns": [
[
{
"id": "test"
},
"test.introns:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"introns_igv_bed": [
[
{
"id": "test"
},
"test.introns.for_IGV.bed:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions": [
"versions.yml:md5,fcf861a15f9951342a874b6bc476a37e"
]
}
],
"meta": {
"nf-test": "0.9.1",
"nextflow": "24.10.1"
},
"timestamp": "2024-12-17T13:33:27.36677449"
}
}
Loading
Loading