Skip to content

Commit

Permalink
Obfuscating "no analysis" errors
Browse files Browse the repository at this point in the history
  • Loading branch information
adkinsrs committed Aug 9, 2024
1 parent 3f36673 commit e050be8
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 10 deletions.
16 changes: 12 additions & 4 deletions www/api/resources/multigene_dash_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,22 @@ def post(self, dataset_id):

try:
ana = geardb.get_analysis(analysis, dataset_id, session_id)
# Using adata with "backed" mode does not work with volcano plot
adata = ana.get_adata(backed=False)
except Exception as e:
import traceback
traceback.print_exc()
return {
'success': -1,
'message': str(e),
"success": -1,
"message": "Could not retrieve analysis."
}

try:
adata = ana.get_adata(backed=True)
except Exception as e:
import traceback
traceback.print_exc()
return {
"success": -1,
"message": "Could not retrieve AnnData object."
}

adata.obs = order_by_time_point(adata.obs)
Expand Down
10 changes: 9 additions & 1 deletion www/api/resources/plotly_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,20 @@ def post(self, dataset_id):

try:
ana = geardb.get_analysis(analysis, dataset_id, session_id)
except Exception as e:
import traceback
traceback.print_exc()
return_dict["success"] = -1
return_dict["message"] = "Could not retrieve analysis."
return return_dict

try:
adata = ana.get_adata(backed=True)
except Exception as e:
import traceback
traceback.print_exc()
return_dict["success"] = -1
return_dict["message"] = str(e)
return_dict["message"] = "Could not retrieve AnnData."
return return_dict

if projection_id:
Expand Down
16 changes: 13 additions & 3 deletions www/api/resources/projectr.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,13 +296,23 @@ def projectr_callback(dataset_id, genecart_id, projection_id, session_id, scope,
# NOTE Currently no analyses are supported yet.
try:
ana = geardb.get_analysis(None, dataset_id, session_id)
except Exception as e:
import traceback
traceback.print_exc()
return {
"success": -1,
"message": "Could not retrieve analysis."
}

try:
# Using adata with "backed" mode does not work with volcano plot
adata = ana.get_adata(backed=True)
except Exception as e:
print(str(e), file=fh)
import traceback
traceback.print_exc()
return {
'success': -1
, 'message': str(e)
"success": -1,
"message": "Could not retrieve AnnData object."
}


Expand Down
12 changes: 10 additions & 2 deletions www/api/resources/tsne_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,15 +211,23 @@ def post(self, dataset_id):

try:
ana = geardb.get_analysis(analysis, dataset_id, session_id)
adata = ana.get_adata(backed=True)
except Exception as e:
import traceback
traceback.print_exc()
return {
"success": -1,
"message": str(e)
"message": "Could not retrieve analysis."
}

try:
adata = ana.get_adata(backed=True)
except Exception as e:
import traceback
traceback.print_exc()
return {
"success": -1,
"message": "Could not retrieve AnnData object."
}

if projection_id:
try:
Expand Down

0 comments on commit e050be8

Please sign in to comment.