From dcafd007941e97196237126c918157fc4a6eca47 Mon Sep 17 00:00:00 2001 From: Andrew Weisman Date: Wed, 14 Aug 2024 13:35:56 -0400 Subject: [PATCH 1/3] Remove importing of parc --- pages2/Pheno_Cluster_b.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages2/Pheno_Cluster_b.py b/pages2/Pheno_Cluster_b.py index c76c40c..51639c8 100644 --- a/pages2/Pheno_Cluster_b.py +++ b/pages2/Pheno_Cluster_b.py @@ -12,7 +12,7 @@ import os import matplotlib.pyplot as plt import phenograph -import parc +#import parc import numpy as np import scanpy.external as sce import plotly.express as px From 7fdc2bf8f4bccd5354d8a1dc332ac09bdeddc524 Mon Sep 17 00:00:00 2001 From: Andrew Weisman Date: Fri, 23 Aug 2024 14:15:58 -0400 Subject: [PATCH 2/3] In null row detection in the unifier, display only the rows with null values; also, if basic_phenotyper_lib.init_pheno_cols() null rows are found, delete them automatically and render a warning to the user --- basic_phenotyper_lib.py | 23 +++++++++++++++++++++++ pages2/datafile_format_unifier.py | 4 ++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/basic_phenotyper_lib.py b/basic_phenotyper_lib.py index 483fec3..d828328 100644 --- a/basic_phenotyper_lib.py +++ b/basic_phenotyper_lib.py @@ -77,6 +77,29 @@ def init_pheno_cols(df, marker_names, marker_col_prefix): # This was previously really slow. Code basically taken from new_phenotyping_lib.py marker_cols_first_row = df_markers.iloc[0, :].to_list() # get just the first row of marker values if (0 not in marker_cols_first_row) and (1 not in marker_cols_first_row): + + # Null values in df_markers will break the .map() step so check for and remove them here + ser_num_of_null_rows_in_each_column = df_markers.isnull().sum() + if ser_num_of_null_rows_in_each_column.sum() != 0: + + # For the time being, import Streamlit so warnings can be rendered. Otherwise, this file does not import streamlit and it should remain that way but this is a minimal fix for the time being + import streamlit as st + + st.warning('Null values have been detected in the phenotype columns. Next time, please check for and remove null rows in the datafile unification step (File Handling > Datafile Unification). We are removing them for you now. Here are the numbers of null rows found in each column containing them:') + ser_num_of_null_rows_in_each_column.name = 'Number of null rows' + st.write(ser_num_of_null_rows_in_each_column[ser_num_of_null_rows_in_each_column != 0]) + + # Perform the operation + row_count_before = len(df) + df = df.dropna(subset=marker_cols) + row_count_after = len(df) + + # Display a success message + st.write(f'{row_count_before - row_count_after} rows deleted') + + # Update df_markers + df_markers = df[marker_cols] + df_markers = df_markers.map(lambda x: {'+': '1', '-': '0'}[x[-1]]) df['mark_bits'] = df_markers.astype(str).apply(''.join, axis='columns') # efficiently create a series of strings that are the columns (in string format) concatenated together diff --git a/pages2/datafile_format_unifier.py b/pages2/datafile_format_unifier.py index ca6ef79..028dee0 100644 --- a/pages2/datafile_format_unifier.py +++ b/pages2/datafile_format_unifier.py @@ -229,9 +229,9 @@ def main(): if ser_num_of_null_rows_in_each_column.sum() == 0: st.success('No null rows detected in the dataset.') else: - st.write('Null values have been detected. Here are the numbers of null rows found in each column. Note they may not matter depending on the column:') + st.write('Null values have been detected. Here are the numbers of null rows found in the columns containing them. Note they may not matter depending on the column:') ser_num_of_null_rows_in_each_column.name = 'Number of null rows' - st.write(ser_num_of_null_rows_in_each_column) + st.write(ser_num_of_null_rows_in_each_column[ser_num_of_null_rows_in_each_column != 0]) # Create an expander for the null row deletion section with st.expander('Click to expand:', expanded=False): From 93ec13f2e932e10539547664ff1ce7006bc4cc52 Mon Sep 17 00:00:00 2001 From: Andrew Weisman Date: Fri, 23 Aug 2024 14:17:13 -0400 Subject: [PATCH 3/3] Remove execution property (I believe) from app_images/logo2c.png --- app_images/logo2c.png | Bin 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 app_images/logo2c.png diff --git a/app_images/logo2c.png b/app_images/logo2c.png old mode 100755 new mode 100644