Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

54 write error when no results found for a omim id not present in the phenotypehpoa #55

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "phenotype2phenopacket"
version = "0.6.11"
version = "0.6.12"
description = ""
authors = ["Yasemin Bridges <[email protected]>"]
readme = "README.md"
Expand Down
10 changes: 9 additions & 1 deletion src/phenotype2phenopacket/create/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from phenotype2phenopacket.utils.utils import (
filter_diseases,
load_ontology,
read_omim_id_list,
return_phenotype_annotation_data,
)

Expand Down Expand Up @@ -74,7 +75,14 @@ def create_synthetic_patients(
grouped_omim_diseases = filter_diseases(
num_disease, omim_id, omim_id_list, phenotype_annotation_data
)
for omim_disease in grouped_omim_diseases:
omim_ids = (
read_omim_id_list(omim_id_list) if omim_id_list else [None] * len(grouped_omim_diseases)
)
for omim_id, omim_disease in zip(omim_ids, grouped_omim_diseases):
if len(omim_disease) == 0:
id_message = f" for {omim_id}!" if omim_id else "!"
print(f"Skipping... Could not find any phenotype entries{id_message}")
continue
create_synthetic_patient_phenopacket(
human_phenotype_ontology,
omim_disease,
Expand Down
6 changes: 3 additions & 3 deletions src/phenotype2phenopacket/utils/phenopacket_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,9 +366,9 @@ def worker():
if len(self.filtered_df) == 0:
return frequency_df.sample(n=max_number)
else:
return pl.from_dicts(self.filtered_df)
return pl.from_dicts(self.filtered_df, infer_schema_length=len(self.filtered_df))
else:
return pl.from_dicts(self.filtered_df)
return pl.from_dicts(self.filtered_df, infer_schema_length=len(self.filtered_df))

def get_patient_terms(self) -> pl.DataFrame:
"""
Expand Down Expand Up @@ -570,7 +570,7 @@ def patient_term_annotation_set(self) -> pl.DataFrame:
patient_terms, patient_terms_sub_sample
)
final_patient_terms = patient_terms_filtered.to_dicts() + new_phenotype_terms
return pl.from_dicts(final_patient_terms)
return pl.from_dicts(final_patient_terms, infer_schema_length=len(final_patient_terms))


class PhenotypeAnnotationToPhenopacketConverter:
Expand Down
Loading