Skip to content

Commit

Permalink
figth globals: nTips implementing #8
Browse files Browse the repository at this point in the history
  • Loading branch information
qPCR4vir committed Jul 5, 2018
1 parent 8b7386f commit 0a09472
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 29 deletions.
4 changes: 2 additions & 2 deletions EvoScriPy/EvoMode.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ class iRobot(Mode):
and current volume in wells in labware, etc. One basic use of this, is to garante that the robot will be actualize
once and only once even when multiple modes are used.
"""
def __init__(self, index, nTips=4 , arms=None):
def __init__(self, index, nTips , arms=None):
Mode.__init__(self )
# import Robot as Rbt
self.robot = Rbt.Robot(index=index, arms=arms, nTips=nTips)
Expand All @@ -183,5 +183,5 @@ def set_as_current(self):
self.robot.set_as_current()


current = None
current = None # Oppsss !!! Define

6 changes: 3 additions & 3 deletions EvoScriPy/Instruction_Base.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def actualize_robot_state(self):
pass

def exec(self, mode=None):
if not mode: mode = EvoScriPy.EvoMode.current # todo revise
if mode is None: mode = EvoScriPy.EvoMode.current # todo revise
if not self.allowed(mode):
return
mode.exec(self)
Expand Down Expand Up @@ -217,7 +217,7 @@ class Pipetting(Pipette):
def __init__(self, name, tipMask = curTipMask,
liquidClass = def_liquidClass,
volume = def_vol,
labware = Lab.def_LabW,
labware = Lab.def_LabW, # todo ??????
spacing = 1,
wellSelection= None,
LoopOptions = def_LoopOp,
Expand All @@ -237,7 +237,7 @@ def __init__(self, name, tipMask = curTipMask,

def validateArg(self):
Pipette.validateArg(self)
nTips = Rbt.Robot.current.curArm().nTips
nTips = Rbt.Robot.current.curArm().nTips # todo FIX arm is arg
self.arg[1:1] = [string1(self.liquidClass)] + expr(nTips, self.volume).split() + [int(0)] * (
12 - nTips) # arg 2, 3 - 14
return True
Expand Down
14 changes: 7 additions & 7 deletions EvoScriPy/Robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
tipMask += [1 << tip]
tipsMask += [2 ** tip - 1]

def_nTips = 4
nTips = def_nTips
# def_nTips = 4
# nTips = def_nTips


class Robot:
Expand All @@ -29,7 +29,7 @@ class Robot:
Most of the changes in state are made by the implementation of the low level instructions, while the protocols can
"observe" the state to make all kind of optimizations and organizations previous to the actual instruction call
"""
current=None
current=None # use immediately, for a short time.

class Arm:
DiTi = 0
Expand Down Expand Up @@ -218,7 +218,7 @@ def __init__(self, index = None,
tipsType = Arm.DiTi,
templateFile= None): # index=Pipette.LiHa1
"""
A Robot may have 1 or more Arms, indexes by key index in a dictionary of Arms.
:param arms:
:param nTips:
:param workingTips:
Expand All @@ -228,7 +228,7 @@ def __init__(self, index = None,
Robot.current = self
self.arms = arms if isinstance(arms, dict ) else \
{arms.index: arms} if isinstance(arms, Robot.Arm) else \
{ index: Robot.Arm(nTips or def_nTips, index, workingTips, tipsType)}
{ index: Robot.Arm(nTips, index, workingTips, tipsType)}
self.set_worktable(templateFile)
self.def_arm = index # or Pipette.LiHa1
self.droptips = True
Expand Down Expand Up @@ -270,7 +270,7 @@ def where_are_preserved_tips(self, selected_reactive, TIP_MASK, type)->list: #
:param type:
:return: Return a list of racks with the tips-wells already selected.
"""
TIP_MASK = TIP_MASK if TIP_MASK != -1 else tipsMask[nTips]
TIP_MASK = TIP_MASK if TIP_MASK != -1 else tipsMask[self.curArm().nTips]
type = type if type else Lab.def_DiTi
n = Lab.count_tips(TIP_MASK)
assert n == len(selected_reactive)
Expand All @@ -293,7 +293,7 @@ def where_preserve_tips(self, TIP_MASK)->list: # [Lab.DITIrack]
:return:
""" # todo this in Labware??

TIP_MASK = TIP_MASK if TIP_MASK != -1 else tipsMask[nTips]
TIP_MASK = TIP_MASK if TIP_MASK != -1 else tipsMask[self.curArm().nTips]
types = []
t_masks = []
racks = []
Expand Down
16 changes: 9 additions & 7 deletions EvoScriPy/protocol_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def not_implemented(NumOfSamples):
print('This protocols have yet to be implemented.')


output_filename = '../current/AWL'
# output_filename = '../current/AWL'


class Protocol:
Expand All @@ -36,11 +36,11 @@ class Parameter:

def __init__(self, GUI = None,
worktable_template_filename = None,
output_filename = output_filename,
output_filename = None,
firstTip = None):

self.worktable_template_filename = worktable_template_filename or ""
self.output_filename = output_filename
self.output_filename = output_filename or '../current/AWL'
self.GUI = GUI
self.firstTip = firstTip or 'A01'

Expand All @@ -56,7 +56,7 @@ def __init__(self, # worktable_template_fn ,
self.parameters = parameters or Protocol.Parameter()
self.initialized = False
self.Reactives = []
self. nTips = nTips
self.nTips = nTips
self.EvoMode = None

self.set_EvoMode()
Expand All @@ -77,7 +77,9 @@ def init_EvoMode(self):
self.comments_
])
EvoMode.current = self.EvoMode
self.worktable = self.iRobot.robot.worktable
self.worktable = self.iRobot.robot.worktable # shortcut !!
self.robot = self.iRobot.robot
assert (self.iRobot.robot.curArm().nTips == self.nTips )

def set_EvoMode(self):
if not self.EvoMode:
Expand Down Expand Up @@ -181,9 +183,9 @@ def moveTips(zMove, zTarget, offset, speed, TIP_MASK=-1):
pass # Itr.moveLiha

def getTips(TIP_MASK=-1, type=None, selected_samples=None):
robot = Rbt.Robot.current
mask = TIP_MASK = TIP_MASK if TIP_MASK != -1 else Rbt.tipsMask[Rbt.nTips]
robot = Rbt.Robot.current # todo revice !!!
assert isinstance(robot, Rbt.Robot)
mask = TIP_MASK = TIP_MASK if TIP_MASK != -1 else Rbt.tipsMask[robot.curArm().nTips]
#if not Rbt.Robot.reusetips: # and Rbt.Robot.droptips

if robot.usePreservedtips:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def Run(self):
SampleLiqClass = "Serum Asp" # = TissueHomLiqClass # SerumLiqClass="Serum Asp preMix3"

all_samples = range(NumOfSamples)
maxTips = min (Rbt.nTips, NumOfSamples)
maxTips = min (self.nTips, NumOfSamples)
maxMask = Rbt.tipsMask[maxTips]


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def Run(self):


all_samples = range(NumOfSamples)
maxTips = min (Rbt.nTips, NumOfSamples)
maxTips = min (self.nTips, NumOfSamples)
maxMask = Rbt.tipsMask[maxTips]


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def Run(self):
SampleLiqClass = "Serum Asp" # = TissueHomLiqClass # SerumLiqClass="Serum Asp preMix3"

all_samples = range(NumOfSamples)
maxTips = min (Rbt.nTips, NumOfSamples)
maxTips = min (self.nTips, NumOfSamples)
maxMask = Rbt.tipsMask[maxTips]


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Prefill_plates_VEW1_ElutionBuffer_VEW2(Evo100_FLI):
"""
Prefill plates with VEW1, Elution buffer and VEW2 for the
Implementation of the protocol for RNA extraction using the NucleoMag® VET kit from MACHEREY-NAGEL
with watching in the Fischer Robot.
with washes in the Fischer Robot.
"""

name = "Prefill plates with VEW1, Elution buffer and VEW2 for KingFisher"
Expand Down Expand Up @@ -73,7 +73,7 @@ def Run(self):


all_samples = range(NumOfSamples)
maxTips = min (Rbt.nTips, NumOfSamples)
maxTips = min (self.nTips, NumOfSamples)
maxMask = Rbt.tipsMask[maxTips]


Expand Down
10 changes: 5 additions & 5 deletions protocols/RNAextractionMN_Mag/RNAextractionMN_Mag_Vet.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ def Run(self):
SampleLiqClass ="Serum Asp" # = TissueHomLiqClass # SerumLiqClass="Serum Asp preMix3"

all_samples = range(NumOfSamples)
maxTips = min(Rbt.nTips, NumOfSamples)
maxTips = min(self.nTips, NumOfSamples)
maxMask = Rbt.tipsMask[maxTips]
par = TeMag.parallelOrder(Rbt.nTips, all_samples)
par = TeMag.parallelOrder(self.nTips, all_samples)

LysisBuffer = Rtv.Reactive("VL - Lysis Buffer " ,
LysBuf, volpersample=LysisBufferVolume ,defLiqClass=B_liquidClass)
Expand Down Expand Up @@ -178,7 +178,7 @@ def Run(self):
with group("Wash in TeMag with " + EtOH80p.name), tips():
spread( reactive=EtOH80p,to_labware_region= TeMag.selectOnly(all_samples))

with parallel_execution_of(mix_mag_sub, repeat=NumOfSamples//Rbt.nTips +1):
with parallel_execution_of(mix_mag_sub, repeat=NumOfSamples//self.nTips +1):
mix( TeMag.selectOnly(all_samples), EtOH80p.defLiqClass)
with incubation(minutes=0.5):
Te_MagS_MoveToPosition(Te_MagS_MoveToPosition.Aspirate, z_pos=24).exec()
Expand All @@ -195,7 +195,7 @@ def Run(self):
Te_MagS_MoveToPosition(Te_MagS_MoveToPosition.Incubation).exec()

Te_MagS_MoveToPosition(Te_MagS_MoveToPosition.Dispense).exec()
with parallel_execution_of(mix_mag_eluat, repeat=NumOfSamples//Rbt.nTips+1):
with parallel_execution_of(mix_mag_eluat, repeat=NumOfSamples//self.nTips+1):
mix(TeMag.selectOnly(all_samples), ElutionBuffer.defLiqClass)

with tips(usePreserved=preserveingTips(), preserve=False, drop=True):
Expand Down Expand Up @@ -228,7 +228,7 @@ def wash_in_TeMag( self, reactive, wells=None, using_liquid_class=None, vol=None
Te_MagS_MoveToPosition(Te_MagS_MoveToPosition.Dispense).exec()
spread(reactive=reactive, to_labware_region=self.TeMag.selectOnly(wells))

with parallel_execution_of(mix_mag_sub, repeat=self.NumOfSamples//Rbt.nTips +1):
with parallel_execution_of(mix_mag_sub, repeat=self.NumOfSamples//self.nTips +1):
mix(self.TeMag.selectOnly(wells), using_liquid_class, vol)

with incubation(minutes=0.5, timer=2):
Expand Down

0 comments on commit 0a09472

Please sign in to comment.