wenjun99 commited on
Commit
76e2406
·
verified ·
1 Parent(s): 580207d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -134,13 +134,18 @@ if not df_binary.empty:
134
  df_robot = df_binary.copy()
135
  df_robot.insert(0, 'Sample', range(1, len(df_robot) + 1))
136
  df_robot['# donors'] = df_robot.iloc[:, 1:].astype(int).sum(axis=1)
137
- df_robot['volume donors (µL)'] = 64 / df_robot['# donors']
 
 
 
138
 
139
  robot_script = []
140
  source_wells = generate_source_wells(df_robot.shape[1] - 1)
141
 
142
  for i, col in enumerate(df_robot.columns[1:]):
143
  for _, sample in df_robot.iterrows():
 
 
144
  if int(sample[col]) == 1:
145
  sample_id = int(sample['Sample'])
146
  plate = get_plate_id(sample_id)
 
134
  df_robot = df_binary.copy()
135
  df_robot.insert(0, 'Sample', range(1, len(df_robot) + 1))
136
  df_robot['# donors'] = df_robot.iloc[:, 1:].astype(int).sum(axis=1)
137
+ df_robot['volume donors (µL)'] = df_robot['# donors'].apply(
138
+ lambda x: 64 / x if x > 0 else 0
139
+ )
140
+
141
 
142
  robot_script = []
143
  source_wells = generate_source_wells(df_robot.shape[1] - 1)
144
 
145
  for i, col in enumerate(df_robot.columns[1:]):
146
  for _, sample in df_robot.iterrows():
147
+ if sample['# donors'] == 0:
148
+ continue # skip samples with no donors
149
  if int(sample[col]) == 1:
150
  sample_id = int(sample['Sample'])
151
  plate = get_plate_id(sample_id)