VyLala commited on
Commit
1685f9f
·
verified ·
1 Parent(s): 4da5729

Update mtdna_backend.py

Browse files
Files changed (1) hide show
  1. mtdna_backend.py +9 -3
mtdna_backend.py CHANGED
@@ -280,13 +280,19 @@ def summarize_results(accession):
280
  # ✅ Open the known_samples sheet
281
  spreadsheet = client.open("known_samples")
282
  sheet = spreadsheet.sheet1
283
-
 
 
 
 
 
284
  # ✅ Read old data
285
  existing_data = sheet.get_all_values()
286
- if existing_data:
287
  df_old = pd.DataFrame(existing_data[1:], columns=existing_data[0])
288
  else:
289
- df_old = pd.DataFrame(columns=df_new.columns)
 
290
 
291
  # ✅ Set index and update old values with new ones
292
  df_old.set_index("Sample ID", inplace=True)
 
280
  # ✅ Open the known_samples sheet
281
  spreadsheet = client.open("known_samples")
282
  sheet = spreadsheet.sheet1
283
+ required_columns = [
284
+ "Sample ID", "Predicted Country", "Country Explanation",
285
+ "Predicted Sample Type", "Sample Type Explanation",
286
+ "Sources", "Query_cost", "Time cost"
287
+ ]
288
+
289
  # ✅ Read old data
290
  existing_data = sheet.get_all_values()
291
+ if existing_data and existing_data[0] == required_columns:
292
  df_old = pd.DataFrame(existing_data[1:], columns=existing_data[0])
293
  else:
294
+ df_old = pd.DataFrame(columns=required_columns)
295
+
296
 
297
  # ✅ Set index and update old values with new ones
298
  df_old.set_index("Sample ID", inplace=True)