Spaces:
Sleeping
Sleeping
fix gene_product <= gene_name
Browse files
app.py
CHANGED
|
@@ -117,22 +117,22 @@ gene_ids = seed_gene_ids + neighbor_gene_ids
|
|
| 117 |
gene_types = ['seed'] * len(seed_gene_ids) + ['neighbor'] * len(neighbor_gene_ids)
|
| 118 |
|
| 119 |
cnag_ids = []
|
| 120 |
-
|
| 121 |
descriptions = []
|
| 122 |
|
| 123 |
for gene_id in gene_ids:
|
| 124 |
try:
|
| 125 |
cnag_id = h99_transcript_annotations.loc[h99_transcript_annotations["gene_id"] == gene_id]["cnag_id"].values[0]
|
| 126 |
-
|
| 127 |
description = h99_transcript_annotations.loc[h99_transcript_annotations["gene_id"] == gene_id]["description"].values[0]
|
| 128 |
except:
|
| 129 |
-
st.error(f"Unable to locate cnag_id for Gene ID: '{gene_id}', it should be of the form 'cnag_
|
| 130 |
cnag_id = None
|
| 131 |
-
|
| 132 |
description = None
|
| 133 |
|
| 134 |
cnag_ids.append(cnag_id)
|
| 135 |
-
|
| 136 |
descriptions.append(description)
|
| 137 |
|
| 138 |
node_info = pd.DataFrame({
|
|
@@ -140,7 +140,7 @@ node_info = pd.DataFrame({
|
|
| 140 |
"gene_id" : gene_ids,
|
| 141 |
"gene_type" : gene_types,
|
| 142 |
"cnag_id": cnag_ids,
|
| 143 |
-
"
|
| 144 |
"description": description})
|
| 145 |
|
| 146 |
neighbors = neighbors.merge(
|
|
@@ -197,7 +197,7 @@ for i in range(len(node_info.index)):
|
|
| 197 |
elements.append({
|
| 198 |
"data": {
|
| 199 |
"id": node["gene_id"],
|
| 200 |
-
"label": node["
|
| 201 |
"color": node_color_lut[node["gene_type"]]},
|
| 202 |
"position": {
|
| 203 |
"x" : layout_x,
|
|
|
|
| 117 |
gene_types = ['seed'] * len(seed_gene_ids) + ['neighbor'] * len(neighbor_gene_ids)
|
| 118 |
|
| 119 |
cnag_ids = []
|
| 120 |
+
gene_products = []
|
| 121 |
descriptions = []
|
| 122 |
|
| 123 |
for gene_id in gene_ids:
|
| 124 |
try:
|
| 125 |
cnag_id = h99_transcript_annotations.loc[h99_transcript_annotations["gene_id"] == gene_id]["cnag_id"].values[0]
|
| 126 |
+
gene_product = h99_transcript_annotations.loc[h99_transcript_annotations["gene_id"] == gene_id]["gene_product"].values[0]
|
| 127 |
description = h99_transcript_annotations.loc[h99_transcript_annotations["gene_id"] == gene_id]["description"].values[0]
|
| 128 |
except:
|
| 129 |
+
st.error(f"Unable to locate cnag_id for Gene ID: '{gene_id}', it should be of the form 'cnag_#####'")
|
| 130 |
cnag_id = None
|
| 131 |
+
gene_product = None
|
| 132 |
description = None
|
| 133 |
|
| 134 |
cnag_ids.append(cnag_id)
|
| 135 |
+
gene_products.append(gene_product)
|
| 136 |
descriptions.append(description)
|
| 137 |
|
| 138 |
node_info = pd.DataFrame({
|
|
|
|
| 140 |
"gene_id" : gene_ids,
|
| 141 |
"gene_type" : gene_types,
|
| 142 |
"cnag_id": cnag_ids,
|
| 143 |
+
"gene_product": gene_products,
|
| 144 |
"description": description})
|
| 145 |
|
| 146 |
neighbors = neighbors.merge(
|
|
|
|
| 197 |
elements.append({
|
| 198 |
"data": {
|
| 199 |
"id": node["gene_id"],
|
| 200 |
+
"label": node["gene_product"] if node["gene_product"] is not None else node["gene_id"],
|
| 201 |
"color": node_color_lut[node["gene_type"]]},
|
| 202 |
"position": {
|
| 203 |
"x" : layout_x,
|