wenjun99 commited on
Commit
8f26081
·
verified ·
1 Parent(s): 74742b2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -25
app.py CHANGED
@@ -393,7 +393,7 @@ with tab5:
393
  st.header("Decode Binary Labels to String")
394
 
395
  # Utility: Track source volumes and update if exceeds limit
396
- def track_and_replace_source(source_list, robot_script, volume_limit=170):
397
  source_volumes = {}
398
  adjusted_sources = []
399
 
@@ -422,37 +422,33 @@ with tab5:
422
 
423
  return adjusted_sources, source_volumes
424
 
425
- # Utility: Track D source volume separately for fixed-volume dispensing
426
- def generate_fixed_d_source_instructions(df_robot, fixed_volume=16, volume_limit=170):
427
  d_source_volumes = {}
428
  d_source_script = []
429
  current_d_index = 1
430
 
431
- mutation_headers = [str(h) for h in mutation_site_headers_actual_3614]
 
 
432
 
433
- for row_idx, sample in df_robot.iterrows():
434
- for col in mutation_headers:
435
- if col in sample and int(sample[col]) == 1:
436
- current_d_well = f"D{current_d_index}"
437
- if current_d_well not in d_source_volumes:
438
- d_source_volumes[current_d_well] = 0
439
 
440
- if d_source_volumes[current_d_well] + fixed_volume > volume_limit:
441
- current_d_index += 1
442
- current_d_well = f"D{current_d_index}"
443
- d_source_volumes[current_d_well] = 0
444
 
445
- d_source_volumes[current_d_well] += fixed_volume
 
446
 
447
- dest = get_well_position(int(sample['Sample']))
448
- tool = 'TS_10' if fixed_volume < 10 else 'TS_50'
449
-
450
- d_source_script.append({
451
- 'Source': current_d_well,
452
- 'Destination': dest,
453
- 'Volume': fixed_volume,
454
- 'Tool': tool
455
- })
456
 
457
  return d_source_script, d_source_volumes
458
 
@@ -534,7 +530,7 @@ with tab5:
534
 
535
  robot_script_32, source_volumes_32 = track_and_replace_source(source_wells_32, robot_script_32)
536
 
537
- d_script, d_volumes = generate_fixed_d_source_instructions(df_32_robot)
538
  full_robot_script = robot_script_32 + d_script
539
 
540
  robot_script_32_df = pd.DataFrame(full_robot_script)
 
393
  st.header("Decode Binary Labels to String")
394
 
395
  # Utility: Track source volumes and update if exceeds limit
396
+ def track_and_replace_source(source_list, robot_script, volume_limit=180):
397
  source_volumes = {}
398
  adjusted_sources = []
399
 
 
422
 
423
  return adjusted_sources, source_volumes
424
 
425
+ # Utility: Generate fixed-volume D source for all wells
426
+ def generate_fixed_d_source_instructions_for_all_wells(fixed_volume=16, volume_limit=170):
427
  d_source_volumes = {}
428
  d_source_script = []
429
  current_d_index = 1
430
 
431
+ all_destinations = [f"{row}{col}" for row in "ABCDEFGH" for col in range(1, 13)]
432
+ for dest in all_destinations:
433
+ current_d_well = f"D{current_d_index}"
434
 
435
+ if current_d_well not in d_source_volumes:
436
+ d_source_volumes[current_d_well] = 0
 
 
 
 
437
 
438
+ if d_source_volumes[current_d_well] + fixed_volume > volume_limit:
439
+ current_d_index += 1
440
+ current_d_well = f"D{current_d_index}"
441
+ d_source_volumes[current_d_well] = 0
442
 
443
+ d_source_volumes[current_d_well] += fixed_volume
444
+ tool = 'TS_10' if fixed_volume < 10 else 'TS_50'
445
 
446
+ d_source_script.append({
447
+ 'Source': current_d_well,
448
+ 'Destination': dest,
449
+ 'Volume': fixed_volume,
450
+ 'Tool': tool
451
+ })
 
 
 
452
 
453
  return d_source_script, d_source_volumes
454
 
 
530
 
531
  robot_script_32, source_volumes_32 = track_and_replace_source(source_wells_32, robot_script_32)
532
 
533
+ d_script, d_volumes = generate_fixed_d_source_instructions_for_all_wells()
534
  full_robot_script = robot_script_32 + d_script
535
 
536
  robot_script_32_df = pd.DataFrame(full_robot_script)