add makegraph script (#1452)

* add makegraph script

* allow renaming of output files

* allow renaming of output files
This commit is contained in:
FriederikeHanssen 2022-03-25 20:49:08 +01:00 committed by GitHub
parent 8a64e73af2
commit 28e5211b35
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 191 additions and 2 deletions

View file

@ -11,7 +11,7 @@ process CONTROLFREEC_ASSESSSIGNIFICANCE {
tuple val(meta), path(cnvs), path(ratio) tuple val(meta), path(cnvs), path(ratio)
output: output:
tuple val(meta), path("*.p.value.txt"), emit: bam tuple val(meta), path("*.p.value.txt"), emit: p_value_txt
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
when: when:
@ -19,9 +19,12 @@ process CONTROLFREEC_ASSESSSIGNIFICANCE {
script: script:
def args = task.ext.args ?: '' def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
""" """
cat /usr/local/bin/assess_significance.R | R --slave --args ${cnvs} ${ratio} cat /usr/local/bin/assess_significance.R | R --slave --args ${cnvs} ${ratio}
mv *.p.value.txt ${prefix}.p.value.txt
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
"${task.process}": "${task.process}":
controlfreec: \$(echo \$(freec -version 2>&1) | sed 's/^.*Control-FREEC //; s/:.*\$//' | sed -e "s/Control-FREEC v//g" ) controlfreec: \$(echo \$(freec -version 2>&1) | sed 's/^.*Control-FREEC //; s/:.*\$//' | sed -e "s/Control-FREEC v//g" )

View file

@ -0,0 +1,40 @@
process CONTROLFREEC_MAKEGRAPH {
tag "$meta.id"
label 'process_low'
conda (params.enable_conda ? "bioconda::control-freec=11.6" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/control-freec:11.6--h1b792b2_1':
'quay.io/biocontainers/control-freec:11.6--h1b792b2_1' }"
input:
tuple val(meta), path(ratio), path(baf)
output:
tuple val(meta), path("*_BAF.png") , emit: png_baf
tuple val(meta), path("*_ratio.log2.png"), emit: png_ratio_log2
tuple val(meta), path("*_ratio.png") , emit: png_ratio
path "versions.yml" , emit: versions
when:
task.ext.when == null || task.ext.when
script:
def args = task.ext.args ?: ""
def prefix = task.ext.prefix ?: "${meta.id}"
def baf = baf ?: ""
"""
cat /usr/local/bin/makeGraph.R | R --slave --args ${args} ${ratio} ${baf}
mv *_BAF.txt.png ${prefix}_BAF.png
mv *_ratio.txt.log2.png ${prefix}_ratio.log2.png
mv *_ratio.txt.png ${prefix}_ratio.png
cat <<-END_VERSIONS > versions.yml
"${task.process}":
controlfreec: \$(echo \$(freec -version 2>&1) | sed 's/^.*Control-FREEC //; s/:.*\$//' | sed -e "s/Control-FREEC v//g" )
END_VERSIONS
"""
}

View file

@ -0,0 +1,58 @@
name: controlfreec_makegraph
description: Plot Freec output
keywords:
- cna
- cnv
- somatic
- single
- tumor-only
tools:
- controlfreec:
description: Copy number and genotype annotation from whole genome and whole exome sequencing data.
homepage: http://boevalab.inf.ethz.ch/FREEC
documentation: http://boevalab.inf.ethz.ch/FREEC/tutorial.html
tool_dev_url: https://github.com/BoevaLab/FREEC/
doi: "10.1093/bioinformatics/btq635"
licence: ["GPL >=2"]
input:
# Only when we have meta
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- ratio:
type: file
description: ratio file generated by FREEC
pattern: "*.ratio.txt"
- baf:
type: file
description: .BAF file generated by FREEC
pattern: "*.BAF"
output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
- png_baf:
type: file
description: Image of BAF plot
pattern: "*_BAF.png"
- png_ratio_log2:
type: file
description: Image of ratio log2 plot
pattern: "*_ratio.log2.png"
- png_ratio:
type: file
description: Image of ratio plot
pattern: "*_ratio.png"
authors:
- "@FriederikeHanssen"

View file

@ -431,6 +431,10 @@ controlfreec/freec2bed:
- modules/controlfreec/freec2bed/** - modules/controlfreec/freec2bed/**
- tests/modules/controlfreec/freec2bed/** - tests/modules/controlfreec/freec2bed/**
controlfreec/makegraph:
- modules/controlfreec/makegraph/**
- tests/modules/controlfreec/makegraph/**
cooler/cload: cooler/cload:
- modules/cooler/cload/** - modules/cooler/cload/**
- tests/modules/cooler/cload/** - tests/modules/cooler/cload/**

View file

@ -4,7 +4,7 @@
- controlfreec/assesssignificance - controlfreec/assesssignificance
- controlfreec - controlfreec
files: files:
- path: output/controlfreec/test2.mpileup.gz_CNVs.p.value.txt - path: output/controlfreec/test.p.value.txt
md5sum: 44e23b916535fbc1a3f47b57fad292df md5sum: 44e23b916535fbc1a3f47b57fad292df
- path: output/controlfreec/versions.yml - path: output/controlfreec/versions.yml
md5sum: 0aa42fed10d61e4570fe1e0e83ffe932 md5sum: 0aa42fed10d61e4570fe1e0e83ffe932

View file

@ -0,0 +1,42 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { CONTROLFREEC_MAKEGRAPH } from '../../../../modules/controlfreec/makegraph/main.nf'
include { CONTROLFREEC_FREEC } from '../../../../modules/controlfreec/freec/main.nf'
include { UNTAR } from '../../../../modules/untar/main.nf'
workflow test_controlfreec_makegraph {
input = [
[ id:'test', single_end:false, sex:'XX' ], // meta map
file(params.test_data['homo_sapiens']['illumina']['test_mpileup'], checkIfExists: true),
file(params.test_data['homo_sapiens']['illumina']['test2_mpileup'], checkIfExists: true),
[],[],[],[]
]
fasta = file(params.test_data['homo_sapiens']['genome']['genome_21_fasta'], checkIfExists: true)
fai = file(params.test_data['homo_sapiens']['genome']['genome_21_fasta_fai'], checkIfExists: true)
dbsnp = file(params.test_data['homo_sapiens']['genome']['dbsnp_138_hg38_21_vcf_gz'], checkIfExists: true)
dbsnp_tbi = file(params.test_data['homo_sapiens']['genome']['dbsnp_138_hg38_21_vcf_gz_tbi'], checkIfExists: true)
chrfiles = [ [], file(params.test_data['homo_sapiens']['genome']['genome_21_chromosomes_dir'], checkIfExists: true) ]
target_bed = file(params.test_data['homo_sapiens']['genome']['genome_21_multi_interval_bed'], checkIfExists: true)
UNTAR(chrfiles)
CONTROLFREEC_FREEC (input,
fasta,
fai,
[],
dbsnp,
dbsnp_tbi,
UNTAR.out.untar.map{ it[1] },
[],
target_bed,
[]
)
makegraph_in = CONTROLFREEC_FREEC.out.ratio.join(CONTROLFREEC_FREEC.out.BAF)
CONTROLFREEC_MAKEGRAPH ( makegraph_in )
}

View file

@ -0,0 +1,30 @@
process {
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
withName:CONTROLFREEC_FREEC{
ext.args = { [
"sample":[
inputformat: 'pileup',
mateorientation: 'FR'
],
"general" :[
bedgraphoutput: "TRUE",
noisydata: "TRUE",
minexpectedgc: "0",
readcountthreshold: "1",
sex: meta.sex,
window: "10",
],
"control":[
inputformat: "pileup",
mateorientation: "FR"
]
]
}
}
withName:CONTROLFREEC_MAKEGRAPH {
ext.args = "2"
}
}

View file

@ -0,0 +1,12 @@
- name: controlfreec makegraph test_controlfreec_makegraph
command: nextflow run tests/modules/controlfreec/makegraph -entry test_controlfreec_makegraph -c tests/config/nextflow.config
tags:
- controlfreec
- controlfreec/makegraph
files:
- path: output/controlfreec/test_BAF.png
md5sum: f9d977839e09c7e2472d970bd4aa834c
- path: output/controlfreec/test_ratio.log2.png
md5sum: b3c7916b1b4951a0cc3da20d8e9e0262
- path: output/controlfreec/test_ratio.png
md5sum: 1435b29536b3b1555b4c423f8f4fb000