@@ -97,6 +97,37 @@ def notify_modal(marker_list):
97
97
)
98
98
99
99
100
+ def notify_modal_malformed_input (marker_list = None ):
101
+ if marker_list is not None :
102
+ message = (
103
+ "There was a fatal error in the input file.<br><br>"
104
+ "No marker(s) overlap with the loaded database.<br><br>"
105
+ "Marker(s): {} are incompatible with the loaded database.<br><br>"
106
+ "Adjust input file and retry upload/query." .format (str (marker_list )[1 :- 1 ])
107
+ )
108
+ else :
109
+ message = (
110
+ "There was a fatal error in the input file.<br><br>"
111
+ "Ensure column header: 'Sample' was used.<br><br>"
112
+ "Adjust input file and retry upload/query."
113
+ )
114
+ ui .modal_show (
115
+ ui .modal (
116
+ ui .div (
117
+ {"style" : "font-size: 18px" },
118
+ ui .HTML (
119
+ (
120
+ message
121
+ )
122
+ ),
123
+ ),
124
+ title = "Batch Query Error" ,
125
+ easy_close = True ,
126
+ footer = None ,
127
+ )
128
+ )
129
+
130
+
100
131
def notify_non_int ():
101
132
ui .modal_show (
102
133
ui .notification_show (
@@ -793,22 +824,7 @@ def out_batch_df():
793
824
try :
794
825
return render .DataTable (output_df ())
795
826
except Exception :
796
- m = ui .modal (
797
- ui .div (
798
- {"style" : "font-size: 18px" },
799
- ui .HTML (
800
- (
801
- "There was a fatal error in the query.<br><br>"
802
- "Ensure marker names match expectation, and that"
803
- " no special characters (spaces, etc.) were used in sample names."
804
- )
805
- ),
806
- ),
807
- title = "Batch Query Error" ,
808
- easy_close = True ,
809
- footer = None ,
810
- )
811
- ui .modal_show (m )
827
+ notify_modal_malformed_input ()
812
828
return render .DataTable (pd .DataFrame ({"Failed Query. Fix Input File" : []}))
813
829
elif input .search_type_batch () == "Cellosaurus Database (CLASTR)" :
814
830
with warnings .catch_warnings ():
@@ -837,22 +853,7 @@ def batch_query_results():
837
853
penta_fix = True ,
838
854
).to_dict (orient = "index" )
839
855
except Exception :
840
- m = ui .modal (
841
- ui .div (
842
- {"style" : "font-size: 18px" },
843
- ui .HTML (
844
- (
845
- "There was a fatal error in the input file.<br><br>"
846
- "Ensure column header: 'Sample' was used.<br><br>"
847
- "Adjust input file and retry upload/query."
848
- )
849
- ),
850
- ),
851
- title = "Batch Query Error" ,
852
- easy_close = True ,
853
- footer = None ,
854
- )
855
- ui .modal_show (m )
856
+ notify_modal_malformed_input ()
856
857
return pd .DataFrame ({"Failed Query. Fix Input File" : []})
857
858
858
859
ui .remove_ui ("#result_selector" )
@@ -887,6 +888,11 @@ def batch_query_results():
887
888
888
889
with reactive .isolate ():
889
890
if input .search_type_batch () == "STRprofiler Database" :
891
+ non_overlap_markers = set (query_df [next (iter (query_df ))].keys ()) - set (markers ())
892
+ if non_overlap_markers :
893
+ notify_modal_malformed_input (non_overlap_markers )
894
+ return pd .DataFrame ({"Failed Query. Fix Input File" : []})
895
+
890
896
results = _batch_query (
891
897
query_df ,
892
898
str_database (),
@@ -896,6 +902,7 @@ def batch_query_results():
896
902
input .mas_q_threshold_batch (),
897
903
input .mas_r_threshold_batch (),
898
904
)
905
+
899
906
elif input .search_type_batch () == "Cellosaurus Database (CLASTR)" :
900
907
clastr_query = [(lambda d : d .update (description = key ) or d )(val ) for (key , val ) in query_df .items ()]
901
908
malformed_markers = utils .validate_api_markers (query_df [next (iter (query_df ))].keys ())
0 commit comments