From 3c0d3f1a6f7565bacfa599f89c828ad011738986 Mon Sep 17 00:00:00 2001 From: EshaniHS Date: Thu, 22 Aug 2024 21:08:28 -0400 Subject: [PATCH 1/3] Changes in app code 1. Add openpyxl in requirements.txt 2. Add list of subject ID --- genomics-apps/mendelianScreening.py | 3 ++- genomics-apps/requirements.txt | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/genomics-apps/mendelianScreening.py b/genomics-apps/mendelianScreening.py index dc5a215b..0bd905bf 100644 --- a/genomics-apps/mendelianScreening.py +++ b/genomics-apps/mendelianScreening.py @@ -594,7 +594,8 @@ def decorate_conditions(condition_df, df_final, selected_genes): # Streamlit sidebar for user inputs st.sidebar.title("Genetic Variant Information") -subject = st.sidebar.text_input("Enter Subject ID") +subject_ids = ['HG00403', 'HG00406', 'HG02657', 'NA18498', 'NA18499', 'NA18871', 'NA19210', 'NA19247', 'NB6TK329'] +subject = st.sidebar.multiselect("Enter Subject ID", subject_ids, default=None) genes = list(gene_ranges.keys()) selected_genes = st.sidebar.multiselect("Select Genes", genes, default=None) diff --git a/genomics-apps/requirements.txt b/genomics-apps/requirements.txt index 4d9a6556..105214fc 100644 --- a/genomics-apps/requirements.txt +++ b/genomics-apps/requirements.txt @@ -3,3 +3,4 @@ pyliftover==0.4 requests==2.32.0 streamlit==1.34.0 streamlit-aggrid==1.0.5 +openpyxl==3.1.5 From ed9b9af67b78fd551134c3d6898127bc4b73679c Mon Sep 17 00:00:00 2001 From: EshaniHS Date: Thu, 22 Aug 2024 21:37:40 -0400 Subject: [PATCH 2/3] Update subject ID list 1. Iterate over single subject ID from the list provided. --- genomics-apps/mendelianScreening.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/genomics-apps/mendelianScreening.py b/genomics-apps/mendelianScreening.py index 0bd905bf..9eeae849 100644 --- a/genomics-apps/mendelianScreening.py +++ b/genomics-apps/mendelianScreening.py @@ -595,7 +595,13 @@ def decorate_conditions(condition_df, df_final, selected_genes): # Streamlit sidebar for user inputs st.sidebar.title("Genetic Variant Information") subject_ids = ['HG00403', 'HG00406', 'HG02657', 'NA18498', 'NA18499', 'NA18871', 'NA19210', 'NA19247', 'NB6TK329'] -subject = st.sidebar.multiselect("Enter Subject ID", subject_ids, default=None) +selected_subjects = st.sidebar.multiselect("Enter Subject ID", subject_ids, default=None) + +# Check if exactly one subject is selected +if len(selected_subjects) == 1: + subject = selected_subjects[0] +elif len(selected_subjects) > 1: + st.warning("Please select only one Subject ID.") genes = list(gene_ranges.keys()) selected_genes = st.sidebar.multiselect("Select Genes", genes, default=None) @@ -781,7 +787,7 @@ def decorate_conditions(condition_df, df_final, selected_genes): st.warning("Please enter both Subject ID \ and select at least one Gene.") else: - st.write("Please enter a Subject ID, select Genes, \ + st.write("Please select a Subject ID, select Genes, \ and click 'Run' in the sidebar to start the analysis.") st.markdown("---") From d538656b6d9297c9189d4062b45f592361aad966 Mon Sep 17 00:00:00 2001 From: EshaniHS Date: Tue, 3 Sep 2024 14:40:53 -0400 Subject: [PATCH 3/3] Updates in mendelian screening app 1. Added @st.cache_data before functions --- genomics-apps/mendelianScreening.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/genomics-apps/mendelianScreening.py b/genomics-apps/mendelianScreening.py index 9eeae849..b315733a 100644 --- a/genomics-apps/mendelianScreening.py +++ b/genomics-apps/mendelianScreening.py @@ -180,6 +180,7 @@ # Retrieve patient information +@st.cache_data def fetch_patient_info(subject): url = f"https://api.logicahealth.org/MTB/open/Patient?identifier={subject}" response = requests.get(url) @@ -219,6 +220,7 @@ def fetch_patient_info(subject): # Retrieve patient conditions +@st.cache_data def fetch_condition(patient_id): url = f"https://api.logicahealth.org/MTB/open/Condition?patient={patient_id}" response = requests.get(url) @@ -246,6 +248,7 @@ def fetch_condition(patient_id): # Retrieve medications +@st.cache_data def fetch_medication(patient_id): url = f"https://api.logicahealth.org/MTB/open/MedicationRequest?patient={patient_id}" response = requests.get(url) @@ -269,6 +272,7 @@ def fetch_medication(patient_id): # Retrieve patient allergies +@st.cache_data def fetch_allergy(patient_id): url = f"https://api.logicahealth.org/MTB/open/AllergyIntolerance?patient={patient_id}" response = requests.get(url) @@ -291,6 +295,7 @@ def fetch_allergy(patient_id): # Retrieve variant information +@st.cache_data def fetch_variants(subject, gene): url = ("https://fhir-gen-ops.herokuapp.com/subject-operations/genotype-operations/$find-subject-variants?" f"subject={subject}&ranges={gene_ranges[gene]['range']}&includeVariants=true&includePhasing=true") @@ -332,6 +337,7 @@ def fetch_variants(subject, gene): # Retrieve molecular consequences +@st.cache_data def fetch_molecular_consequences(subject, gene): url = f"https://fhir-gen-ops.herokuapp.com/subject-operations/phenotype-operations/$find-subject-molecular-consequences?subject={subject}&ranges={gene_ranges[gene]['range']}" @@ -406,6 +412,7 @@ def fetch_molecular_consequences(subject, gene): # Define function to get level of evidence +@st.cache_data def get_level_of_evidence(components): evidence_dict = { "practice guideline": 4, @@ -428,6 +435,7 @@ def get_level_of_evidence(components): # Retrieve pathogenicity based on clinical significance and review status +@st.cache_data def fetch_clinical_significance(subject, gene): url = f"https://fhir-gen-ops.herokuapp.com/subject-operations/phenotype-operations/$find-subject-dx-implications?subject={subject}&ranges={gene_ranges[gene]['range']}" @@ -533,6 +541,7 @@ def fetch_clinical_significance(subject, gene): # Decorating conditions based on pathogenic variants +@st.cache_data def decorate_conditions(condition_df, df_final, selected_genes): # Reading the Excel file valueset_df = pd.read_excel(r"genomics-apps/data/conditions.xlsx")