Skip to content

Commit

Permalink
Integration of VCF and BGEN for gene-based testing (#92)
Browse files Browse the repository at this point in the history
* Added plink division on gene level test step

* Integrate support for VCF for gene-level test

* Adding control for chunking when call gene level test

* Update tests for bgen files

* Add gene-based bgen test

* Clean up unuseful comments

* Add gene-based module test

---------
Co-authored-by: johsr <[email protected]>
Co-authored-by: Lukas Forer <[email protected]>
Co-authored-by: seppinho <[email protected]>
  • Loading branch information
filosi authored Dec 15, 2023
1 parent 72bfd26 commit 04d684e
Show file tree
Hide file tree
Showing 19 changed files with 1,674 additions and 10 deletions.
9 changes: 7 additions & 2 deletions lib/WorkflowMain.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,14 @@ class WorkflowMain {
exit 1, "Invalid config file. The 'write-mask' option does not work when building masks with 'sum'."
}

if(params.genotypes_association_chunk_size > 0 ) {
//&& genotypes_association_format != 'bgen' ) {
exit 1, " Chunking is currently not available for gene-based tests (param: genotypes_association_chunk_size=0)."
}

//Check association file format for gene-based tests
if (genotypes_association_format != 'bed'){
exit 1, "File format " + genotypes_association_format + " currently not supported for gene-based tests. Please use 'bed' input instead. "
if (genotypes_association_format != 'vcf' && genotypes_association_format != "bgen"){
exit 1, "File format " + genotypes_association_format + " currently not supported for gene-based tests. Please use 'vcf' or 'bgen' input instead. "
}
} else {
//Check if tests exists
Expand Down
7 changes: 5 additions & 2 deletions modules/local/regenie/regenie_step2_run_gene_tests.nf
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ process REGENIE_STEP2_RUN_GENE_TESTS {

input:
path step1_out
tuple val(filename), path(genotyped_plink_file)
tuple val(filename), path(genotyped_plink_bim_file), path(genotyped_plink_bed_file), path(genotyped_plink_fam_file), val(range)
val assoc_format
path phenotypes_file
path covariates_file
path sample_file
path regenie_gene_anno_file
path regenie_gene_setlist_file
path regenie_gene_masks_file
Expand All @@ -20,8 +21,9 @@ process REGENIE_STEP2_RUN_GENE_TESTS {
path "${filename}_masks*"

script:
def format = assoc_format == 'bed' ? "--bed" : '--bgen'
def format = assoc_format == 'bgen' ? "--bgen" : '--pgen'
def extension = assoc_format == 'bgen' ? ".bgen" : ''
def bgen_sample = sample_file ? "--sample $sample_file" : ''
def firthApprox = params.regenie_firth_approx ? "--approx" : ""
def firth = params.regenie_firth ? "--firth $firthApprox" : ""
def binaryTrait = params.phenotypes_binary_trait ? "--bt $firth " : ""
Expand Down Expand Up @@ -65,6 +67,7 @@ process REGENIE_STEP2_RUN_GENE_TESTS {
$predictions \
$apply_rint \
$geneTest \
$bgen_sample \
$aaf \
$maxAaf \
$vcMACThr \
Expand Down
Loading

0 comments on commit 04d684e

Please sign in to comment.