Skip to content

Commit

Permalink
make get_heatmap less prone to mess up transposing
Browse files Browse the repository at this point in the history
  • Loading branch information
Bribak committed Jun 12, 2024
1 parent 754d543 commit c68fcd2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build/lib/glycowork/motif/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def get_heatmap(df, motifs = False, feature_set = ['known'], transform = '',
df = df.set_index(index_col)
elif isinstance(df.iloc[0,0], str):
df = df.set_index(df.columns.tolist()[0])
if not isinstance(df.index.tolist()[0], str) or (isinstance(df.index.tolist()[0], str) and '(' not in df.index.tolist()[0] and '-' not in df.index.tolist()[0]):
if not isinstance(df.index[0], str) or (isinstance(df.index[0], str) and ('(' not in df.index[0] or '-' not in df.index[0])):
df = df.T
df = df.fillna(0)
if transform == "CLR":
Expand Down
2 changes: 1 addition & 1 deletion glycowork/motif/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def get_heatmap(df, motifs = False, feature_set = ['known'], transform = '',
df = df.set_index(index_col)
elif isinstance(df.iloc[0,0], str):
df = df.set_index(df.columns.tolist()[0])
if not isinstance(df.index.tolist()[0], str) or (isinstance(df.index.tolist()[0], str) and '(' not in df.index.tolist()[0] and '-' not in df.index.tolist()[0]):
if not isinstance(df.index[0], str) or (isinstance(df.index[0], str) and ('(' not in df.index[0] or '-' not in df.index[0])):
df = df.T
df = df.fillna(0)
if transform == "CLR":
Expand Down

0 comments on commit c68fcd2

Please sign in to comment.