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

Clincnv #11

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
26 changes: 26 additions & 0 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,17 @@ process {
]
}

withName: 'BEDCOVERAGE' {
ext.args = {[
'-min_mapq 3',
'-clear'
].join(' ').trim()}
}

withName: 'COUNT_MERGE' {
ext.args = { "-n 4" }
}

withName: 'ENSEMBLVEP_VEP' {
ext.prefix = {"${meta.id}.vep"}
ext.args = {[
Expand All @@ -52,6 +63,21 @@ process {
].join(' ').trim()}
}

withName: 'GERMLINE' {
ext.args = {[
'--minimumNumOfElemsInCluster 20',
'--maxNumGermCNVs 2000',
'--maxNumIter 5',
'--numberOfThreads 10',
'--scoreG 60',
'--lengthG 0',
'--hg38',
'--reanalyseCohort FALSE',
'--visulizationIGV F',
'--noPlot T'
].join(' ').trim()}
}

withName: 'TABIX_TABIX' {
publishDir = [
path: {"$params.outdir/exomedepth/cnv_call"},
Expand Down
3 changes: 2 additions & 1 deletion conf/test.config
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ params {
// Parameters
roi_auto = "https://raw.githubusercontent.com/nf-cmgg/test-datasets/exomecnv/data/genomics/homo_sapiens/genome/roi/Homo_sapiens.GRCh38.105.chr21_protein_coding_basic_sorted_merged_autosomal.bed"
roi_chrx = "https://raw.githubusercontent.com/nf-cmgg/test-datasets/exomecnv/data/genomics/homo_sapiens/genome/roi/Homo_sapiens.GRCh38.105.chrX_protein_coding_basic_sorted_merged.bed"
roi_merged = "https://raw.githubusercontent.com/nf-cmgg/test-datasets/exomecnv/data/genomics/homo_sapiens/genome/roi/Homo_sapiens.GRCh38.105.chr21X_protein_coding_basic_sorted_merged_autosomal.bed"

yamlconfig = "${projectDir}/assets/exomedepth.yaml"
exomedepth = false
clincnv = false


// VEP options
Expand All @@ -42,6 +44,5 @@ params {
vep_assembly = "GRCh38"
vep_cache_version = 105
species = "homo_sapiens"

}

7 changes: 7 additions & 0 deletions modules/local/clincnv/bedannotategc/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: ngs-env
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- ngs-bits=2023_02
44 changes: 44 additions & 0 deletions modules/local/clincnv/bedannotategc/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
process BEDANNOTATEGC {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
process BEDANNOTATEGC {
process CLINCNV_BEDANNOTATEGC {

I think adding the CLINCNV_ prefix to all these modules will help in keeping it clear that these modules are part of the clincnv toolkit. Can this be added to each created process here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or NVM this is part of ngs-bits. Can this be updated to the NGSBITS_ prefix instead and be moved to a correct subfolder called ngsbits? This will keep it clear from where the tool comes :)


conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/ngs-bits:2023_02--py311ha0b7adc_2' :
'biocontainers/ngs-bits:2023_02--py311ha0b7adc_2' }"

publishDir "$params.outdir/clincnv", mode: 'copy'

input:
tuple val(meta), path(exon_target)
tuple val(meta2), path(fasta)
tuple val(meta3), path(fai)

output:
path("*.bed"), emit: annotatedbed
path "versions.yml", emit:versions

script:
def args = task.ext.args ?: ''
"""
BedAnnotateGC \\
-in $exon_target \\
-out GC_Annotated_$exon_target \\
-ref $fasta \\

awk -F'\\t' '{OFS="\\t"; print \$1, \$2, \$3, \$5, \$4}' GC_Annotated_$exon_target > tmp && mv tmp GC_Annotated_$exon_target

cat <<-END_VERSIONS > versions.yml
"${task.process}":
BedAnnotateGC: \$(BedAnnotateGC --version | sed 's/BedAnnotateGC //g')
END_VERSIONS
"""

stub:
"""
touch GC_Annotated.bed

cat <<-END_VERSIONS > versions.yml
"${task.process}":
BedCoverage: \$(BedCoverage --version | sed 's/BedCoverage //g')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
BedCoverage: \$(BedCoverage --version | sed 's/BedCoverage //g')
BedAnnotateGC: \$(BedAnnotateGC --version | sed 's/BedAnnotateGC //g')

END_VERSIONS
"""
}
7 changes: 7 additions & 0 deletions modules/local/clincnv/bedcoverage/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: ngs-env
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- ngs-bits=2023_02
48 changes: 48 additions & 0 deletions modules/local/clincnv/bedcoverage/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
process BEDCOVERAGE {
tag "$meta.id"
label 'process_medium'

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/ngs-bits:2023_02--py311ha0b7adc_2' :
'biocontainers/ngs-bits:2023_02--py311ha0b7adc_2' }"

publishDir "$params.outdir/clincnv/counts/$meta.pool", mode: 'copy'

input:
tuple val(meta), path(bam), path(bai)
tuple val(meta2), path(exon_target)

output:
tuple val(meta), path("*.cov"), emit: counts
path "versions.yml", emit:versions

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

script:
def args = task.ext.args ?: ''
"""
BedCoverage \\
-bam $bam \\
-in $exon_target \\
$args \\
-threads $task.cpus \\
-out ${meta.id}.cov

cat <<-END_VERSIONS > versions.yml
"${task.process}":
BedCoverage: \$(BedCoverage --version | sed 's/BedCoverage //g')
END_VERSIONS
"""

stub:
"""
touch ${meta.id}.cov

cat <<-END_VERSIONS > versions.yml
"${task.process}":
BedCoverage: \$(BedCoverage --version | sed 's/BedCoverage //g')
END_VERSIONS
"""
}
20 changes: 20 additions & 0 deletions modules/local/clincnv/germline/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: clincnv
channels:
- bioconda
- conda-forge
- defaults
dependencies:
- r-base=4.2.3
- r-rcpp=1.0.11
- r-optparse=1.7.5
- r-robustbase=0.95_1
- r-data.table=1.14.8
- r-foreach=1.5.2
- r-doparallel=1.0.17
- r-mclust=6.0.0
- r-r.utils=2.12.2
- r-rcolorbrewer=1.1_3
- r-party=1.3_13
- r-dbscan=1.1_11
- r-umap=0.2.10.0
- r-mass=7.3_60
51 changes: 51 additions & 0 deletions modules/local/clincnv/germline/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
process GERMLINE {
tag "$sample"

container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/cmgg/clincnv:1.18.3':
'cmgg/clincnv:1.18.3' }"
conda "${moduleDir}/environment.yml"

publishDir "$params.outdir/clincnv/calling", mode: 'copy'

input:
tuple val(meta), val(sample), path(file)
path(bed)

output:
tuple val(meta), val(sample), path("*.tsv"), emit: tsv
path "versions.yml", emit: versions

script:
def publishDir = "$params.outdir/clincnv/calling/"
def bedDir = "$params.outdir/clincnv"
def fileDir = "$params.outdir/clincnv/counts/$meta.id"
def args = task.ext.args ?: ''
def VERSION = '1.19.0'
"""
clinCNV.R \\
--normal ${fileDir}/${file} \\
--normalSample=${sample} \\
--bed ${bedDir}/${bed} \\
--out ${publishDir} \\
$args

cat <<-END_VERSIONS > versions.yml
"${task.process}":
ClinCNV: ${VERSION}
R: \$(Rscript --version | sed 's/R scripting front-end //g')
END_VERSIONS
"""

stub:
def VERSION = '1.19.0'
"""
touch ${sample}.ready_CNVS.tsv

cat <<-END_VERSIONS > versions.yml
"${task.process}":
ClinCNV: ${VERSION}
R: \$(Rscript --version | sed 's/R scripting front-end //g')
END_VERSIONS
"""
}
20 changes: 20 additions & 0 deletions modules/local/clincnv/merge_coverage/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: clincnv
channels:
- bioconda
- conda-forge
- defaults
dependencies:
- r-base=4.2.3
- r-rcpp=1.0.11
- r-optparse=1.7.5
- r-robustbase=0.95_1
- r-data.table=1.14.8
- r-foreach=1.5.2
- r-doparallel=1.0.17
- r-mclust=6.0.0
- r-r.utils=2.12.2
- r-rcolorbrewer=1.1_3
- r-party=1.3_13
- r-dbscan=1.1_11
- r-umap=0.2.10.0
- r-mass=7.3_60
48 changes: 48 additions & 0 deletions modules/local/clincnv/merge_coverage/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// MERGE COUNT FILES
process COVERAGE_MERGE {
tag "$meta.id"

container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/cmgg/clincnv:1.18.3':
'cmgg/clincnv:1.18.3' }"
conda "${moduleDir}/environment.yml"

publishDir "$params.outdir/clincnv/counts/$meta.id", mode: 'copy'

input:
tuple val(meta), val(samples), path(file)

output:
tuple val(meta), val(samples), path("*.txt"), emit: merge
path "versions.yml", emit:versions

script:
def prefix = task.ext.prefix ?: "${meta.id}.normal"
def args = task.ext.args ?: ''
def VERSION = '1.19.0'
"""
mergeFilesFromFolderDT.R \\
-i ${file} \\
-o ${prefix}.txt \\
$args

cat <<-END_VERSIONS > versions.yml
"${task.process}":
ClinCNV: ${VERSION}
R: \$(Rscript --version | sed 's/R scripting front-end //g')
END_VERSIONS
"""

stub:
prefix = task.ext.prefix ?: "${meta.id}"
def VERSION = '1.19.0'
"""
touch ${prefix}.txt

cat <<-END_VERSIONS > versions.yml
"${task.process}":
ClinCNV: ${VERSION}
R: \$(Rscript --version | sed 's/R scripting front-end //g')
END_VERSIONS
"""
}
23 changes: 23 additions & 0 deletions modules/local/clincnv/pathfile/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
process PATHFILE {
tag "$meta.id"

container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/coreutils:9.3' :
'biocontainers/coreutils:9.3' }"

publishDir "$params.outdir/clincnv/counts/$meta.id", mode: 'copy'

input:
tuple val(meta), val(samples), path(files)

output:
tuple val(meta), val(samples), path("*.txt"), emit: counts

script:
def prefix = task.ext.prefix ?: "${meta.id}_paths"
def publishDir = "$params.outdir/clincnv/counts/$meta.id"
def fileList = files.collect(file -> "${publishDir}/${file}").join('\n')
"""
echo -e "${fileList}" > ${prefix}.txt
"""
}
5 changes: 3 additions & 2 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ params {
igenomes_base = null //'s3://ngi-igenomes/igenomes/'
igenomes_ignore = true


// MultiQC options
multiqc_config = null
multiqc_title = null
Expand Down Expand Up @@ -72,7 +71,9 @@ params {
annotate = null
vep_assembly = "GRCh38"


// CLINCNV Parameters
roi_merged = null
clincnv = false
}

// Load base.config by default for all pipelines
Expand Down
10 changes: 9 additions & 1 deletion nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
"exomedepth": {
"type": "boolean",
"description": "Option to execute the ExomeDepth tool"
},
"clincnv": {
"type": "boolean",
"description": "Option to execute the ClinCNV tool"
}
}
},
Expand Down Expand Up @@ -92,9 +96,13 @@
"default": "/conf/",
"description": "The config base path for the cmgg configs",
"format": "directory-path"
},
"roi_merged": {
"type": "string",
"description": "Path to the default ROI (regions of interest) BED file of autosomal and chrX merged regions to be used for CNV analysis"
}
},
"required": ["fasta", "fai"]
"required": ["fasta", "fai", "roi_merged"]
},
"institutional_config_options": {
"title": "Institutional config options",
Expand Down
Loading
Loading