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 stretchitout(stretchtime): print("pre stretch time: "+ str(stretchtime) + " sec") f1=trap2.current_force print(" initial force: " + str(round(f1,2))) trap = Trap("1", "XY") trap.move_to(waypoint="more streatch",speed=4) pause(stretchtime) trap.move_to(waypoint="measure point",speed=4) pause(2) f2=trap2.current_force print(" final force: " + str(round(f2,2))) if f2<(0.5*f1) and f1 > 1: print("it broke") return 0 return 1
def timeprogression(time, numsteps): stepsize = round(time / numsteps, 2) for i in range(1, numsteps + 1): pause(stepsize) print(" " + str(round(i * stepsize * 100 / time)) + "% of time has elapsed (" + str(round(i * stepsize / 60, 1)) + " min)") # MAIN ====================================== hangtime = 5 #how long it stays stretched imagetime = 400 #how long to image for proteintime = 3 #waiting for protein to bind excitation_lasers.green = 0 trap = Trap("1", "XY") # stretching print("stretching for " + str(hangtime) + " sec") trap.move_to(waypoint="more streatch", speed=5) timeprogression(hangtime, 5) trap.move_to(waypoint="measure point", speed=5) print("stretch done") print("just hanging out for a bit for protein binding (" + str(proteintime) + " sec)") timeprogression(proteintime, 5) #turn on laser excitation_lasers.green = 30 #start imaging confocal.start_scan("Rep kymo")
#to move from imaging channel to buffer channel slowly #assumptions:start from 'buffer' channel at least? from bluelake import Trap, stage, fluidics, pause, reset_force 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")
#trapping dna with ping pong automation #will catch your beads from bluelake import Trap, stage, fluidics, pause, reset_force, timeline, traps import numpy as np trap = Trap("1", "XY") trap2 = Trap("2", "XY") pt = 0.1 echannel = 1 #change this to 1 if you want to end in an experiment channel dnadwell = 1 #how long to dwell in dna channel (sec) makessDNA = 1 #functions that we need to catch DNA def pingpongforce(): trap.move_by(dx=10, speed=5.5) ppf = trap.current_force trap.move_by(dx=-10, speed=6.5) return ppf def pingpongforce2(): trap.move_by(dx=9, speed=5.5) ppf1 = trap2.current_force move_by2(1.2, 5.5) ppf2 = trap2.current_force trap.move_by(dx=-10.2, speed=6.5) print(" " + str(round(ppf1, 2)) + " to " + str(round(ppf2, 2))) if (ppf1 * 0.77) > ppf2 or ppf2 > (ppf1 * 1.23): return 1
#import bluelake_remote from bluelake import Trap, pause, log trap1 = Trap("1", "XY") def pingpong(distance_delta_um, period_ms, speed): while True: trap1.move_by(dx=+distance_delta_um, speed=speed) pause(period_ms / 1000 / 2) log("ping") trap1.move_by(dx=-distance_delta_um, speed=speed) pause(period_ms / 1000 / 2) log("pong") log("Running pingpong script") pingpong(distance_delta_um=0.008, period_ms=50, speed=0)
# 1) move trap into 'measure point' position and hang out in the 'protein' # 2) move back into the buffer channel # 3) start image # 4) record starting force and photon count # 5) if force goes below cutoff, wait n time and stop scan # if photon count goes below cutoff, wait n time and stop scan, # then return to the protein channel from bluelake import pause, timeline, confocal, Trap, stage, fluidics, excitation_lasers import numpy as np greencutoff = 11 #%% FUNCTIONS ==================== trap2 = Trap("2","XY") def autoshutoffkymo(): #both force and photon counts greenphoton = timeline["Photon count"]["Green"] confocal.start_scan("RPA Kymo") f1=trap2.current_force print("initial force: " + str(round(f1,2))) n=0; photonbin=20 while 1: pause(1/78125) n+=1 photonbin += greenphoton.latest_value if n%(3000) == 0: f2 = trap2.current_force
#trapping dna with ping pong automation #will catch your beads from bluelake import Trap, stage, fluidics, pause, reset_force, timeline, traps import numpy as np trap = Trap("1", "XY") pt = 0.1 echannel = 0 #change this to 1 if you want to end in an experiment channel dnadwell = 1.5 #how long to dwell in dna channel (sec) dist1pp = 1.6 # dist1pp = 10 #functions that we need to catch DNA def pingpongforce(): trap.move_by(dx=(10 + dist1pp), speed=5.5) ppf = trap.current_force trap.move_by(dx=-(dist1pp + 10), speed=6.5) return ppf def pingpongforce2(): trap.move_by(dx=(9 + dist1pp), speed=5.5) ppf1 = trap.current_force move_by2(1.2, 5.5) ppf2 = trap.current_force trap.move_by(dx=-(10.2 + dist1pp), speed=6.5) print(" " + str(round(ppf1, 2)) + " to " + str(round(ppf2, 2))) if (ppf1 * 0.77) > ppf2 or ppf2 > (ppf1 * 1.23): return 1