Skip to content

Commit

Permalink
Merge pull request #393 from genomic-medicine-sweden/sortvcf
Browse files Browse the repository at this point in the history
sort ranked SVs before indexing
  • Loading branch information
ramprasadn authored Aug 8, 2023
2 parents ce03dfa + b946556 commit b0e4832
Show file tree
Hide file tree
Showing 11 changed files with 277 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Invalid GATK4 container which caused incorrect singularity downloads with nf-core download [nf-core/modules #3668](https://github.com/nf-core/modules/issues/3668)
- Make the default cram prefix same as markduplicates prefix [#392](https://github.com/nf-core/raredisease/pull/392)
- Sort ranked SV vcf before indexing with tabix [#393](https://github.com/nf-core/raredisease/pull/393)
- Make target bed file optional for WGS mode (Issue [#375](https://github.com/nf-core/raredisease/issues/375)) [#395](https://github.com/nf-core/raredisease/pull/395)
- Added constraints to block the pipeline from running CollectWgsMetrics on WES samples [#396](https://github.com/nf-core/raredisease/pull/396)

Expand Down
29 changes: 27 additions & 2 deletions conf/modules/rank_variants.config
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,27 @@ process {
ext.prefix = { "${meta.id}_ranked_sv" }
}

withName: '.*RANK_VARIANTS_SV:TABIX_BGZIPTABIX' {
withName: '.*RANK_VARIANTS_SV:BCFTOOLS_SORT' {
ext.args = "--output-type z"
ext.prefix = { "${meta.id}_ranked_sv" }
publishDir = [
path: { "${params.outdir}/rank_and_filter" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
}

withName: '.*RANK_VARIANTS_SV:TABIX_BGZIP' {
ext.when = false
}

withName: '.*RANK_VARIANTS_SV:TABIX_TABIX' {
publishDir = [
path: { "${params.outdir}/rank_and_filter" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
}
}

//
Expand Down Expand Up @@ -77,12 +90,24 @@ process {
ext.prefix = { "${meta.id}_ranked_snv" }
}

withName: '.*RANK_VARIANTS_SNV:TABIX_BGZIPTABIX' {
withName: '.*RANK_VARIANTS_SNV:BCFTOOLS_SORT' {
ext.when = false
}

withName: '.*RANK_VARIANTS_SNV:TABIX_BGZIP' {
ext.prefix = { "${meta.id}_ranked_snv" }
publishDir = [
path: { "${params.outdir}/rank_and_filter" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
}

withName: '.*RANK_VARIANTS_SNV:TABIX_TABIX' {
publishDir = [
path: { "${params.outdir}/rank_and_filter" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
}
}
8 changes: 8 additions & 0 deletions conf/modules/raredisease.config
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ process {
process {
withName: '.*FILTER_VEP_SNV' {
ext.prefix = { "${meta.id}_clinical_snv" }
}

withName: '.*BGZIPTABIX_SNV' {
ext.prefix = { "${meta.id}_clinical_snv" }
publishDir = [
path: { "${params.outdir}/rank_and_filter" },
mode: params.publish_dir_mode,
Expand All @@ -116,6 +120,10 @@ process {
process {
withName: '.*FILTER_VEP_SV' {
ext.prefix = { "${meta.id}_clinical_sv" }
}

withName: '.*BGZIPTABIX_SV' {
ext.prefix = { "${meta.id}_clinical_sv" }
publishDir = [
path: { "${params.outdir}/rank_and_filter" },
mode: params.publish_dir_mode,
Expand Down
10 changes: 10 additions & 0 deletions modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
"installed_by": ["modules"]
},
"bcftools/sort": {
"branch": "master",
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
"installed_by": ["modules"]
},
"bcftools/view": {
"branch": "master",
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
Expand Down Expand Up @@ -360,6 +365,11 @@
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
"installed_by": ["modules"]
},
"tabix/bgzip": {
"branch": "master",
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
"installed_by": ["modules"]
},
"tabix/bgziptabix": {
"branch": "master",
"git_sha": "591b71642820933dcb3c954c934b397bd00d8e5e",
Expand Down
8 changes: 4 additions & 4 deletions modules/local/filter_vep.nf
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ process FILTER_VEP {
path (select_feature_file)

output:
tuple val(meta), path("*.ann_filter.vcf.gz"), emit: vcf
path "versions.yml" , emit: versions
tuple val(meta), path("*.ann_filter.vcf"), emit: vcf
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when
Expand All @@ -26,7 +26,7 @@ process FILTER_VEP {
filter_vep \\
--format vcf \\
--input_file $vcf \\
--output_file ${prefix}.ann_filter.vcf.gz \\
--output_file ${prefix}.ann_filter.vcf \\
--only_matched \\
--filter \"HGNC_ID in ${select_feature_file}\"
Expand All @@ -39,7 +39,7 @@ process FILTER_VEP {
stub:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${prefix}.ann_filter.vcf.gz
touch ${prefix}.ann_filter.vcf
cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand Down
60 changes: 60 additions & 0 deletions modules/nf-core/bcftools/sort/main.nf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 43 additions & 0 deletions modules/nf-core/bcftools/sort/meta.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 54 additions & 0 deletions modules/nf-core/tabix/bgzip/main.nf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 47 additions & 0 deletions modules/nf-core/tabix/bgzip/meta.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 15 additions & 5 deletions subworkflows/local/rank_variants.nf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ include { GENMOD_ANNOTATE } from '../../modules/nf-core/genmod/annotate/main'
include { GENMOD_MODELS } from '../../modules/nf-core/genmod/models/main'
include { GENMOD_SCORE } from '../../modules/nf-core/genmod/score/main'
include { GENMOD_COMPOUND } from '../../modules/nf-core/genmod/compound/main'
include { TABIX_BGZIPTABIX } from '../../modules/nf-core/tabix/bgziptabix/main'
include { BCFTOOLS_SORT } from '../../modules/nf-core/bcftools/sort/main'
include { TABIX_BGZIP } from '../../modules/nf-core/tabix/bgzip/main'
include { TABIX_TABIX } from '../../modules/nf-core/tabix/tabix/main'

workflow RANK_VARIANTS {

Expand All @@ -27,15 +29,23 @@ workflow RANK_VARIANTS {

GENMOD_COMPOUND(GENMOD_SCORE.out.vcf)

TABIX_BGZIPTABIX (GENMOD_COMPOUND.out.vcf)
BCFTOOLS_SORT(GENMOD_COMPOUND.out.vcf) // SV file needs to be sorted before indexing

TABIX_BGZIP(GENMOD_COMPOUND.out.vcf) //run only for SNVs

ch_vcf = TABIX_BGZIP.out.output.mix(BCFTOOLS_SORT.out.vcf)

TABIX_TABIX (ch_vcf)

ch_versions = ch_versions.mix(GENMOD_ANNOTATE.out.versions)
ch_versions = ch_versions.mix(GENMOD_MODELS.out.versions)
ch_versions = ch_versions.mix(GENMOD_SCORE.out.versions)
ch_versions = ch_versions.mix(GENMOD_COMPOUND.out.versions)
ch_versions = ch_versions.mix(TABIX_BGZIPTABIX.out.versions)
ch_versions = ch_versions.mix(BCFTOOLS_SORT.out.versions)
ch_versions = ch_versions.mix(TABIX_BGZIP.out.versions)
ch_versions = ch_versions.mix(TABIX_TABIX.out.versions)

emit:
vcf = TABIX_BGZIPTABIX.out.gz_tbi.map { meta, vcf, tbi -> return [ meta, vcf ] }.collect() // channel: [ val(meta), path(vcf) ]
versions = ch_versions // channel: [ path(versions.yml) ]
vcf = ch_vcf // channel: [ val(meta), path(vcf) ]
versions = ch_versions // channel: [ path(versions.yml) ]
}
Loading

0 comments on commit b0e4832

Please sign in to comment.