-
Notifications
You must be signed in to change notification settings - Fork 951
Add BEAGLE5 imputation subworkflow
#9550
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
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
03a1f54
Update glimpse2 sbwf
LouisLeNezet 9869ad6
Merge branch 'master' into sbwf_glimpse2
LouisLeNezet 669bbcb
Update test
0c14473
Add region to beagle5
15c36df
Add subworkflow
6d3183b
Fix linting
9df2952
Merge branch 'master' into sbwf_beagle5
LouisLeNezet d217af1
Fix linting
4422555
Fix linting
58f73bf
Merge branch 'master' into sbwf_beagle5
LouisLeNezet d65e2d0
Merge branch 'master' into sbwf_beagle5
LouisLeNezet a15d833
Update subworkflows/nf-core/vcf_impute_beagle5/main.nf
LouisLeNezet 24f0c1f
Add comment
LouisLeNezet 11298c7
Update grouping and test
LouisLeNezet d62764d
Remove tag
LouisLeNezet b753925
Revert change glimpse2 reference
LouisLeNezet b3761db
Revert change glimpse2 sbwf
LouisLeNezet 8c19df1
Revert change glimpse2 sbwf
LouisLeNezet 88b2d15
Revert change glimpse2 sbwf
LouisLeNezet c734ae2
Merge branch 'master' into sbwf_beagle5
LouisLeNezet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,116 @@ | ||
| include { BEAGLE5_BEAGLE } from '../../../modules/nf-core/beagle5/beagle' | ||
| include { BCFTOOLS_VIEW } from '../../../modules/nf-core/bcftools/view' | ||
| include { GLIMPSE2_LIGATE } from '../../../modules/nf-core/glimpse2/ligate' | ||
| include { BCFTOOLS_INDEX as BCFTOOLS_INDEX_BEAGLE } from '../../../modules/nf-core/bcftools/index' | ||
| include { BCFTOOLS_INDEX as BCFTOOLS_INDEX_LIGATE } from '../../../modules/nf-core/bcftools/index' | ||
|
|
||
| workflow VCF_IMPUTE_BEAGLE5 { | ||
|
|
||
| take: | ||
| ch_input // channel (mandatory): [ [id], vcf, tbi ] | ||
| ch_panel // channel (mandatory): [ [panel, chr], vcf, tbi ] | ||
| ch_chunks // channel (optional) : [ [panel, chr], regionout ] | ||
| ch_map // channel (optional) : [ [chr], map] | ||
|
|
||
| main: | ||
| ch_versions = channel.empty() | ||
|
|
||
| // Branch input files based on format | ||
| ch_input | ||
| .branch { _meta, vcf, _tbi -> | ||
| bcf: vcf.name.contains('.bcf') | ||
| vcf: vcf.name.contains('.vcf') | ||
| other: true | ||
| } | ||
| .set { ch_input_branched } | ||
|
|
||
| ch_input_branched.other.map{ _meta, vcf, _tbi -> | ||
| error "ERROR: ${vcf.name} in ch_input channel must be in VCF or BCF format." | ||
| } | ||
|
|
||
| // Convert BCF to VCF if necessary | ||
| BCFTOOLS_VIEW( | ||
| ch_input_branched.bcf, | ||
| [], [], [] | ||
| ) | ||
| ch_versions = ch_versions.mix(BCFTOOLS_VIEW.out.versions.first()) | ||
|
|
||
| // Combine VCF files | ||
| ch_ready_vcf = ch_input_branched.vcf | ||
| .mix(BCFTOOLS_VIEW.out.vcf | ||
| .join( | ||
| BCFTOOLS_VIEW.out.csi | ||
| .mix(BCFTOOLS_VIEW.out.tbi) | ||
| ) | ||
| ) | ||
|
|
||
| // Prepare input channels for BEAGLE5 by combining VCF, panel, and map files | ||
| ch_chunks_counts = ch_chunks | ||
| .groupTuple() | ||
LouisLeNezet marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| .map { metaPC, regionouts -> | ||
| [metaPC, regionouts.size()] | ||
| } | ||
|
|
||
| ch_panel_map = ch_panel | ||
| .combine(ch_map, by: 0) | ||
| .combine(ch_chunks, by: 0) | ||
| .combine(ch_chunks_counts, by: 0) | ||
|
|
||
| ch_panel_map.ifEmpty{ | ||
| error "ERROR: join operation resulted in an empty channel. Please provide a valid ch_panel and ch_map channel as input." | ||
| } | ||
|
|
||
| ch_beagle_input = ch_ready_vcf | ||
| .combine(ch_panel_map) | ||
| .map { metaI, input_vcf, input_index, metaPC, panel_vcf, panel_index, map, regionout, regionsize -> [ | ||
| metaI + metaPC + ["regionout": regionout, "regionsize": regionsize], | ||
| input_vcf, input_index, | ||
| panel_vcf, panel_index, | ||
| map, [], [], regionout | ||
| ]} | ||
|
|
||
| // Run BEAGLE5 imputation | ||
| BEAGLE5_BEAGLE(ch_beagle_input) | ||
| ch_versions = ch_versions.mix(BEAGLE5_BEAGLE.out.versions.first()) | ||
|
|
||
| // Index the imputed VCF files | ||
| BCFTOOLS_INDEX_BEAGLE(BEAGLE5_BEAGLE.out.vcf) | ||
| ch_versions = ch_versions.mix(BCFTOOLS_INDEX_BEAGLE.out.versions.first()) | ||
|
|
||
| // Ligate all phased files in one and index it | ||
| ligate_input = BEAGLE5_BEAGLE.out.vcf | ||
| .join( | ||
| BCFTOOLS_INDEX_BEAGLE.out.tbi | ||
| .mix(BCFTOOLS_INDEX_BEAGLE.out.csi) | ||
| ) | ||
| .map{ meta, vcf, index -> | ||
| def keysToKeep = meta.keySet() - ['regionout', 'regionsize'] | ||
| [ | ||
| groupKey(meta.subMap(keysToKeep), meta.regionsize), | ||
| vcf, index | ||
| ] | ||
| } | ||
| .groupTuple() | ||
LouisLeNezet marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| .map{ groupKeyObj, vcf, index -> | ||
| // Extract the actual meta from the groupKey | ||
| def meta = groupKeyObj.getGroupTarget() | ||
| [meta, vcf, index] | ||
| } | ||
|
|
||
| GLIMPSE2_LIGATE( ligate_input ) | ||
| ch_versions = ch_versions.mix( GLIMPSE2_LIGATE.out.versions.first() ) | ||
|
|
||
| BCFTOOLS_INDEX_LIGATE( GLIMPSE2_LIGATE.out.merged_variants ) | ||
| ch_versions = ch_versions.mix( BCFTOOLS_INDEX_LIGATE.out.versions.first() ) | ||
|
|
||
| // Join imputed and index files | ||
| ch_vcf_index = GLIMPSE2_LIGATE.out.merged_variants | ||
| .join( | ||
| BCFTOOLS_INDEX_LIGATE.out.tbi | ||
| .mix(BCFTOOLS_INDEX_LIGATE.out.csi) | ||
| ) | ||
|
|
||
| emit: | ||
| vcf_index = ch_vcf_index // channel: [ [id, chr, tools], vcf, index ] | ||
| versions = ch_versions // channel: [ versions.yml ] | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| # yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/subworkflows/yaml-schema.json | ||
| name: VCF_IMPUTE_BEAGLE5 | ||
| description: | | ||
| Subworkflow to impute VCF files using BEAGLE5 software. The subworkflow | ||
| takes VCF files, phased reference panel, genetic maps and chunks region to perform imputation | ||
| and outputs phased and imputed VCF files. | ||
| Meta map of all channels, except ch_input, will be used to perform joint operations. | ||
| "regionout" and "regionsize" keys will be added to the meta map to distinguish the different | ||
| file before ligation and therefore should not be used. | ||
| keywords: | ||
| - VCF | ||
| - imputation | ||
| - beagle5 | ||
| - phasing | ||
| components: | ||
| - beagle5/beagle | ||
| - bcftools/index | ||
| - bcftools/view | ||
| - glimpse2/ligate | ||
| input: | ||
| - ch_input: | ||
| description: Channel with input data | ||
| structure: | ||
| - meta: | ||
| type: map | ||
| description: | | ||
| Metadata map containing sample information | ||
| - vcf: | ||
| type: file | ||
| description: Input VCF files | ||
| pattern: "*.{vcf,bcf}{.gz}?" | ||
| - index: | ||
| type: file | ||
| description: Input index file | ||
| pattern: "*.{tbi,csi}" | ||
| - ch_panel: | ||
| description: Channel with phased reference panel data | ||
| structure: | ||
| - meta: | ||
| type: map | ||
| description: | | ||
| Metadata map that will be combined with the input data map | ||
| - vcf: | ||
| type: file | ||
| description: Reference panel VCF files by chromosomes | ||
| pattern: "*.{vcf,bcf,vcf.gz}" | ||
| - index: | ||
| type: file | ||
| description: Reference panel VCF index files | ||
| pattern: "*.{tbi,csi}" | ||
| - ch_chunks: | ||
| description: Channel containing the region to impute | ||
| structure: | ||
| - meta: | ||
| type: map | ||
| description: | | ||
| Metadata map containing chromosome information | ||
| - regionout: | ||
| type: string | ||
| description: Region to perform the phasing on | ||
| pattern: "[chr]+[0-9]+:[0-9]+-[0-9]+" | ||
| - ch_map: | ||
| description: Channel with genetic map data | ||
| structure: | ||
| - meta: | ||
| type: map | ||
| description: | | ||
| Metadata map containing chromosome information | ||
| - map: | ||
| type: file | ||
| description: Plink format genetic map files | ||
| pattern: "*.map" | ||
| output: | ||
| - vcf_index: | ||
| description: Channel with imputed and phased VCF files | ||
| structure: | ||
| - meta: | ||
| type: map | ||
| description: | | ||
| Metadata map of the target input file combined with the reference panel map. | ||
| - vcf: | ||
| type: file | ||
| description: VCF imputed and phased file by sample | ||
| pattern: "*.{vcf,bcf,vcf.gz}" | ||
| - index: | ||
| type: file | ||
| description: VCF index file | ||
| pattern: "*.{tbi,csi}" | ||
| - versions: | ||
| description: Channel containing software versions file | ||
| structure: | ||
| - versions.yml: | ||
| type: file | ||
| description: File containing versions of the software used | ||
| authors: | ||
| - "@LouisLeNezet" | ||
| - "@gichas" | ||
| maintainers: | ||
| - "@LouisLeNezet" | ||
| - "@gichas" |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.