Skip to content

Commit

Permalink
Add in evaluation config section with correction_method and alpha par…
Browse files Browse the repository at this point in the history
…ameters
  • Loading branch information
meyerkm committed May 28, 2024
1 parent 43fc84f commit f56b90a
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 31 deletions.
19 changes: 12 additions & 7 deletions deeprvat/deeprvat/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def create_main_config(
"training",
"n_repeats",
"y_transformation",
"evaluation",
"cv_exp",
"cv_path",
"n_folds",
Expand Down Expand Up @@ -96,7 +97,7 @@ def create_main_config(
if input_config["use_pretrained_models"]:
no_pretrain = False
logger.info("Pretrained Model setup specified.")
to_remove = {"training", "phenotypes_for_training"}
to_remove = {"training", "phenotypes_for_training", "seed_gene_results"}
expected_input_keys = [
item for item in expected_input_keys if item not in to_remove
]
Expand Down Expand Up @@ -200,11 +201,10 @@ def create_main_config(
full_config["assocation_testing_data"]["dataset_config"]["rare_embedding"][
"config"
]["thresholds"][k] = f"{k} {v}"
# Baseline results
full_config["baseline_results"]["options"] = input_config["seed_gene_results"][
"options"
]
full_config["alpha"] = input_config["seed_gene_results"]["alpha"]
# Results evaluation parameters; alpha parameter for significance threshold
full_config["evaluation"] = {}
full_config["evaluation"]["correction_method"] = input_config["evaluation"]["correction_method"]
full_config["evaluation"]["alpha"] = input_config["evaluation"]["alpha"]
# DeepRVAT model
full_config["n_repeats"] = input_config["n_repeats"]

Expand All @@ -218,6 +218,11 @@ def create_main_config(
full_config["training"]["early_stopping"] = input_config["training"]["early_stopping"]
# Training Phenotypes
full_config["training"]["phenotypes"] = input_config["phenotypes_for_training"]
# Baseline results
full_config["baseline_results"]["options"] = input_config["seed_gene_results"][
"options"
]
full_config["baseline_results"]["alpha_seed_genes"] = input_config["seed_gene_results"]["alpha_seed_genes"]
else:
full_config["model"] = input_config["model"]

Expand Down Expand Up @@ -319,7 +324,7 @@ def update_config(
else:
logger.info("Not performing EAC filtering of baseline results")
logger.info(f" Correcting p-values using {correction_method} method")
alpha = config.get("alpha_seed_genes", config.get("alpha"))
alpha = config["baseline_results"].get("alpha_seed_genes", config.get("alpha"))
baseline_df = pval_correction(
baseline_df, alpha, correction_type=correction_method
)
Expand Down
5 changes: 2 additions & 3 deletions deeprvat/deeprvat/evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,6 @@ def evaluate_(
@click.option("--debug", is_flag=True)
@click.option("--phenotype", type=str)
@click.option("--use-baseline-results", is_flag=True)
@click.option("--correction-method", type=str, default="Bonferroni")
@click.option(
"--combine-pval", type=str, default="Bonferroni"
) # Bonferroni min pval per gene for multiple baseline tests
Expand All @@ -341,7 +340,6 @@ def evaluate(
debug: bool,
phenotype: Optional[str],
use_baseline_results: bool,
correction_method: str,
association_files: Tuple[str],
config_file: str,
out_dir: str,
Expand All @@ -361,7 +359,8 @@ def evaluate(
)
associations["phenotype"] = pheno

alpha = config["alpha"]
alpha = config["evaluation"]["alpha"]
correction_method = config["evaluation"]["correction_method"]

if use_baseline_results:
logger.info("Reading baseline results")
Expand Down
7 changes: 6 additions & 1 deletion example/config/deeprvat_input_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ seed_gene_results: #baseline_results
base: baseline_results
type: missense/skat

alpha: 0.05
alpha_seed_genes: 0.05

#DeepRVAT training settings
training:
Expand All @@ -144,6 +144,11 @@ training:
n_repeats: 6
y_transformation: quantile_transform

# Results evaluation settings
evaluation:
correction_method: Bonferroni
alpha: 0.05

#Additional settings if using the CV pipeline
cv_exp: False
#cv_path: sample_files
Expand Down
23 changes: 5 additions & 18 deletions example/config/deeprvat_input_pretrained_models_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,28 +61,15 @@ association_testing_data_thresholds:
MAF: "< 1e-3"
CADD_PHRED: "> 5"

#Seed Gene Baseline data settings
seed_gene_results: #baseline_results
options:
-
base: baseline_results
type: plof/burden
-
base: baseline_results
type: missense/burden
-
base: baseline_results
type: plof/skat
-
base: baseline_results
type: missense/skat

alpha: 0.05

#DeepRVAT model settings
n_repeats: 30
y_transformation: quantile_transform

# Results evaluation settings
evaluation:
correction_method: Bonferroni
alpha: 0.05

#Additional settings if using the CV pipeline
cv_exp: False
#cv_path: sample_files
Expand Down
1 change: 0 additions & 1 deletion pipelines/association_testing/regress_eval.snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ rule evaluate:
'deeprvat_evaluate '
+ debug +
'{params.use_baseline_results} '
'--correction-method Bonferroni '
'--phenotype {wildcards.phenotype} '
'{input.associations} '
'{input.config} '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ rule evaluate:
'deeprvat_evaluate '
+ debug +
'{params.use_baseline_results} '
'--correction-method Bonferroni '
'--phenotype {wildcards.phenotype} '
'{input.associations} '
'{input.config} '
Expand Down

0 comments on commit f56b90a

Please sign in to comment.