def movetoch4(): fluidics.stop_flow() stage.move_to("J1") stage.move_to("Ch1") setpressure(0.1) fluidics.open(1, 2, 3, 4, 6) reset_force() print("setup should be ready to go")
def bead_DNA_complex_setup(): fluidics.open(1, 2, 3, 6) fluidics.close(4, 5) pause(5) # wait for flow to start stage.move_to("beads") print("Moved to Beads channel") catch_beads(80) print("Beads are trapped") # stage.move_to("DNA") # print("Moved to DNA channel") # pause(5) ## DEFINITELY have to play with this based on DNA concentration/flow rate # print('till here') stage.move_to("buffer") print("Moved to Buffer channel")
def catch_beads(min_score=30): #from Zsombor stage.move_to("beads") target_traps = traps[:2] target_traps[1].clear() target_traps[0].clear() bead1 = timeline['Tracking Match Score']['Bead 1'] bead2 = timeline['Tracking Match Score']['Bead 2'] bead_scores = [bead1, bead2] while any(bead.latest_value < min_score for bead in bead_scores): if any(0 < bead.latest_value < min_score for bead in bead_scores): for trap in target_traps: trap.clear() # bad beads print('bad beads') pause(1) print("beads should be caught")
def fish_for_dna(min_distance_um, max_distance_um, force_threshold_pN): """Oscillate between min and max distance while the force is under the threshold value""" stage.move_to("DNA") goto_distance(min_distance_um) fluidics.open(1, 2, 3, 6) pause(1) reset_force() goto_distance(max_distance_um) while trap2.current_force < force_threshold_pN: goto_distance(min_distance_um) reset_force() goto_distance(max_distance_um) fluidics.close(1, 2, 3, 6) stage.move_to("buffer") goto_distance(min_distance_um) reset_force()
def catch_2_beads(): "Just like `abc2.py`" target_traps = [trap1, trap2] match_scores = [match_score1, match_score2] for trap in target_traps: trap.clear() # to get rid of any existing beads stage.move_to("beads") # must match the label in the UI fluidics.open(1, 2, 3, 6) # list of valves to open matching the UI match_threshold = 80 # % minimal match score while any(m.latest_value < match_threshold for m in match_scores): if any(0 < m.latest_value < match_threshold for m in match_scores): for trap in target_traps: trap.clear() # bad beads pause(1) stage.move_to("buffer") fluidics.close(1, 2, 3, 6)
def gogetprotein(hangouttime,flowon,initforce): print("getting protein for " + str(hangouttime) + " sec") trap = Trap("1", "XY") trap.move_to(waypoint="measure point",speed=4) stage.move_to("J1") stage.move_to("Ch1") setpressure(0.12) if flowon: fluidics.open(1,2,3,4,6) pause(hangouttime) fluidics.close(1,2,3,4,6) stage.move_to("J1") stage.move_to("buffer")
def thelooploop(): #return 1 if done chk = 0 while chk == 0: print("starting loop loop") chk = themainloop() if chk == 1: chk = false_positive() else: target_traps = traps[:2] target_traps[1].clear() target_traps[0].clear() #hopefully caught something, move to buffer channel and reset all stage.move_to("buffer") gohome() fluidics.stop_flow() reset_force() print("in the buffer channel with all reset") #0 for no ssDNA, 1 for good, 2 for failed to pull if makessDNA == 1: print("time to try for ssDNA") s = 0 while s != 1: s = ssDNAstretch() if s == 0: setpressure(0.3) fluidics.open(3, 6) target_traps = traps[:2] target_traps[1].clear() target_traps[0].clear() fluidics.close(3, 6) return s if s == 2: continue else: return 1
def themainloop( ): #will return 1 if caught, 0 if attempted 60 times and failed #check for beads first bt = beadtest() fluidics.close(1, 2, 3, 4, 5, 6) if bt == 0: setpressure(0.3) fluidics.open(1, 2, 3, 6) stage.move_to("beads") catch_beads(86) else: #turn on fluidics fluidics.open(1, 2, 3, 6) # set up the pressure stage.move_to("buffer") setpressure(0.4) #set traps at initial position and reset force gohome() reset_force() print("initialized position") caught = pingpongforce2() attempts = 1 #moving into dna channel and starting pingpong while caught != 1: print(" we've attempted " + str(attempts) + " times") #print(" new force ="+str(round(pforce,2))) stage.move_to("DNA") pause(dnadwell) stage.move_to("buffer") pause(dnadwell) caught = pingpongforce2() if attempts == 15: return 0 if (attempts % 10) == 0: pressurecycle() attempts += 1 else: attempts += 1 print("hopefully we finished") return 1
"""Automated bead catching -- 2 beads""" from bluelake import stage, fluidics, pause, timeline, trap1, trap2 target_traps = [trap1, trap2] match_score1 = timeline["Tracking Match Score"]["Bead 1"] match_score2 = timeline["Tracking Match Score"]["Bead 2"] match_scores = [match_score1, match_score2] for trap in target_traps: trap.clear() # to get rid of any existing beads stage.move_to("beads") # must match the label in the UI fluidics.open(1, 2, 3, 6) # list of valves to open matching the UI # Note: `match_score1` does not map directly to `trap1`. `match_score1`, # `match_score2` sort beads from left to right, up to down. In case we # `match_score1.latest_value > 0` we can't be sure that if that bead is # in `trap1` or `trap2`. So to catch 2 beads we need to make sure both # are good or clear both traps even if just one is bad. match_threshold = 80 # % minimal match score while any(m.latest_value < match_threshold for m in match_scores): if any(0 < m.latest_value < match_threshold for m in match_scores): for trap in target_traps: trap.clear() # bad beads pause(1) stage.move_to("buffer") fluidics.close(1, 2, 3, 6)
trap = Trap("1", "XY") pt = 0.1 spd = 35 #functions that may be helpful def setpressure(pres): curpres = fluidics.pressure if curpres < pres: while fluidics.pressure < pres: fluidics.increase_pressure() pause(pt) #important! else: while fluidics.pressure > pres: fluidics.decrease_pressure() pause(pt) #important! # MAIN----------------------------------------------------------- print("moving to ch1") stage.move_to("J1", speed=spd) stage.move_to("Ch1", speed=spd) print("waiting...") pause(10) print("done waiting, time to move") stage.move_to("J1", speed=spd) stage.move_to("buffer", speed=spd) print("done moving, start imaging!")
print("hopefully we finished") return 1 #THIS IS THE START OF THE MAIN ----------------------------------------- chk = 0 while chk == 0: print("starting loop loop") chk = themainloop() if chk == 1: chk = false_positive() else: target_traps = traps[:2] target_traps[1].clear() target_traps[0].clear() #hopefully caught something, move to buffer channel and reset all stage.move_to("buffer") gohome() fluidics.stop_flow() reset_force() print("in the buffer channel with all reset") #if want to move to ch4 to ready for experiment start if echannel == 1: movetoch4() trap.move_to(waypoint="Point 2", speed=3) print('ready to image!')
if any(0 < bead.latest_value < min_score for bead in bead_scores): for trap in target_traps: trap.clear() # bad beads print('bad beads') pause(1) print("beads should be caught") #THIS IS THE START OF THE MAIN ----------------------------------------- #check for beads first bt = beadtest() if bt == 0: setpressure(0.3) fluidics.open(1, 2, 3, 6) stage.move_to("beads") catch_beads(82) else: #turn on fluidics fluidics.open(1, 2, 3, 6) # set up the pressure stage.move_to("buffer") setpressure(0.22) #set traps at initial position and reset force gohome() reset_force() print("initialized position") #initialize variables