Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -422,14 +422,13 @@ with tab5:
|
|
| 422 |
|
| 423 |
return adjusted_sources, source_volumes
|
| 424 |
|
| 425 |
-
# Utility: Generate fixed-volume D source for
|
| 426 |
-
def
|
| 427 |
d_source_volumes = {}
|
| 428 |
d_source_script = []
|
| 429 |
current_d_index = 1
|
| 430 |
|
| 431 |
-
|
| 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:
|
|
@@ -513,12 +512,14 @@ with tab5:
|
|
| 513 |
|
| 514 |
robot_script_32 = []
|
| 515 |
source_wells_32 = generate_source_wells(df_32.shape[1])
|
|
|
|
| 516 |
|
| 517 |
for i, col in enumerate(df_32.columns):
|
| 518 |
for row_idx, sample in df_32_robot.iterrows():
|
| 519 |
if int(sample[col]) == 1:
|
| 520 |
source = source_wells_32[i]
|
| 521 |
dest = get_well_position(int(sample['Sample']))
|
|
|
|
| 522 |
vol = round(sample['volume donors (µl)'], 2)
|
| 523 |
tool = 'TS_10' if vol < 10 else 'TS_50'
|
| 524 |
robot_script_32.append({
|
|
@@ -530,7 +531,7 @@ with tab5:
|
|
| 530 |
|
| 531 |
robot_script_32, source_volumes_32 = track_and_replace_source(source_wells_32, robot_script_32)
|
| 532 |
|
| 533 |
-
d_script, d_volumes =
|
| 534 |
full_robot_script = robot_script_32 + d_script
|
| 535 |
|
| 536 |
robot_script_32_df = pd.DataFrame(full_robot_script)
|
|
|
|
| 422 |
|
| 423 |
return adjusted_sources, source_volumes
|
| 424 |
|
| 425 |
+
# Utility: Generate fixed-volume D source for only used wells
|
| 426 |
+
def generate_fixed_d_source_instructions_for_used_wells(destinations, fixed_volume=16, volume_limit=170):
|
| 427 |
d_source_volumes = {}
|
| 428 |
d_source_script = []
|
| 429 |
current_d_index = 1
|
| 430 |
|
| 431 |
+
for dest in destinations:
|
|
|
|
| 432 |
current_d_well = f"D{current_d_index}"
|
| 433 |
|
| 434 |
if current_d_well not in d_source_volumes:
|
|
|
|
| 512 |
|
| 513 |
robot_script_32 = []
|
| 514 |
source_wells_32 = generate_source_wells(df_32.shape[1])
|
| 515 |
+
used_destinations = set()
|
| 516 |
|
| 517 |
for i, col in enumerate(df_32.columns):
|
| 518 |
for row_idx, sample in df_32_robot.iterrows():
|
| 519 |
if int(sample[col]) == 1:
|
| 520 |
source = source_wells_32[i]
|
| 521 |
dest = get_well_position(int(sample['Sample']))
|
| 522 |
+
used_destinations.add(dest)
|
| 523 |
vol = round(sample['volume donors (µl)'], 2)
|
| 524 |
tool = 'TS_10' if vol < 10 else 'TS_50'
|
| 525 |
robot_script_32.append({
|
|
|
|
| 531 |
|
| 532 |
robot_script_32, source_volumes_32 = track_and_replace_source(source_wells_32, robot_script_32)
|
| 533 |
|
| 534 |
+
d_script, d_volumes = generate_fixed_d_source_instructions_for_used_wells(sorted(used_destinations))
|
| 535 |
full_robot_script = robot_script_32 + d_script
|
| 536 |
|
| 537 |
robot_script_32_df = pd.DataFrame(full_robot_script)
|