Skip to content

Commit

Permalink
Merge branch 'ui-v2' of github.com:IGS/gEAR into ui-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
jorvis committed Sep 9, 2024
2 parents db70fb9 + d1f7324 commit f8503f8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
1 change: 1 addition & 0 deletions www/api/resources/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import sys
import anndata
import pandas as pd

from pathlib import Path

Expand Down
18 changes: 10 additions & 8 deletions www/api/resources/plotly_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,19 +215,21 @@ def post(self, dataset_id):
if adata.isbacked:
adata.file.close()

# Rename the single selected.var index label to "raw_value"
# This resolves https://github.com/IGS/gEAR/issues/878 where the gene_symbol index may be the same as a observation column (i.e. projections)
selected.var.index = pd.Index(["raw_value"])

df = selected.to_df()

success = 1
message = ""
if len(df.columns) > 1:

# If there are multiple rows with the same gene symbol, we will only use the first one
# But throw a warning message
if len(selected.var) > 1:
success = 2
message = "WARNING: Multiple Ensemble IDs found for gene symbol '{}'. Using the first stored Ensembl ID.".format(gene_symbol)
df = df.iloc[:,[0]] # Note, put the '0' in a list to return a DataFrame. Not having in list returns DataSeries instead
selected = selected[:, 0]

# Rename the single selected.var index label to "raw_value"
# This resolves https://github.com/IGS/gEAR/issues/878 where the gene_symbol index may be the same as a observation column (i.e. projections)
selected.var.index = pd.Index(["raw_value"])

df = selected.to_df()
df = pd.concat([df,selected.obs], axis=1)

# Valid analysis column names from api/resources/h5ad.py
Expand Down

0 comments on commit f8503f8

Please sign in to comment.