Skip to content

Commit

Permalink
refactor: remove FinnGenStepConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
tskir committed Oct 25, 2023
1 parent 5298e14 commit 2813fec
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 31 deletions.
5 changes: 1 addition & 4 deletions config/step/my_finngen.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# Default config
defaults:
- finngen
# Additional config
_target_: otg.finngen.FinnGenStep
finngen_phenotype_table_url: ${datasets.finngen_phenotype_table_url}
finngen_release_prefix: ${datasets.finngen_release_prefix}
finngen_sumstat_url_prefix: ${datasets.finngen_sumstat_url_prefix}
Expand Down
1 change: 0 additions & 1 deletion docs/python_api/step/finngen.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# FinnGen

::: otg.finngen.FinnGenStep
::: otg.config.FinnGenStepConfig
1 change: 1 addition & 0 deletions src/otg/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def main(cfg: Config) -> None:
print(OmegaConf.to_yaml(cfg))
# Instantiate ETL session
session = instantiate(cfg.session)

# Initialise and run step
step = instantiate(cfg.step, session=session)
step.run()
Expand Down
23 changes: 0 additions & 23 deletions src/otg/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,28 +257,6 @@ class GWASCatalogSumstatsPreprocessConfig:
study_id: str = MISSING


@dataclass
class FinnGenStepConfig:
"""FinnGen study table ingestion step requirements.
Attributes:
finngen_phenotype_table_url (str): FinnGen API for fetching the list of studies.
finngen_release_prefix (str): Release prefix pattern.
finngen_sumstat_url_prefix (str): URL prefix for summary statistics location.
finngen_sumstat_url_suffix (str): URL prefix suffix for summary statistics location.
finngen_study_index_out (str): Output path for the FinnGen study index dataset.
finngen_summary_stats_out (str): Output path for the FinnGen summary statistics.
"""

_target_: str = "otg.finngen.FinnGenStep"
finngen_phenotype_table_url: str = MISSING
finngen_release_prefix: str = MISSING
finngen_sumstat_url_prefix: str = MISSING
finngen_sumstat_url_suffix: str = MISSING
finngen_study_index_out: str = MISSING
finngen_summary_stats_out: str = MISSING


@dataclass
class UKBiobankStepConfig:
"""UKBiobank study table ingestion step requirements.
Expand Down Expand Up @@ -306,7 +284,6 @@ def register_configs() -> None:
cs.store(name="v2g", group="step", node=V2GStepConfig)
cs.store(name="colocalisation", group="step", node=ColocalisationStepConfig)
cs.store(name="gwas_catalog", group="step", node=GWASCatalogStepConfig)
cs.store(name="finngen", group="step", node=FinnGenStepConfig)
cs.store(name="ukbiobank", group="step", node=UKBiobankStepConfig)
cs.store(
name="gwas_catalog_sumstats_preprocess",
Expand Down
21 changes: 18 additions & 3 deletions src/otg/finngen.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,29 @@
from urllib.request import urlopen

from otg.common.session import Session
from otg.config import FinnGenStepConfig
from otg.datasource.finngen.study_index import FinnGenStudyIndex
from otg.datasource.finngen.summary_stats import FinnGenSummaryStats


@dataclass
class FinnGenStep(FinnGenStepConfig):
"""FinnGen ingestion step."""
class FinnGenStep:
"""FinnGen study table ingestion step requirements.
Attributes:
finngen_phenotype_table_url (str): FinnGen API for fetching the list of studies.
finngen_release_prefix (str): Release prefix pattern.
finngen_sumstat_url_prefix (str): URL prefix for summary statistics location.
finngen_sumstat_url_suffix (str): URL prefix suffix for summary statistics location.
finngen_study_index_out (str): Output path for the FinnGen study index dataset.
finngen_summary_stats_out (str): Output path for the FinnGen summary statistics.
"""

finngen_phenotype_table_url: str
finngen_release_prefix: str
finngen_sumstat_url_prefix: str
finngen_sumstat_url_suffix: str
finngen_study_index_out: str
finngen_summary_stats_out: str

session: Session = Session()

Expand Down

0 comments on commit 2813fec

Please sign in to comment.