Skip to content

Commit

Permalink
fix on l2g step mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
xyg123 committed Dec 17, 2024
1 parent 0eea3aa commit 8140d5a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 19 deletions.
25 changes: 9 additions & 16 deletions src/gentropy/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ class SessionConfig:
write_mode: str = "errorifexists"
spark_uri: str = "local[*]"
hail_home: str = os.path.dirname(hail_location)
extended_spark_conf: dict[str, str] | None = field(
default_factory=dict[str, str])
extended_spark_conf: dict[str, str] | None = field(default_factory=dict[str, str])
output_partitions: int = 200
_target_: str = "gentropy.common.session.Session"

Expand All @@ -40,8 +39,7 @@ class ColocalisationConfig(StepConfig):
credible_set_path: str = MISSING
coloc_path: str = MISSING
colocalisation_method: str = MISSING
colocalisation_method_params: dict[str, Any] = field(
default_factory=dict[str, Any])
colocalisation_method_params: dict[str, Any] = field(default_factory=dict[str, Any])
_target_: str = "gentropy.colocalisation.ColocalisationStep"


Expand Down Expand Up @@ -126,8 +124,7 @@ class EqtlCatalogueConfig(StepConfig):
eqtl_catalogue_paths_imported: str = MISSING
eqtl_catalogue_study_index_out: str = MISSING
eqtl_catalogue_credible_sets_out: str = MISSING
mqtl_quantification_methods_blacklist: list[str] = field(
default_factory=lambda: [])
mqtl_quantification_methods_blacklist: list[str] = field(default_factory=lambda: [])
eqtl_lead_pvalue_threshold: float = 1e-3
_target_: str = "gentropy.eqtl_catalogue.EqtlCatalogueStep"

Expand Down Expand Up @@ -313,6 +310,7 @@ class LocusToGeneFeatureMatrixConfig(StepConfig):
colocalisation_path: str | None = None
study_index_path: str | None = None
gene_index_path: str | None = None
interval_path: str | None = None
feature_matrix_path: str = MISSING
features_list: list[str] = field(
default_factory=lambda: [
Expand Down Expand Up @@ -688,8 +686,7 @@ class Config:
"""Application configuration."""

# this is unfortunately verbose due to @dataclass limitations
defaults: List[Any] = field(default_factory=lambda: [
"_self_", {"step": MISSING}])
defaults: List[Any] = field(default_factory=lambda: ["_self_", {"step": MISSING}])
step: StepConfig = MISSING
datasets: dict[str, str] = field(default_factory=dict)

Expand Down Expand Up @@ -723,8 +720,7 @@ def register_config() -> None:
name="gwas_catalog_top_hit_ingestion",
node=GWASCatalogTopHitIngestionConfig,
)
cs.store(group="step", name="ld_based_clumping",
node=LDBasedClumpingConfig)
cs.store(group="step", name="ld_based_clumping", node=LDBasedClumpingConfig)
cs.store(group="step", name="ld_index", node=LDIndexConfig)
cs.store(group="step", name="locus_to_gene", node=LocusToGeneConfig)
cs.store(
Expand All @@ -742,8 +738,7 @@ def register_config() -> None:

cs.store(group="step", name="pics", node=PICSConfig)
cs.store(group="step", name="gnomad_variants", node=GnomadVariantConfig)
cs.store(group="step", name="ukb_ppp_eur_sumstat_preprocess",
node=UkbPppEurConfig)
cs.store(group="step", name="ukb_ppp_eur_sumstat_preprocess", node=UkbPppEurConfig)
cs.store(group="step", name="variant_index", node=VariantIndexConfig)
cs.store(group="step", name="variant_to_vcf", node=ConvertToVcfStepConfig)
cs.store(
Expand Down Expand Up @@ -776,7 +771,5 @@ def register_config() -> None:
name="locus_to_gene_associations",
node=LocusToGeneAssociationsStepConfig,
)
cs.store(group="step", name="finngen_ukb_meta_ingestion",
node=FinngenUkbMetaConfig)
cs.store(group="step", name="credible_set_qc",
node=CredibleSetQCStepConfig)
cs.store(group="step", name="finngen_ukb_meta_ingestion", node=FinngenUkbMetaConfig)
cs.store(group="step", name="credible_set_qc", node=CredibleSetQCStepConfig)
6 changes: 3 additions & 3 deletions src/gentropy/l2g.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def __init__(
variant_index_path (str | None): Path to the variant index
gene_interactions_path (str | None): Path to the gene interactions dataset
gene_index_path (str | None = None): Path to the gene index
interval_path (dict[str, str] | None) : Path and source of interval input datasets
interval_path (str | None = None) : Path and source of interval input datasets
predictions_path (str | None): Path to the L2G predictions output dataset
l2g_threshold (float | None): An optional threshold for the L2G score to filter predictions. A threshold of 0.05 is recommended.
hf_hub_repo_id (str | None): Hugging Face Hub repository ID. If provided, the model will be uploaded to Hugging Face.
Expand Down Expand Up @@ -181,8 +181,8 @@ def __init__(
if gene_index_path
else None
)
self.intervals = Intervals.from_parquet(
session, interval_path, recursiveFileLookup=True
self.intervals = (
Intervals.from_parquet(session, interval_path) if interval_path else None
)

if run_mode == "predict":
Expand Down

0 comments on commit 8140d5a

Please sign in to comment.