Skip to content

Commit

Permalink
parallel snv-annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
fellen31 committed Jul 23, 2024
1 parent 55c55c5 commit d29582a
Show file tree
Hide file tree
Showing 24 changed files with 1,002 additions and 538 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [#245](https://github.com/genomic-medicine-sweden/nallo/pull/245) - Added repeat annotation with Stranger
- [#252](https://github.com/genomic-medicine-sweden/nallo/pull/252) - Added a new `SCATTER_GENOME` subworkflow
- [#255](https://github.com/genomic-medicine-sweden/nallo/pull/255) - Added a new `RANK_VARIANTS` subworkflow to rank SNVs using genmod
- [#261](https://github.com/genomic-medicine-sweden/nallo/pull/261) - Added a `--skip_rank_variants` parameter to skip the rank_variants subworkflow

### `Changed`

Expand All @@ -35,6 +36,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [#251](https://github.com/genomic-medicine-sweden/nallo/pull/251) - Switched from annotating single sample VCFs to annotating a multisample VCF, splitting the VCF per sample afterwards to keep outputs almost consistent
- [#256](https://github.com/genomic-medicine-sweden/nallo/pull/256) - Changed Stranger to annotate single-sample VCFs instead of a multi-sample VCF
- [#258](https://github.com/genomic-medicine-sweden/nallo/pull/258) - Updated test profile parameters to speed up tests
- [#261](https://github.com/genomic-medicine-sweden/nallo/pull/261) - Changed SNV annotation to run in parallel
- [#261](https://github.com/genomic-medicine-sweden/nallo/pull/261) - Changed SNV output file names and directory structure

### `Removed`

Expand All @@ -57,6 +60,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
| `--extra_gvcfs` | |
| `--skip_repeat_wf` | `--skip_repeat_calling` |
| `--skip_repeat_wf` | `--skip_repeat_annotation` |
| | `--skip_rank_variants` |

> [!NOTE]
> Parameter has been updated if both old and new parameter information is present.
> Parameter has been added if just the new parameter information is present.
> Parameter has been removed if new parameter information isn't present.
## v0.2.0 - [2024-06-26]

Expand Down
32 changes: 28 additions & 4 deletions conf/modules/general.config
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,40 @@ process {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

withName: '.*:NALLO:BCFTOOLS_CONCAT' {
ext.prefix = { params.skip_snv_annotation ? "${meta.id}_snv" : "${meta.id}_snv_annotated" }
ext.args = { [
'--allow-overlaps',
'--output-type z',
'--write-index=tbi'
].join(' ') }
publishDir = [
path: { "${params.outdir}/snvs/multi_sample/${meta.id}" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : (!params.skip_rank_variants && !params.skip_snv_annotation ? null : filename) }
]
}

withName: '.*:NALLO:BCFTOOLS_PLUGINSPLIT' {
ext.prefix = { "${meta.id}_vep" }
ext.args = [
'--output-type z',
'--write-index=tbi'
].join(' ')
publishDir = [
path: { "${params.outdir}/snv_annotation/vep/single_sample/" },
path: { "${params.outdir}/snvs/single_sample/" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
// Can't use prefix as it would come from the original file
saveAs: { filename ->
if (filename.equals('versions.yml')) {
null
} else {
def matcher = filename =~ /(.+)(\.vcf\.gz(?:\.tbi)?)$/
def sample = matcher[0][1]
def extension = matcher[0][2]
def annotated = params.skip_snv_annotation ? "" : (params.skip_rank_variants ? "_annotated" : "_annotated_ranked" )
"${sample}/${sample}_snv${annotated}${extension}"
}
}
]
}
withName: '.*:NALLO:FASTQC' {
Expand Down Expand Up @@ -114,7 +138,7 @@ process {

withName: '.*:NALLO:ECHTVAR_ENCODE' {
publishDir = [
path: { "${params.outdir}/snv_annotation/echtvar/encode/${meta.id}" },
path: { "${params.outdir}/databases/echtvar/encode/${meta.id}" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
Expand Down
6 changes: 3 additions & 3 deletions conf/modules/rank_variants.config
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,17 @@ process {
}

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

withName: '.*:RANK_VARIANTS_SNV:TABIX_TABIX' {
publishDir = [
path: { "${params.outdir}/ranked_variants" },
path: { "${params.outdir}/snvs/multi_sample/${meta.id}" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
Expand Down
44 changes: 9 additions & 35 deletions conf/modules/short_variant_calling.config
Original file line number Diff line number Diff line change
Expand Up @@ -37,56 +37,30 @@ process {
ext.args = '--config DeepVariant_unfiltered'
}

withName: '.*:SHORT_VARIANT_CALLING:BCFTOOLS_CONCAT_GVCF' {
withName: '.*:SHORT_VARIANT_CALLING:BCFTOOLS_CONCAT' {
ext.args = '--allow-overlaps'
}

withName: '.*:SHORT_VARIANT_CALLING:BCFTOOLS_CONCAT_VCF' {
ext.args = '--allow-overlaps'
}

withName: '.*:SHORT_VARIANT_CALLING:BCFTOOLS_SORT_GVCF' {
ext.prefix = { "${vcf.simpleName}_sorted.g" }
ext.args = [
'--output-type z',
'--write-index=tbi'
].join(' ')
publishDir = [
path: { "${params.outdir}/snv_calling/single_sample/deepvariant/gvcf/${meta.id}" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
}

withName: '.*:SHORT_VARIANT_CALLING:BCFTOOLS_SORT_VCF' {
ext.prefix = { "${vcf.simpleName}_sorted" }
withName: '.*:SHORT_VARIANT_CALLING:BCFTOOLS_NORM_SINGLESAMPLE' {
ext.prefix = { "${meta.id}_deepvariant_snv" }
ext.args = [
'--output-type z',
'--write-index=tbi'
'-m -',
'-w 10000',
'--output-type u',
].join(' ')
publishDir = [
path: { "${params.outdir}/snv_calling/single_sample/deepvariant/vcf/${meta.id}" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
}

withName: '.*:SHORT_VARIANT_CALLING:BCFTOOLS_FILLTAGS' {
ext.prefix = { "${meta.id}_ac" }
ext.args = '--output-type b'
ext.args = '--output-type u'
}

withName: '.*:SHORT_VARIANT_CALLING:BCFTOOLS_NORM' {
withName: '.*:SHORT_VARIANT_CALLING:BCFTOOLS_NORM_MULTISAMPLE' {
ext.args = [
'-m -',
'--output-type b',
'--output-type u',
'--write-index=csi',
'-w 10000'
].join(' ')
publishDir = [
path: { "${params.outdir}/snv_calling/multi_sample/glnexus/${meta.id}" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml')? null : (meta.id == "multisample" ? filename : null)}
]
}
}
12 changes: 0 additions & 12 deletions conf/modules/snv_annotation.config
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,6 @@ process {
'--uniprot --vcf',
'--no_stats'
].join(' ') }
publishDir = [
path: { "${params.outdir}/snv_annotation/vep/multi_sample/${meta.id}" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
}

withName: '.*:SNV_ANNOTATION:TABIX_VEP' {
publishDir = [
path: { "${params.outdir}/snv_annotation/vep/multi_sample/${meta.id}" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
}
}
15 changes: 8 additions & 7 deletions docs/output.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,11 +301,11 @@ In case of affected samples, [echtvar](https://github.com/brentp/echtvar) and [V
<details markdown="1">
<summary>Output files from SNV Annotation</summary>

- `{outputdir}/snv_annotation/echtvar/encode/multisample/`
- `{outputdir}/databases/echtvar/encode/multisample/`
- `*.zip`: Database with AF and AC for all samples run
- `{outputdir}/snv_annotation/vep/{single_sample,multi_sample/multisample}/`
- `*.vcf.gz`: VCF with annotated variants
- `*.vcf.gz.tbi`: Index of the corresponding VCF file
- `{outputdir}/snvs/{single_sample,multi_sample/multisample}/`
- `*_snvs_annotated*.vcf.gz`: VCF with annotated variants
- `*_snvs_annotated*.vcf.gz.tbi`: Index of the corresponding VCF file
</details>

### Ranked variants
Expand All @@ -321,9 +321,10 @@ In case of affected samples, [echtvar](https://github.com/brentp/echtvar) and [V
<details markdown="1">
<summary>Output files</summary>

- `{outputdir}ranked_variants/`
- `*_snv_ranked.vcf.gz`: file containing SNV annotations with their rank scores (does not include mitochondrial variants).
- `*_snv_ranked.vcf.gz.tbi`: index of the file containing SNV annotations with their rank scores.
- `{outputdir}/snvs/{single_sample,multi_sample/multisample}/`
- `*_snvs_annotated_ranked.vcf.gz`: VCF with annotated and ranked variants
- `*_snvs_annotated_ranked.vcf.gz.tbi`: Index of the corresponding VCF file
</details>

### SNV Calling

Expand Down
2 changes: 1 addition & 1 deletion modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@
},
"sniffles": {
"branch": "master",
"git_sha": "3f5420aa22e00bd030a2556dfdffc9e164ec0ec5",
"git_sha": "b50aa17b1b604c7b3cfe58a2472d1e7b990ae8bf",
"installed_by": ["modules"],
"patch": "modules/nf-core/sniffles/sniffles.diff"
},
Expand Down
3 changes: 0 additions & 3 deletions modules/nf-core/sniffles/main.nf

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

2 changes: 1 addition & 1 deletion modules/nf-core/sniffles/meta.yml

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

38 changes: 12 additions & 26 deletions modules/nf-core/sniffles/sniffles.diff

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

4 changes: 3 additions & 1 deletion modules/nf-core/tabix/bgzip/environment.yml

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

1 change: 1 addition & 0 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ params {
skip_assembly_wf = params.preset == 'ONT_R10' ? true : false
skip_mapping_wf = false
skip_methylation_wf = params.preset == 'pacbio' ? true : false
skip_rank_variants = false
skip_repeat_calling = params.preset == 'ONT_R10' ? true : false
skip_repeat_annotation = params.preset == 'ONT_R10' ? true : false
skip_phasing_wf = false
Expand Down
4 changes: 4 additions & 0 deletions nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@
"skip_call_paralogs": {
"type": "boolean",
"description": "Skip call paralogs (Paraphase)"
},
"skip_rank_variants": {
"type": "boolean",
"description": "Skip rank variants workflow"
}
},
"fa_icon": "fas fa-american-sign-language-interpreting"
Expand Down
5 changes: 3 additions & 2 deletions subworkflows/local/rank_variants/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ workflow RANK_VARIANTS {
ch_versions = ch_versions.mix(TABIX_TABIX.out.versions)

emit:
vcf = ch_vcf // channel: [ val(meta), path(vcf) ]
versions = ch_versions // channel: [ path(versions.yml) ]
vcf = ch_vcf // channel: [ val(meta), path(vcf) ]
tbi = TABIX_TABIX.out.tbi // channel: [ val(meta), path(tbi) ]
versions = ch_versions // channel: [ path(versions.yml) ]
}
Loading

0 comments on commit d29582a

Please sign in to comment.