Skip to content

Commit

Permalink
Merge pull request nf-core#86 from atrigila/bcftools_convert
Browse files Browse the repository at this point in the history
Bcftools convert to vcf_sites_extract_bcftools
  • Loading branch information
atrigila authored Jun 11, 2024
2 parents f7e5586 + 2d7f589 commit 150cb9e
Show file tree
Hide file tree
Showing 18 changed files with 221 additions and 136 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Initial release of nf-core/phaseimpute, created with the [nf-core](https://nf-co
- [#78](https://github.com/nf-core/phaseimpute/pull/78) - Separate validate step from panel preparation.
- [#84](https://github.com/nf-core/phaseimpute/pull/84) - Change depth computation to use SAMTOOLS_DEPTH and make separation by chromosome only if regions are specified.
- [#85](https://github.com/nf-core/phaseimpute/pull/85) - Use external params in individual tests for tools.
- [#86](https://github.com/nf-core/phaseimpute/pull/86) - Move `bcftools_convert` to `vcf_sites_extract_bcftools`.

### `Fixed`

Expand Down
10 changes: 0 additions & 10 deletions assets/schema_input_panel.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,6 @@
"type": "string",
"pattern": "^\\S+\\.(vcf|bcf)(\\.gz)?\\.(tbi|csi)$",
"errorMessage": "Panel index file must be provided, cannot contain spaces and must have extension '.vcf' or '.bcf' with optional '.gz' extension and with '.csi' or '.tbi' extension"
},
"hap": {
"type": "string",
"pattern": "^\\S+\\.(hap)(\\.gz)?$",
"errorMessage": "Hap file can be provided, cannot contain spaces and must have extension '.hap' with '.gz' extension"
},
"legend": {
"type": "string",
"pattern": "^\\S+\\.(legend)(\\.gz)?$",
"errorMessage": "Legend file can be provided, cannot contain spaces and must have extension '.hap' with '.gz' extension"
}
},
"required": ["panel", "chr", "vcf", "index"]
Expand Down
10 changes: 10 additions & 0 deletions assets/schema_posfile.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@
"type": "string",
"pattern": "^\\S+\\.(txt|tsv)(\\.gz)?$",
"errorMessage": "TXT with sites (position file) per chromosome must be provided. Must have .txt or .tsv extension with optional .gz"
},
"hap": {
"type": "string",
"pattern": "^\\S+\\.(hap)(\\.gz)?$",
"errorMessage": "Hap file can be provided, cannot contain spaces and must have extension '.hap' with '.gz' extension"
},
"legend": {
"type": "string",
"pattern": "^\\S+\\.(legend)(\\.gz)?$",
"errorMessage": "Legend file can be provided, cannot contain spaces and must have extension '.hap' with '.gz' extension"
}
},
"required": ["panel", "chr", "vcf", "index", "txt"]
Expand Down
1 change: 1 addition & 0 deletions conf/steps/imputation_glimpse1.config
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ process {
// Impute with GLIMPSE1
withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:VCF_IMPUTE_GLIMPSE1:.*' {
publishDir = [ enabled: false ]
tag = {"${meta.id} ${meta.chr}"}
}

// Call the variants before imputation
Expand Down
1 change: 1 addition & 0 deletions conf/steps/imputation_glimpse2.config
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ process {

withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:VCF_IMPUTE_GLIMPSE2:.*' {
publishDir = [ enabled: false ]
tag = {"${meta.id} ${meta.chr}"}
}

withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:VCF_IMPUTE_GLIMPSE2:GLIMPSE2_PHASE' {
Expand Down
1 change: 1 addition & 0 deletions conf/steps/imputation_quilt.config
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ process {
path: { "${params.outdir}/imputation/quilt/" },
mode: params.publish_dir_mode,
]
tag = {"${meta.id} ${meta.chr}"}
}

// Impute quilt
Expand Down
7 changes: 4 additions & 3 deletions conf/steps/imputation_stitch.config
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,17 @@ process {
}

withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:POSFILE_PREPARE_GAWK:GUNZIP' {
ext.prefix = { "${meta.panel}_${meta.chr}_original_posfile" }
ext.prefix = { "${meta.id}_${meta.chr}_original_posfile" }
publishDir = [enabled: false]
tag = {"${meta.panel}_${meta.chr}"}
tag = {"${meta.id} ${meta.chr}"}
}

withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:POSFILE_PREPARE_GAWK:GAWK' {
ext.args = "'{ gsub(\",\", \"\\t\") ; key = \$1 FS \$2 } !seen[key]++'" // Remove duplicates
ext.prefix = { "${meta.panel}_${meta.chr}_posfile_stitch" }
ext.prefix = { "${meta.id}_${meta.chr}_posfile_stitch" }
ext.suffix = "txt"
publishDir = [enabled: false]
tag = {"${meta.id} ${meta.chr}"}
}

withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:BAM_IMPUTE_STITCH:STITCH' {
Expand Down
24 changes: 15 additions & 9 deletions conf/steps/panel_prep.config
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ process {
mode: params.publish_dir_mode,
enabled: false
]
tag = {"${meta.id} ${meta.chr}"}
}

withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:VCF_CHR_CHECK:VCF_CHR_RENAME:BCFTOOLS_ANNOTATE' {
Expand All @@ -35,6 +36,7 @@ process {
// Subworkflow: VCF_NORMALIZE_BCFTOOLS
withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:VCF_NORMALIZE_BCFTOOLS:.*' {
publishDir = [ enabled: false ]
tag = {"${meta.id} ${meta.chr}"}
}

withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:VCF_NORMALIZE_BCFTOOLS:BCFTOOLS_NORM' {
Expand Down Expand Up @@ -99,22 +101,14 @@ process {
]
}

withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:VCF_NORMALIZE_BCFTOOLS:BCFTOOLS_CONVERT' {
ext.args = {"--haplegendsample ${meta.id}_${meta.chr}"}
publishDir = [
path: { "${params.outdir}/prep_panel/haplegend/" },
mode: params.publish_dir_mode,
enabled: true
]
}

// Subworkflow: VCF_PHASE_SHAPEIT5
withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:VCF_PHASE_SHAPEIT5:.*' {
publishDir = [
path: { "${params.outdir}/prep_panel/phasing" },
mode: params.publish_dir_mode,
enabled: false
]
tag = {"${meta.id} ${meta.chr}"}
}

withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:VCF_PHASE_SHAPEIT5:GLIMPSE2_CHUNK' {
Expand All @@ -126,8 +120,19 @@ process {
}

// Subworkflow: VCF_SITES_EXTRACT_BCFTOOLS

withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:VCF_SITES_EXTRACT_BCFTOOLS:.*' {
publishDir = [ enabled: false ]
tag = {"${meta.id} ${meta.chr}"}
}

withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:VCF_SITES_EXTRACT_BCFTOOLS:BCFTOOLS_CONVERT' {
ext.args = {"--haplegendsample ${meta.id}_${meta.chr}"}
publishDir = [
path: { "${params.outdir}/prep_panel/haplegend/" },
mode: params.publish_dir_mode,
enabled: true
]
}

withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:VCF_SITES_EXTRACT_BCFTOOLS:BCFTOOLS_VIEW' {
Expand Down Expand Up @@ -207,6 +212,7 @@ process {
mode: params.publish_dir_mode,
enabled: true
]
tag = {"${meta.id} ${meta.chr}"}
}

withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:VCF_CHUNK_GLIMPSE:GLIMPSE_CHUNK' {
Expand Down
7 changes: 6 additions & 1 deletion conf/steps/simulation.config
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
process {
withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:BAM_REGION:.*' {
publishDir = [ enabled: false ]
tag = {"${meta.id} ${meta.chr}"}
}
withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:BAM_REGION:SAMTOOLS_VIEW' {
ext.prefix = { "${meta.id}_R${meta.region.replace(':','_')}" }
Expand All @@ -23,10 +24,12 @@ process {
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename },
]
tag = {"${meta.id} ${meta.chr}"}
}
withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:BAM_DOWNSAMPLE:SAMTOOLS_DEPTH' {
publishDir = [enabled: false]
ext.prefix = { "${meta.id}_C${meta.chr ?: "all"}.stats" }
ext.prefix = { "${meta1.id}_C${meta1.chr ?: "all"}.depth" }
tag = {"${meta1.id}"}
}
withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:BAM_DOWNSAMPLE:SAMTOOLS_VIEW' {
ext.prefix = { params.input_region ?
Expand All @@ -48,9 +51,11 @@ process {
}
withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:BAM_DOWNSAMPLE:SAMTOOLS_MERGE' {
ext.prefix = { "${meta.id}" }
tag = {"${meta.id}"}
}
withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:BAM_DOWNSAMPLE:SAMTOOLS_INDEX_2' {
ext.args = ""
tag = {"${meta.id}"}
}

// Coverage process
Expand Down
3 changes: 3 additions & 0 deletions conf/steps/validation.config
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ process {
// Compute genotype likelihoods for the truth set
withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:GL_TRUTH:.*' {
publishDir = [ enabled: false ]
tag = {"${meta.id} ${meta.chr}"}
}

withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:GL_TRUTH:BCFTOOLS_MPILEUP' {
Expand Down Expand Up @@ -65,6 +66,7 @@ process {
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
tag = {"${meta.id} ${meta.panel}"}
}

withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:VCF_CONCORDANCE_GLIMPSE2:GLIMPSE2_CONCORDANCE' {
Expand All @@ -85,5 +87,6 @@ process {
withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:VCF_CONCORDANCE_GLIMPSE2:GAWK' {
ext.args = "'(NR == 1) || (FNR > 1)'" // Skip header line
ext.suffix = { "txt" }
tag = {"Test Quality"}
}
}
2 changes: 1 addition & 1 deletion conf/test_quilt.config
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ params {

// External params
chunks = "${projectDir}/tests/csv/chunks.csv"
panel = "${projectDir}/tests/csv/panel_2.csv"
posfile = "${projectDir}/tests/csv/posfile.csv"

// Impute tools
tools = "quilt"
Expand Down
Loading

0 comments on commit 150cb9e

Please sign in to comment.