-
Notifications
You must be signed in to change notification settings - Fork 387
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
implementation of goleft/indexcov #1312
base: dev
Are you sure you want to change the base?
Changes from 10 commits
59026dc
f034b73
57c10f6
5f69ad8
4ac388d
33d20f6
05359a4
147c449
cc092f8
431b044
3c7ef81
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
Config file for defining DSL2 per module options and publishing paths | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
Available keys to override module options: | ||
ext.args = Additional arguments appended to command in module. | ||
ext.prefix = File name prefix for output files. | ||
ext.when = When to run the module. | ||
---------------------------------------------------------------------------------------- | ||
*/ | ||
|
||
|
||
process { | ||
if (params.tools && params.tools.split(',').contains('indexcov')) { | ||
withName: 'GOLEFT_INDEXCOV' { | ||
ext.when = { !params.wes } | ||
ext.args = {""} | ||
ext.prefix = { "indexcov" } | ||
publishDir = [ | ||
mode: params.publish_dir_mode, | ||
path: { "${params.outdir}/variant_calling/indexcov" }, | ||
pattern: "*.png" | ||
] | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
Config file for defining DSL2 per module options and publishing paths | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
Available keys to override module options: | ||
ext.args = Additional arguments appended to command in module. | ||
ext.prefix = File name prefix for output files. | ||
ext.when = When to run the module. | ||
---------------------------------------------------------------------------------------- | ||
*/ | ||
|
||
|
||
process { | ||
if (params.tools && params.tools.split(',').contains('indexcov')) { | ||
withName: 'SAMTOOLS_INDEX_FOR_INDEXCOV' { | ||
ext.when = { !params.wes } | ||
ext.args = {"-F 3844 -q 30"} | ||
ext.prefix = { "${meta.id}" } | ||
publishDir = [ | ||
enabled : false | ||
] | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
process GOLEFT_INDEXCOV { | ||
label 'process_single' | ||
|
||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? | ||
'https://depot.galaxyproject.org/singularity/goleft:0.2.4--h9ee0642_1': | ||
'biocontainers/goleft:0.2.4--h9ee0642_1' }" | ||
|
||
input: | ||
val(meta) | ||
path(bams) | ||
path(fasta) | ||
path(fai) | ||
output: | ||
path("${prefix}/*"),emit:output | ||
path("versions.yml"),emit:versions | ||
script: | ||
def args = task.ext.args ?: '' | ||
prefix = task.ext.prefix ?: "${meta.id}" | ||
def input_files = bams.findAll{it.name.endsWith(".bam")} + bams.findAll{it.name.endsWith(".crai")} | ||
def extranormalize = input_files.any{it.name.endsWith(".crai")} ? " --extranormalize " : "" | ||
""" | ||
goleft indexcov \\ | ||
--fai "${fai}" \\ | ||
--directory "${prefix}" \\ | ||
${extranormalize} \\ | ||
$args \\ | ||
${input_files.join(" ")} | ||
|
||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
goleft: \$(goleft --version 2>&1 | head -n 1 | sed 's/^.*goleft Version: //') | ||
END_VERSIONS | ||
""" | ||
Comment on lines
+2
to
+33
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could you indent so it is similar to the other modules? |
||
|
||
stub: | ||
def args = task.ext.args ?: '' | ||
prefix = task.ext.prefix ?: "${meta.id}" | ||
""" | ||
mkdir "${prefix}" | ||
touch "${prefix}/${prefix}-indexcov.bed.gz" | ||
|
||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
goleft: \$(goleft --version 2>&1 | head -n 1 | sed 's/^.*goleft Version: //') | ||
END_VERSIONS | ||
""" | ||
} | ||
|
||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
process SAMTOOLS_INDEX_FOR_INDEXCOV { | ||
tag "$meta.id" | ||
label 'process_low' | ||
|
||
conda "bioconda::samtools=1.17" | ||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? | ||
'https://depot.galaxyproject.org/singularity/samtools:1.17--h00cdaf9_0' : | ||
'biocontainers/samtools:1.17--h00cdaf9_0' }" | ||
|
||
input: | ||
tuple val(meta), path(input), path(bai) | ||
path(fasta) | ||
path(fai) | ||
|
||
output: | ||
tuple path("${meta.id}.indexcov.bam"),path("${meta.id}.indexcov.bam.bai"), emit: output | ||
path "versions.yml" , emit: versions | ||
|
||
script: | ||
def args = task.ext.args ?: '' | ||
|
||
""" | ||
# write BAM header only | ||
samtools view --header-only -O BAM \ | ||
--threads ${task.cpus} \ | ||
-o "${meta.id}.indexcov.bam" \ | ||
--reference "${fasta}" \ | ||
"${input}" | ||
|
||
# create index without writing BAM (redirecting to /dev/null) | ||
samtools view ${args} --uncompressed \ | ||
--threads ${task.cpus} \ | ||
-o "/dev/null##idx##${meta.id}.indexcov.bam.bai" \ | ||
--write-index \ | ||
-O BAM \ | ||
--reference "${fasta}" \ | ||
"${input}" | ||
|
||
|
||
|
||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//') | ||
END_VERSIONS | ||
""" | ||
|
||
stub: | ||
""" | ||
touch "${meta.id}.indexcov.bam" | ||
touch "${meta.id}.indexcov.bam.bai" | ||
|
||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//') | ||
END_VERSIONS | ||
""" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,7 +100,7 @@ | |
"fa_icon": "fas fa-toolbox", | ||
"description": "Tools to use for duplicate marking, variant calling and/or for annotation.", | ||
"help_text": "Multiple tools separated with commas.\n\n**Variant Calling:**\n\nGermline variant calling can currently be performed with the following variant callers:\n- SNPs/Indels: DeepVariant, FreeBayes, GATK HaplotypeCaller, mpileup, Sentieon Haplotyper, Strelka\n- Structural Variants: Manta, TIDDIT\n- Copy-number: CNVKit\n\nTumor-only somatic variant calling can currently be performed with the following variant callers:\n- SNPs/Indels: FreeBayes, mpileup, Mutect2, Strelka\n- Structural Variants: Manta, TIDDIT\n- Copy-number: CNVKit, ControlFREEC\n\nSomatic variant calling can currently only be performed with the following variant callers:\n- SNPs/Indels: FreeBayes, Mutect2, Strelka2\n- Structural variants: Manta, TIDDIT\n- Copy-Number: ASCAT, CNVKit, Control-FREEC\n- Microsatellite Instability: MSIsensorpro\n\n> **NB** Mutect2 for somatic variant calling cannot be combined with `--no_intervals`\n\n**Annotation:**\n \n- snpEff, VEP, merge (both consecutively).\n\n> **NB** As Sarek will use bgzip and tabix to compress and index VCF files annotated, it expects VCF files to be sorted when starting from `--step annotate`.", | ||
"pattern": "^((ascat|bcfann|cnvkit|controlfreec|deepvariant|freebayes|haplotypecaller|sentieon_dnascope|sentieon_haplotyper|manta|merge|mpileup|msisensorpro|mutect2|sentieon_dedup|snpeff|strelka|tiddit|vep)?,?)*(?<!,)$" | ||
"pattern": "^((ascat|bcfann|cnvkit|controlfreec|deepvariant|freebayes|haplotypecaller|sentieon_dnascope|sentieon_haplotyper|manta|merge|mpileup|msisensorpro|mutect2|sentieon_dedup|snpeff|strelka|tiddit|vep|indexcov)?,?)*(?<!,)$" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we need alphabetical sorting or Maxime won't let it pass 😄 |
||
}, | ||
"skip_tools": { | ||
"type": "string", | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,29 @@ | ||||||
// | ||||||
// INDEXCOV : call large CNVs using goleft indexcov | ||||||
// | ||||||
// For all modules here: | ||||||
// A when clause condition is defined in the conf/modules.config to determine if the module should be run | ||||||
|
||||||
include { SAMTOOLS_INDEX_FOR_INDEXCOV } from '../../../modules/local/samtools_index_for_indexcov/main' | ||||||
include { GOLEFT_INDEXCOV } from '../../../modules/local/goleft/indexcov/main' | ||||||
|
||||||
|
||||||
workflow BAM_GOLEFT_INDEXCOV { | ||||||
take: | ||||||
bam // channel: [mandatory] [ meta, bam, bai ] | ||||||
fasta // channel: [mandatory] [ fasta ] | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
fai // channel: [mandatory] [ fai ] | ||||||
|
||||||
main: | ||||||
versions = Channel.empty() | ||||||
|
||||||
samtools_index = SAMTOOLS_INDEX_FOR_INDEXCOV(bam, fasta, fai) | ||||||
versions = versions.mix(samtools_index.versions.first()) | ||||||
|
||||||
indexcov_ch = GOLEFT_INDEXCOV([id:"PREFIX"], samtools_index.output.flatten().collect(), fasta, fai) | ||||||
versions = versions.mix(indexcov_ch.versions) | ||||||
|
||||||
emit: | ||||||
versions | ||||||
} | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is the tool run on all bams for all samples in one job?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nevermind I see it further down. The docs say 30sec per 30 WGS 🤯 . Any idea how it scales with number of genomes?