Skip to content

Commit

Permalink
Fix rank SVs with multiple families (#480)
Browse files Browse the repository at this point in the history
* Fix rank SVs with multiple families

* use updated genmod modules

* fix tests
  • Loading branch information
fellen31 authored Nov 5, 2024
1 parent 9953afa commit c47f69a
Show file tree
Hide file tree
Showing 18 changed files with 133 additions and 84 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [#451](https://github.com/genomic-medicine-sweden/nallo/pull/451) - Simplified methylation subworkflow
- [#474](https://github.com/genomic-medicine-sweden/nallo/pull/474) - Updated VEP and CADD channels to fix bugs introduced in [#443](https://github.com/genomic-medicine-sweden/nallo/pull/443)
- [#479](https://github.com/genomic-medicine-sweden/nallo/pull/479) - Replaced bgzip tabix with bcftools sort in rank variants to fix [#457](https://github.com/genomic-medicine-sweden/nallo/issues/457)
- [#480](https://github.com/genomic-medicine-sweden/nallo/pull/480) - Updated ranking of SVs to work with multiple families per project
- [#484](https://github.com/genomic-medicine-sweden/nallo/pull/484) - Updated metro map and added SVG version
- [#487](https://github.com/genomic-medicine-sweden/nallo/pull/487) - Changed CI tests to only run tests where changes have been made

Expand Down
9 changes: 8 additions & 1 deletion conf/modules/general.config
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,14 @@ process {

withName: '.*:NALLO:SOMALIER_PED' {
publishDir = [
path: { "${params.outdir}/pedigree" },
path: { "${params.outdir}/pedigree/project/" },
saveAs: { filename -> filename.equals('versions.yml') ? null : filename },
]
}

withName: '.*:NALLO:SOMALIER_PED_FAMILY' {
publishDir = [
path: { "${params.outdir}/pedigree/family/" },
saveAs: { filename -> filename.equals('versions.yml') ? null : filename },
]
}
Expand Down
13 changes: 7 additions & 6 deletions docs/output.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,13 @@ If the pipeline is run with phasing, the aligned reads will be happlotagged usin

[somalier](https://github.com/brentp/somalier) checks relatedness and sex.

| Path | Description |
| ----------------------------------------------------- | ------------------------------------------- |
| `pedigree/{project}.ped` | PED file updated with somalier-inferred sex |
| `qc/somalier/relate/{project}/{project}.html` | HTML report |
| `qc/somalier/relate/{project}/{project}.pairs.tsv` | Information about sample pairs |
| `/qc/somalier/relate/{project}/{project}.samples.tsv` | Information about individual samples |
| Path | Description |
| ----------------------------------------------------- | ------------------------------------------------------- |
| `pedigree/{project}/{project}.ped` | PED file updated with somalier-inferred sex per project |
| `pedigree/{family}/{family).ped` | PED file updated with somalier-inferred sex per family |
| `qc/somalier/relate/{project}/{project}.html` | HTML report |
| `qc/somalier/relate/{project}/{project}.pairs.tsv` | Information about sample pairs |
| `/qc/somalier/relate/{project}/{project}.samples.tsv` | Information about individual samples |

| Path | Description |
| ------------------------- | ------------------------------------------- |
Expand Down
4 changes: 2 additions & 2 deletions modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@
},
"genmod/models": {
"branch": "master",
"git_sha": "91a84f951358143e93dc9e03470db4e6a4a7105c",
"git_sha": "f888300c726e1f817a9f93a680866ff7e6c669f6",
"installed_by": ["modules"]
},
"genmod/score": {
"branch": "master",
"git_sha": "91a84f951358143e93dc9e03470db4e6a4a7105c",
"git_sha": "f888300c726e1f817a9f93a680866ff7e6c669f6",
"installed_by": ["modules"]
},
"gfastats": {
Expand Down
19 changes: 10 additions & 9 deletions modules/local/create_pedigree_file/main.nf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
process CREATE_PEDIGREE_FILE {
tag "${project}"
tag "${meta.id}"
label 'process_single'

conda "conda-forge::python=3.8.3"
Expand All @@ -8,20 +8,20 @@ process CREATE_PEDIGREE_FILE {
'biocontainers/python:3.8.3' }"

input:
tuple val(project), val(meta)
tuple val(meta), val(metas)

output:
tuple val(project), path("*.ped"), emit: ped
path "versions.yml" , emit: versions
tuple val(meta), path("*.ped"), emit: ped
path "versions.yml" , emit: versions

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

script:
def out = new File(project + ".ped")
def samples = (meta.collect().size() > 1) ? meta.sort{ a, b ->
def prefix = task.ext.prefix ?: "${meta.id}"
def samples = (metas.collect().size() > 1) ? metas.sort{ a, b ->
// First sort on family_id, then on sample id
a.family_id <=> b.family_id ?: a.id <=> b.id } : meta
a.family_id <=> b.family_id ?: a.id <=> b.id } : metas
outfile_text = ['#family_id', 'sample_id', 'father', 'mother', 'sex', 'phenotype'].join('\\t')
def samples_list = []
for(int i = 0; i<samples.size(); i++) {
Expand All @@ -32,7 +32,7 @@ process CREATE_PEDIGREE_FILE {
}
}
"""
echo -e "$outfile_text" >${project}.ped
echo -e "$outfile_text" > ${prefix}.ped
cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand All @@ -42,8 +42,9 @@ process CREATE_PEDIGREE_FILE {
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${project}.ped
touch ${prefix}.ped
cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand Down
3 changes: 1 addition & 2 deletions modules/nf-core/genmod/models/main.nf

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

4 changes: 2 additions & 2 deletions modules/nf-core/genmod/models/meta.yml

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

12 changes: 6 additions & 6 deletions modules/nf-core/genmod/models/tests/main.nf.test

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

3 changes: 1 addition & 2 deletions modules/nf-core/genmod/score/main.nf

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

4 changes: 2 additions & 2 deletions modules/nf-core/genmod/score/meta.yml

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

12 changes: 6 additions & 6 deletions modules/nf-core/genmod/score/tests/main.nf.test

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

16 changes: 11 additions & 5 deletions subworkflows/local/rank_variants/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ workflow RANK_VARIANTS {

take:
ch_vcf // channel: [mandatory] [ val(meta), path(vcf) ]
ch_pedfile // channel: [mandatory] [ val(meta), path(ped) ]
ch_ped // channel: [mandatory] [ val(meta), path(ped) ]
ch_reduced_penetrance // channel: [mandatory] [ val(meta), path(pentrance) ]
ch_score_config // channel: [mandatory] [ val(meta), path(ini) ]

Expand All @@ -22,16 +22,22 @@ workflow RANK_VARIANTS {
GENMOD_ANNOTATE ( ch_vcf )
ch_versions = ch_versions.mix(GENMOD_ANNOTATE.out.versions)

GENMOD_ANNOTATE.out.vcf
.join( ch_ped, failOnMismatch: true )
.set { genmod_models_in }

GENMOD_MODELS (
GENMOD_ANNOTATE.out.vcf,
ch_pedfile.map { meta, ped -> ped },
genmod_models_in,
ch_reduced_penetrance.map { meta, file -> file }
)
ch_versions = ch_versions.mix(GENMOD_MODELS.out.versions)

GENMOD_MODELS.out.vcf
.join( ch_ped, failOnMismatch: true )
.set { genmod_score_in }

GENMOD_SCORE (
GENMOD_MODELS.out.vcf,
ch_pedfile.map { meta, ped -> ped },
genmod_score_in,
ch_score_config.map { meta, file -> file }
)
ch_versions = ch_versions.mix(GENMOD_SCORE.out.versions)
Expand Down
16 changes: 8 additions & 8 deletions subworkflows/local/rank_variants/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ nextflow_workflow {
process {
"""
input[0] = [
[ id: 'test', num_intervals:1 ],
[ id: 'project', num_intervals:1 ],
file(params.pipelines_testdata_base_path + 'testdata/HG002_PacBio_Revio.fastq.gz', checkIfExists: true)
]
input[1] = PREPARE_GENOME.out.fasta
Expand All @@ -46,7 +46,7 @@ nextflow_workflow {
input[0] = MINIMAP2_ALIGN.out.bam
.join(MINIMAP2_ALIGN.out.index)
.join(Channel.of([
[ id: 'test', num_intervals:1 ],
[ id: 'project', num_intervals:1 ],
file(params.pipelines_testdata_base_path + 'reference/test_data.bed', checkIfExists: true)
]))
input[1] = PREPARE_GENOME.out.fasta
Expand Down Expand Up @@ -95,9 +95,9 @@ nextflow_workflow {
process {
"""
input[0] = [
'project',
[id:'project'],
[
[ id: 'test', project: 'project', maternal_id: '0', paternal_id: '0', family_id: 'family', sex: '2', phenotype: '2' ]
[ id: 'project', project: 'project', maternal_id: '0', paternal_id: '0', family_id: 'family', sex: '2', phenotype: '2' ]
]
]
"""
Expand All @@ -110,8 +110,8 @@ nextflow_workflow {
when {
workflow {
"""
input[0] = ANNOTATE_CSQ_PLI.out.vcf
input[1] = CREATE_PEDIGREE_FILE.out.ped
input[0] = ANNOTATE_CSQ_PLI.out.vcf.map { meta, vcf -> [ [ id: 'test' ], vcf ] }
input[1] = CREATE_PEDIGREE_FILE.out.ped.map { meta, ped -> [ [ id: 'test' ], ped ] }
input[2] = Channel.of([
[ id: 'reduced_penetrance' ],
file(params.pipelines_testdata_base_path + 'reference/reduced_penetrance.tsv', checkIfExists: true)
Expand Down Expand Up @@ -142,8 +142,8 @@ nextflow_workflow {
when {
workflow {
"""
input[0] = ANNOTATE_CSQ_PLI.out.vcf
input[1] = CREATE_PEDIGREE_FILE.out.ped
input[0] = ANNOTATE_CSQ_PLI.out.vcf.map { meta, vcf -> [ [ id: 'test' ], vcf ] }
input[1] = CREATE_PEDIGREE_FILE.out.ped.map { meta, ped -> [ [ id: 'test' ], ped ] }
input[2] = Channel.of([
[ id: 'reduced_penetrance' ],
file(params.pipelines_testdata_base_path + 'reference/reduced_penetrance.tsv', checkIfExists: true)
Expand Down
26 changes: 9 additions & 17 deletions subworkflows/local/rank_variants/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,17 @@
"0": [
[
{
"id": "test_data.bed",
"project": null,
"contains_affected": false
"id": "test"
},
"test_data.bed_sorted.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
"test_sorted.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
]
],
"1": [
[
{
"id": "test_data.bed",
"project": null,
"contains_affected": false
"id": "test"
},
"test_data.bed_sorted.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e"
"test_sorted.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"2": [
Expand All @@ -42,21 +38,17 @@
"tbi": [
[
{
"id": "test_data.bed",
"project": null,
"contains_affected": false
"id": "test"
},
"test_data.bed_sorted.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e"
"test_sorted.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"vcf": [
[
{
"id": "test_data.bed",
"project": null,
"contains_affected": false
"id": "test"
},
"test_data.bed_sorted.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
"test_sorted.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
]
],
"versions": [
Expand All @@ -72,6 +64,6 @@
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-11-01T13:03:00.102392544"
"timestamp": "2024-11-04T14:34:36.22073696"
}
}
Loading

0 comments on commit c47f69a

Please sign in to comment.