Skip to content

Commit

Permalink
Resolving #878 by renaming gene symbol earlier in the flow
Browse files Browse the repository at this point in the history
  • Loading branch information
adkinsrs committed Aug 27, 2024
1 parent fdece0e commit f65b9ce
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 0 additions & 4 deletions lib/gear/plotting.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
# Purely kept so we can debug with sys.stderr
from itertools import cycle

import pandas as pd

import plotly.express as px
import plotly.graph_objects as go
from matplotlib.pyplot import plot
from plotly import exceptions
from plotly.colors import unlabel_rgb
from plotly.subplots import make_subplots
Expand Down
7 changes: 5 additions & 2 deletions www/api/resources/plotly_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@ 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
Expand All @@ -224,8 +228,7 @@ def post(self, dataset_id):
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

df2 = pd.concat([df,selected.obs], axis=1)
df = df2.rename(columns={df.columns[0]: "raw_value"})
df = pd.concat([df,selected.obs], axis=1)

# Valid analysis column names from api/resources/h5ad.py
analysis_tsne_columns = ['X_tsne_1', 'X_tsne_2']
Expand Down

0 comments on commit f65b9ce

Please sign in to comment.