Skip to content

Commit

Permalink
refactor(finngen): remove finngen_studies_json from finngen.study_index
Browse files Browse the repository at this point in the history
  • Loading branch information
ireneisdoomed committed Dec 12, 2023
1 parent 90f5d92 commit 00297f2
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/otg/datasource/finngen/study_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,16 @@ class FinnGenStudyIndex(StudyIndex):
def from_source(
cls: type[FinnGenStudyIndex],
spark: SparkSession,
finngen_studies_json: str = "",
) -> FinnGenStudyIndex:
"""This function ingests study level metadata from FinnGen.
Args:
spark (SparkSession): Spark session object.
finngen_studies_json (str): Path to the FinnGen study index JSON file.
Returns:
FinnGenStudyIndex: Parsed and annotated FinnGen study table.
"""
if finngen_studies_json != "":
with open(finngen_studies_json) as finngen_studies:
json_data = finngen_studies.read()
else:
json_data = urlopen(cls.finngen_phenotype_table_url).read().decode("utf-8")
json_data = urlopen(cls.finngen_phenotype_table_url).read().decode("utf-8")
rdd = spark.sparkContext.parallelize([json_data])
raw_df = spark.read.json(rdd)
return FinnGenStudyIndex(
Expand Down

0 comments on commit 00297f2

Please sign in to comment.