Skip to content

Commit

Permalink
Update heatcluster.py
Browse files Browse the repository at this point in the history
Examining unsorted df
  • Loading branch information
DrB-S authored Feb 1, 2024
1 parent f24fa61 commit 80c73a0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions heatcluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def clean_and_read_df(df):
"""
Convert column names to strings
"""
#df.columns = df.columns.map(str) #df.columns.map doesn't work in Polars, so see it line 112 will work without it
#df.columns = df.columns.map(str) #df.columns.map doesn't work in Polars, so see if line 112 will work without it

"""
Define consensus patterns
Expand Down Expand Up @@ -158,8 +158,10 @@ def determine_heatmap_size(df, SNPmatrix):
"""
Sort dataframe and remove empty rows/columns
"""
logging.debug(f'The unsorted dataframe: {df}')
logging.debug('Sorting dataframe and removing empty rows/columns')
df = df.loc[df.sum(axis=1).sort_values(ascending=True).index]
#df = df.loc[df.sum(axis=1).sort_values(ascending=True).index]

df.replace([np.inf, -np.inf], np.nan)
df.dropna()

Expand Down

0 comments on commit 80c73a0

Please sign in to comment.