Example #1
0
    def mix_reactive(self, reactive, LiqClass=None, cycles=3, maxTips=1, v_perc=90):
        """
        Select all possible replica of the given reactive and mix using the given % of the current vol in EACH well
        or the max vol for the tip. Use the given liq class or the reactive deff.
        :param reactive:
        :param LiqClass:
        :param cycles:
        :param maxTips:
        :param v_perc:
        :return:
        """
        assert isinstance(reactive, Rtv.Reagent)
        LiqClass = LiqClass or reactive.defLiqClass
        v_perc /= 100.0
        vol = []
        reactive.autoselect(maxTips)
        for tip, w in enumerate(reactive.labware.selected_wells()):
            v = w.vol * v_perc
            vm = self.robot.curArm().Tips[tip].type.maxVol * 0.9
            vol += [min(v, vm)]

        Itr.mix(Rbt.tipsMask[len(vol)],
                liquidClass =LiqClass,
                volume      =vol,
                labware     =reactive.labware,
                cycles      =cycles).exec()
Example #2
0
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]
    assert isinstance(robot, Rbt.Robot)
    #if not Rbt.Robot.reusetips: # and Rbt.Robot.droptips

    if robot.usePreservedtips:
        with tips(drop=True, preserve=False
                  ):  # drop tips from previous "buffer" in first pipetting
            dropTips(TIP_MASK)
        where = robot.where_are_preserved_tips(selected_samples, TIP_MASK,
                                               type)
        nTips = robot.curArm().nTips
        for tip_rack in where:
            tipsMask = 0
            tips_in_rack = len(tip_rack.selected())
            for idx in range(nTips):
                if not tips_in_rack: break
                tip = (1 << idx)
                if TIP_MASK & tip:
                    tipsMask |= tip
                    TIP_MASK ^= tip
                    tips_in_rack -= 1
            Itr.pickUp_DITIs2(tipsMask, tip_rack).exec()
        assert tips_in_rack == 0
    else:
        type = type or Lab.def_DiTi
        I = Itr.getDITI2(TIP_MASK, type, arm=robot.def_arm)
        I.exec()
    return mask  # todo REVISE !!   I.tipMask
Example #3
0
def makePreMix(preMix, NumSamples=None):
    NumSamples = NumSamples or Rtv.NumOfSamples
    l = preMix.labware
    msg = "preMix: {:.1f} µL of {:s}".format(preMix.minVol(NumSamples),
                                             preMix.name)
    with group(msg):
        msg += " into {:s}[grid:{:d} site:{:d} well:{:d}] from {:d} components:".format(
            l.label, l.location.grid, l.location.site + 1, preMix.pos + 1,
            len(preMix.components))
        Itr.comment(msg).exec()
        nc = len(preMix.components)
        nr = len(preMix.Replicas)
        nt = Rbt.Robot.current.curArm().nTips
        assert nc <= nt, "Temporally the mix can not contain more than {:d} components.".format(
            nt)
        dt = nt - nc
        samples_per_replicas = [(NumSamples + nr - (i + 1)) // nr
                                for i in range(nr)]
        with tips(Rbt.tipsMask[nc]):  #  want to use preserved ?? selected=??
            for i, react in enumerate(preMix.components):
                l = react.labware
                r = react.volpersample * NumSamples * preMix.excess
                msg = "   {:d}- {:.1f} µL of {:s} from {:s}[grid:{:d} site:{:d} well:{:d}]".format(
                    i + 1, r, react.name, l.label, l.location.grid,
                    l.location.site + 1, react.pos + 1)
                Itr.comment(msg).exec()
                mV = Rbt.Robot.current.curArm(
                ).Tips[i].type.maxVol  # todo what if the tip are different?
                while r > 0:
                    dV = r if r < mV else mV
                    aspire(i, react, dV)
                    multidispense_in_replicas(
                        i, preMix,
                        [sp / NumSamples * dV for sp in samples_per_replicas])
                    r -= dV
Example #4
0
    def getTips(self, TIP_MASK=-1, tip_type=None, selected_samples=None):

        mask = TIP_MASK = TIP_MASK if TIP_MASK != -1 else Rbt.tipsMask[self.robot.curArm().nTips]

        if self.robot.usePreservedtips:
            with self.tips(drop=True, preserve=False):    # drop tips from previous "buffer" in first pipetting
                self.dropTips(TIP_MASK)
            where = self.robot.where_are_preserved_tips(selected_samples, TIP_MASK, tip_type)
            nTips = self.robot.curArm().nTips

            for tip_rack in where:
                tipsMask = 0
                tips_in_rack = len(tip_rack.selected())
                for idx in range(nTips):
                    if not tips_in_rack: break
                    tip = (1 << idx)
                    if TIP_MASK & tip:
                        tipsMask |= tip
                        TIP_MASK ^= tip
                        tips_in_rack -= 1
                Itr.pickUp_DITIs2(tipsMask, tip_rack).exec()
            assert tips_in_rack == 0
        else:
            tip_type= tip_type or self.worktable.def_DiTi
            I = Itr.getDITI2(TIP_MASK, tip_type, arm=self.robot.def_arm)
            I.exec()
        return mask                                    # todo REVISE !!   I.tipMask
Example #5
0
 def dispense(self,  tip, reactive, vol=None):                     # OK coordinate with robot
     """
     Dispense vol with ONE tip to reactive
     :param tip:
     :param reactive:
     :param vol:
     """
     vol = vol or reactive.minVol()                                # really ??   # todo: revise !!
     reactive.autoselect()                                         # reactive.labware.selectOnly([reactive.pos])
     v = [0] * self.robot.curArm().nTips
     v[tip] = vol
     Itr.dispense(Rbt.tipMask[tip], reactive.defLiqClass, v, reactive.labware).exec()
Example #6
0
def dispensemultiwells(tips, liq_class, labware, vol):
    """ One dispense of multitip in multiwell with different vol

        :param tips:
        :param liq_class:
        :param labware:
        :param vol:
        """
    if not isinstance(vol, list):
        vol = [vol] * tips
    om = Rbt.tipsMask[tips]
    # Rbt.Robot.current.curArm().dispense(vol, om)
    Itr.dispense(om, liq_class, vol, labware).exec()
Example #7
0
def dispense(tip, reactive, vol=None):  # OK coordinate with robot
    """
    Dispense vol with ONE tip to reactive
    :param tip:
    :param reactive:
    :param vol:
    """
    vol = vol or reactive.minVol()  # really ??
    reactive.autoselect()  # reactive.labware.selectOnly([reactive.pos])
    v = [0] * Rbt.Robot.current.curArm().nTips
    v[tip] = vol
    Itr.dispense(Rbt.tipMask[tip], reactive.defLiqClass, v,
                 reactive.labware).exec()
Example #8
0
    def dispensemultiwells(self,  tips, liq_class, labware, vol):
            """ One dispense of multitip in multiwell with different vol

            :param tips:
            :param liq_class:
            :param labware:
            :param vol:
            """
            if not isinstance(vol, list):
                vol = [vol] * tips
            om = Rbt.tipsMask[tips]
                                                                        # Rbt.Robot.current.curArm().dispense(vol, om)
            Itr.dispense(om, liq_class, vol, labware).exec()
Example #9
0
    def multidispense_in_replicas(self, tip, reactive, vol):
        """ Multi-dispense of the content of ONE tip into the reactive replicas

        :param tip:
        :param reactive:
        :param vol:
        """
        assert isinstance(vol, list)
        re = reactive.Replicas
        assert len(vol) <= len(re)
        for v, w in zip(vol, re):                                 # zip continues until the shortest iterable is exhausted
            Itr.dispense(Rbt.tipMask[tip], self.robot.curArm().Tips[tip].origin.reactive.defLiqClass,
                         # reactive.defLiqClass,
                         v, w.labware.selectOnly([w.offset])).exec()
Example #10
0
def mix_reactive(reactive, LiqClass=None, cycles=3, maxTips=1, v_perc=90):
    assert isinstance(reactive, Rtv.Reactive)
    v_perc /= 100.0
    vol = []
    reactive.autoselect(maxTips)
    for tip, w in enumerate(reactive.labware.selected_wells()):
        v = w.vol * v_perc
        vm = Rbt.Robot.current.curArm().Tips[tip].type.maxVol * 0.9
        vol += [min(v, vm)]
    Itr.mix(Rbt.tipsMask[len(vol)],
            liquidClass=LiqClass,
            volume=vol,
            labware=reactive.labware,
            cycles=cycles).exec()
Example #11
0
    def aspire(self,  tip, reactive, vol=None, offset = None):
        """
        Aspire vol with ONE tip from reactive
        :param self:
        :param tip:
        :param reactive:
        :param vol:
        """
        if vol is None:       vol = reactive.minVol()    # todo: revise !!

        v = [0] * self.robot.curArm().nTips
        v[tip] = vol
        reactive.autoselect(offset = offset)                                         # reactive.labware.selectOnly([reactive.pos])
        Itr.aspirate(Rbt.tipMask[tip], reactive.defLiqClass, v, reactive.labware).exec()
Example #12
0
def aspire(tip, reactive, vol=None):
    """
    Aspire vol with ONE tip from reactive
    :param self:
    :param tip:
    :param reactive:
    :param vol:
    """
    if vol is None:
        vol = reactive.minVol()
    v = [0] * Rbt.Robot.current.curArm().nTips
    v[tip] = vol
    reactive.autoselect()  # reactive.labware.selectOnly([reactive.pos])
    Itr.aspirate(Rbt.tipMask[tip], reactive.defLiqClass, v,
                 reactive.labware).exec()
Example #13
0
def multidispense_in_replicas(tip, reactive, vol):
    """ Multi-dispense of the content of ONE tip into the reactive replicas

    :param tip:
    :param reactive:
    :param vol:
    """
    assert isinstance(vol, list)
    re = reactive.Replicas
    assert len(vol) == len(re)
    for v, w in zip(vol, re):
        Itr.dispense(
            Rbt.tipMask[tip],
            Rbt.Robot.current.curArm().Tips[tip].origin.reactive.defLiqClass,
            # reactive.defLiqClass,
            v,
            w.labware.selectOnly([w.offset])).exec()
Example #14
0
    def dropTips(self, TIP_MASK=-1):

        if self.robot.preservetips:
            where = self.robot.where_preserve_tips(TIP_MASK)
            nTips = self.robot.curArm().nTips
            for tip_rack in where:
                tipsMask = 0
                l = len(tip_rack.selected())
                for i in range(nTips):
                    if not l: break
                    b = (1 << i)
                    if TIP_MASK & b:
                        tipsMask |= b
                        TIP_MASK ^= b
                        l -= 1
                Itr.set_DITIs_Back(tipsMask, tip_rack).exec()
            assert l == 0
            return
        #if not Rbt.Robot.current.droptips: return 0
        #TIP_MASK = Rbt.Robot.current.curArm().drop(TIP_MASK)
        #if TIP_MASK:# todo is this a correct solution or it is best to do a double check? To force drop?
        Itr.dropDITI(TIP_MASK).exec()
Example #15
0
def aspiremultiTips(tips, reactive, vol=None):
    if not isinstance(vol, list):
        vol = [vol] * tips
    mask = Rbt.tipsMask[tips]
    nTip = reactive.autoselect(tips)
    asp = Itr.aspirate(mask, reactive.defLiqClass, vol, reactive.labware)
    curTip = 0
    while curTip < tips:
        nextTip = curTip + nTip
        nextTip = nextTip if nextTip <= tips else tips
        mask = Rbt.tipsMask[curTip] ^ Rbt.tipsMask[nextTip]
        #Rbt.Robot.current.curArm().aspire(vol, mask)
        asp.tipMask = mask
        asp.exec()
        curTip = nextTip
Example #16
0
def dropTips(TIP_MASK=-1):

    robot = Rbt.Robot.current
    assert isinstance(robot, Rbt.Robot)
    if robot.preservetips:
        where = robot.where_preserve_tips(TIP_MASK)
        nTips = robot.curArm().nTips
        for tip_rack in where:
            tipsMask = 0
            l = len(tip_rack.selected())
            for i in range(nTips):
                if not l: break
                b = (1 << i)
                if TIP_MASK & b:
                    tipsMask |= b
                    TIP_MASK ^= b
                    l -= 1
            Itr.set_DITIs_Back(tipsMask, tip_rack).exec()
        assert l == 0
        return
    #if not Rbt.Robot.current.droptips: return 0
    #TIP_MASK = Rbt.Robot.current.curArm().drop(TIP_MASK)
    #if TIP_MASK:# todo is this a correct solution or it is best to do a double check? To force drop?
    Itr.dropDITI(TIP_MASK).exec()
Example #17
0
    def aspiremultiTips(self,  tips, reactive, vol=None, LiqClass=None):
            if not isinstance(vol, list):
                vol = [vol] * tips
            LiqClass = LiqClass or reactive.defLiqClass

            mask = Rbt.tipsMask[tips]
            nTip = reactive.autoselect(tips)
            asp = Itr.aspirate(mask, LiqClass, vol, reactive.labware)
            curTip = 0
            while curTip < tips:
                nextTip = curTip + nTip
                nextTip = nextTip if nextTip <= tips else tips
                mask = Rbt.tipsMask[curTip] ^ Rbt.tipsMask[nextTip]
                                                                     #Rbt.Robot.current.curArm().aspire(vol, mask)  ???
                asp.tipMask = mask
                asp.exec()
                curTip = nextTip
Example #18
0
def group(titel, mode=None):
    Itr.group(titel).exec(mode)
    yield
    Itr.group_end().exec(mode)
Example #19
0
    def waste(self,  from_labware_region=None, using_liquid_class=None, volume=None, to_waste_labware=None, optimize=True):

        """

        :param from_labware_region:
        :param using_liquid_class:
        :param volume:
        :param to_waste_labware:
        :param optimize:
        :return:
        """
        to_waste_labware = to_waste_labware or self.worktable.def_WashWaste
        assert isinstance(from_labware_region, Lab.Labware), 'A Labware expected in from_labware_region to transfer'
        if not volume or volume< 0.0 : volume = 0.0
        assert isinstance(volume, (int, float))
        oriSel = from_labware_region.selected()
        nt = self.robot.curArm().nTips  # the number of tips to be used in each cycle of pippeting
        if not oriSel:
            oriSel = range(Rtv.NumOfSamples)
        if optimize:
            oriSel = from_labware_region.parallelOrder(nt, oriSel)
        NumSamples = len(oriSel)
        SampleCnt = NumSamples

        if nt > SampleCnt:
            nt = SampleCnt
        tm = Rbt.tipsMask[nt]
        nt = to_waste_labware.autoselect(maxTips=nt)
        mV = self.worktable.def_DiTi.maxVol      # todo revise !! What tip tp use !

        Rest = 50  # the volume we cannot more aspire with liquid detection, to small, collisions
        RestPlus = 50
        CtrVol = 0.5

        if volume:
            v = volume
        else:
            v = from_labware_region.Wells[oriSel[0]].vol

        Asp = Itr.aspirate(tm, Te_Mag_LC, volume, from_labware_region)
        # Asp = Itr.aspirate(tm, using_liquid_class[0], volume, from_labware_region)
        Dst = Itr.dispense(tm, using_liquid_class, volume, to_waste_labware)
        # Ctr = Itr.moveLiha(Itr.moveLiha.y_move, Itr.moveLiha.z_start, 3.0, 2.0, tm, from_labware_region)

        lf = from_labware_region
        msg = "Waste: {v:.1f} µL of {n:s}".format(v=v, n=lf.label)
        with group(msg):
            msg += " [grid:{fg:d} site:{fs:d}] in order:".format(fg=lf.location.grid, fs=lf.location.site+1) \
                                     + str([i+1 for i in oriSel])
            Itr.comment(msg).exec()
            while SampleCnt:
                curSample = NumSamples - SampleCnt
                if nt > SampleCnt:
                    nt = SampleCnt
                    tm = Rbt.tipsMask[nt]
                    Asp.tipMask = tm
                    Dst.tipMask = tm

                sel = oriSel[curSample:curSample + nt]
                spl = range(curSample, curSample + nt)
                Asp.labware.selectOnly(sel)

                if volume:
                    r = volume   # r: Waste_available yet; volume: to be Waste
                else:
                    vols = [w.vol for w in Asp.labware.selected_wells()]
                    r_min, r_max = min(vols), max(vols)
                    assert r_min == r_max
                    r = r_max

                if not using_liquid_class:
                        if sel:
                            Dst.liquidClass = Asp.labware.selected_wells()[0].reactive.defLiqClass

                with self.tips(tm, drop=True, preserve=False, selected_samples=spl):
                    while r > Rest:      # dont aspire Rest with these Liq Class (Liq Detect)
                        dV = r if r < mV else mV
                        if dV < Rest: break # ??
                        dV -= Rest       # the last Rest uL have to be aspired with the other Liq Class
                        Asp.volume = dV  #  with Liq Class with Detect: ">> AVR-Serum 1000 <<	365"
                        Dst.volume = dV
                        Asp.liquidClass = Te_Mag_LC # ">> AVR-Serum 1000 <<	365"  # "No Liq Detect"
                        Asp.exec()
                        Asp.volume = CtrVol
                        Asp.liquidClass = Te_Mag_Centre


                        with self.tips(allow_air=CtrVol):
                            Asp.exec()
                            if dV + Rest + RestPlus + 2*CtrVol > mV:
                                Dst.exec()
                                r -= dV
                                Dst.volume = 0
                            else:
                                break

                    Asp.volume = Rest
                    Asp.liquidClass =  Te_Mag_Rest # ">> AVR-Serum 1000 <<	367" # "No Liq Detect"
                    with self.tips(allow_air=Rest):
                            Asp.exec()
                    Asp.volume = CtrVol
                    Asp.liquidClass = Te_Mag_Force_Centre
                    with self.tips(allow_air=CtrVol):
                            Asp.exec()
                    Asp.volume = RestPlus
                    Asp.liquidClass =  Te_Mag_RestPlus # ">> AVR-Serum 1000 <<	369" # "No Liq Detect"
                    with self.tips(allow_air=RestPlus):
                            Asp.exec()
                    #Ctr.exec()
                    Asp.volume = CtrVol
                    Asp.liquidClass = Te_Mag_Force_Centre
                    Dst.volume += Rest + RestPlus
                    with self.tips(allow_air=CtrVol):
                            Asp.exec()
                    with self.tips(allow_air=Rest + RestPlus):
                            Dst.exec()

                SampleCnt -= nt
            Asp.labware.selectOnly(oriSel)
        Itr.wash_tips(wasteVol=4).exec()
        return oriSel
Example #20
0
    def mix(self,  in_labware_region, using_liquid_class=None, volume=None, optimize=True):

        """
        Mix each of the reactive in the selected region of the labware
        :param in_labware_region:
        :param using_liquid_class:
        :param volume:
        :param optimize:
        :return:
        """
        mix_p = 0.9
        in_labware_region = in_labware_region or self.worktable.def_WashWaste    # todo ???????????
        assert isinstance(in_labware_region, Lab.Labware), 'A Labware expected in in_labware_region to be mixed'
        if not volume or volume< 0.0 : volume = 0.0
        assert isinstance(volume, (int, float))
        oriSel = in_labware_region.selected()
        nt = self.robot.curArm().nTips  # the number of tips to be used in each cycle of pippeting
        if not oriSel:
            oriSel = range(Rtv.NumOfSamples)
        if optimize:
            oriSel = in_labware_region.parallelOrder( nt, oriSel)
        NumSamples = len(oriSel)
        SampleCnt = NumSamples
        if nt > SampleCnt:
            nt = SampleCnt
        # mV = Rbt.Robot.current.curArm().Tips[0].type.maxVol * 0.8
        mV = self.worktable.def_DiTi.maxVol * mix_p    # What tip tp use !
        if volume:
            v = volume
        else:
            v = in_labware_region.Wells[oriSel[0]].vol
        v = v * mix_p
        v = v if v < mV else mV

        lf = in_labware_region
        mx = Itr.mix(Rbt.tipsMask[nt], using_liquid_class, volume, in_labware_region)
        msg = "Mix: {v:.1f} µL of {n:s}".format(v=v, n=lf.label)
        with group(msg):
            msg += " [grid:{fg:d} site:{fs:d}] in order:".format(fg=lf.location.grid, fs=lf.location.site+1) \
                                        + str([i+1 for i in oriSel])
            Itr.comment(msg).exec()
            while SampleCnt:
                curSample = NumSamples - SampleCnt
                if nt > SampleCnt:
                    nt = SampleCnt
                    mx.tipMask = Rbt.tipsMask[nt]

                sel = oriSel[curSample:curSample + nt]
                spl = range(curSample, curSample + nt)
                with self.tips(Rbt.tipsMask[nt], selected_samples=spl):
                    mV = self.robot.curArm().Tips[0].type.maxVol * mix_p
                    mx.labware.selectOnly(sel)
                    if not using_liquid_class:
                        if sel:
                            mx.liquidClass = mx.labware.selected_wells()[0].reactive.defLiqClass
                    if volume:
                        r = volume   # r: Waste_available yet; volume: to be Waste
                    else:
                        vols = [w.vol for w in mx.labware.selected_wells()]
                        r_min, r_max = min(vols), max(vols)
                        assert r_min == r_max
                        r = r_max
                    r = r * mix_p
                    r = r if r < mV else mV
                    mx.volume = r
                    mx.exec()
                SampleCnt -= nt
        mx.labware.selectOnly(oriSel)
        return oriSel
Example #21
0
    def spread(self,  volume            =None,
                      reactive          =None,
                      to_labware_region =None,
                      optimize          =True,
                      NumSamples        =None,
                      using_liquid_class=None,
                      TIP_MASK          =None,
                      num_tips          =None):
            """
            :param NumSamples: Priorized   !!!! If true reset the selection
            :param reactive: Reagent to spread
            :param to_labware_region: Labware in which the destine well are selected
            :param volume: if not, volume is set from the default of the source reactive
            :param optimize: minimize zigzag of multi pipetting
            """
            assert isinstance(reactive, Rtv.Reagent), 'A Reagent expected in reactive to spread'
            assert isinstance(to_labware_region, Lab.Labware), 'A Labware expected in to_labware_region to spread'

            if num_tips is None:
                num_tips = self.robot.curArm().nTips  # the number of tips to be used in each cycle of pipetting = all

            if NumSamples:
                to_labware_region.selectOnly(range(NumSamples))
            else:
                if not to_labware_region.selected():
                    to_labware_region.selectOnly(range(self.NumOfSamples))

            to = to_labware_region.selected()        # list of offset of selected wells
            if optimize: to = to_labware_region.parallelOrder(num_tips, to)
            NumSamples = len(to)
            SampleCnt = NumSamples

            volume = volume or reactive.volpersample

            Asp_liquidClass, Dst_liquidClass = (reactive.defLiqClass, reactive.defLiqClass) if using_liquid_class is None else \
                                               (using_liquid_class[0] or reactive.defLiqClass, using_liquid_class[1] or reactive.defLiqClass)


            lf = reactive.labware
            lt = to_labware_region
            msg = "Spread: {v:.1f} µL of {n:s}".format(v=volume, n=reactive.name)
            with group(msg):
                msg += " ({v:.1f} µL total) from [grid:{fg:d} site:{fs:d} {fw:s} into {to:s}[grid:{tg:d} site:{ts:d}] in order {do:s}:" \
                            .format( v  = reactive.minVol(),
                                     fg = lf.location.grid,
                                     fs = lf.location.site+1,
                                     fw = str([str(well) for well in reactive.Replicas]) ,
                                     do = str([i+1 for i in to]),
                                     to = lt.label,
                                     tg = lt.location.grid,
                                     ts = lt.location.site+1)
                Itr.comment(msg).exec()
                availableDisp = 0
                while SampleCnt:
                    if num_tips > SampleCnt: num_tips = SampleCnt
                    with self.tips(Rbt.tipsMask[num_tips], usePreserved=False, preserve=False):  # OK want to use preserved ?? selected=??
                        maxMultiDisp_N = self.robot.curArm().Tips[0].type.maxVol // volume  # assume all tips equal
                        dsp, rst = divmod(SampleCnt, num_tips)
                        if dsp >= maxMultiDisp_N:
                            dsp = maxMultiDisp_N
                            vol = [volume * dsp] * num_tips
                            availableDisp = dsp
                        else:
                            vol = [volume * (dsp + 1)] * rst + [volume * dsp] * (num_tips - rst)
                            availableDisp = dsp + bool(rst)

                        self.aspiremultiTips(num_tips, reactive, vol, LiqClass=Asp_liquidClass)

                        while availableDisp:
                            if num_tips > SampleCnt: num_tips = SampleCnt
                            curSample = NumSamples - SampleCnt
                            sel = to[curSample: curSample + num_tips]  # todo what if volume > maxVol_tip ?
                            self.dispensemultiwells(num_tips, Dst_liquidClass, to_labware_region.selectOnly(sel), [volume] * num_tips)
                            availableDisp -= 1
                            SampleCnt -= num_tips
Example #22
0
    def transfer(self,  from_labware_region, to_labware_region, volume, using_liquid_class=None,
                     optimizeFrom=True, optimizeTo=True, NumSamples=None):
            """


            :param NumSamples: Priorized   !!!! If true reset the selection
            :param from_reactive: Reagent to spread
            :param to_labware_region: Labware in which the destine well are selected
            :param volume: if not, volume is set from the default of the source reactive
            :param optimize: minimize zigzag of multipippeting
            """
            assert isinstance(from_labware_region, Lab.Labware), 'A Labware expected in from_labware_region to transfer'
            assert isinstance(to_labware_region, Lab.Labware), 'A Labware expected in to_labware_region to transfer'
            # assert isinstance(using_liquid_class, tuple)
            nt = self.robot.curArm().nTips  # the number of tips to be used in each cycle of pippeting

            if NumSamples:  # OK?  select convenient def
                oriSel = range(NumSamples)
                dstSel = range(NumSamples)
            else:
                oriSel = to_labware_region.selected()
                dstSel = from_labware_region.selected()

                if not dstSel:
                    if not oriSel:
                        oriSel = range(Rtv.NumOfSamples)
                        dstSel = range(Rtv.NumOfSamples)
                    else:
                        dstSel = oriSel
                else:
                    if not oriSel:
                        oriSel = dstSel
                    else:
                        l = min(len(oriSel), len(dstSel))  # todo transfer the minimun of the selected ???? Best reise error
                        oriSel = oriSel[:l]
                        dstSel = dstSel[:l]
            if optimizeFrom: oriSel = from_labware_region.parallelOrder(nt, oriSel)
            if optimizeTo: dstSel = to_labware_region.parallelOrder(nt, dstSel)

            NumSamples = len(dstSel)
            SampleCnt = NumSamples

            assert isinstance(volume, (int, float))
            if nt > SampleCnt: nt = SampleCnt
            lf = from_labware_region
            lt = to_labware_region
            Asp = Itr.aspirate(Rbt.tipsMask[nt], volume=volume, labware=from_labware_region)
            Dst = Itr.dispense(Rbt.tipsMask[nt], volume=volume, labware=to_labware_region)
            msg = "Transfer: {v:.1f} µL of {n:s}".format(v=volume, n=lf.label)
            with group(msg):
                msg += " [grid:{fg:d} site:{fs:d}] in order {oo:s} into {to:s}[grid:{tg:d} site:{ts:d}] in order {do:s}:" \
                    .format(fg =lf.location.grid,
                            fs =lf.location.site+1,
                            oo =str([i+1 for i in oriSel]),
                            do =str([i+1 for i in dstSel]),
                            to =lt.label,
                            tg =lt.location.grid,
                            ts =lt.location.site+1)
                Itr.comment(msg).exec()
                while SampleCnt:
                    curSample = NumSamples - SampleCnt
                    if nt > SampleCnt:
                        nt = SampleCnt
                        Asp.tipMask = Rbt.tipsMask[nt]
                        Dst.tipMask = Rbt.tipsMask[nt]

                    src = oriSel[curSample:curSample + nt]
                    trg = dstSel[curSample:curSample + nt]
                    spl = range(curSample, curSample + nt)

                    sw = Asp.labware.selected_wells()

                    if isinstance(using_liquid_class, tuple):
                        if using_liquid_class[0]:
                            Asp.liquidClass = using_liquid_class[0]
                        else:
                            Asp.liquidClass = sw[0].reactive.defLiqClass
                        if using_liquid_class[1]:
                            Dst.liquidClass = using_liquid_class[1]
                        else:
                            Dst.liquidClass = sw[0].reactive.defLiqClass
                    else:
                        Asp.liquidClass = sw[0].reactive.defLiqClass
                        Dst.liquidClass = sw[0].reactive.defLiqClass

                    with self.tips(Rbt.tipsMask[nt], selected_samples=spl):  # todo what if volume > maxVol_tip ?
                        Asp.labware.selectOnly(src)
                        Asp.exec()
                        Dst.labware.selectOnly(trg)
                        Dst.exec()
                        for s, d in zip(Asp.labware.selected_wells(), Dst.labware.selected_wells()):
                            d.track = s.track
                    SampleCnt -= nt
            Asp.labware.selectOnly(oriSel)
            Dst.labware.selectOnly(dstSel)
            return oriSel, dstSel
    def Run(self):
        self.set_EvoMode()
        self.initialize()
        Rtv.NumOfSamples = self.NumOfSamples
        NumOfSamples = self.NumOfSamples
        wt           = self.worktable

        Itr.comment('Prefill {:d} plates with LysisBufferReact for {:d} samples.'\
                       .format(self.num_plates,
                               NumOfSamples     )).exec()

        # Get Labwares (Cuvette, eppys, etc.) from the work table
        LysBufCuvette = wt.getLabware(Lab.Trough_100ml, "2-Vl Lysis Buffer")

        DiTi1000_1  = wt.getLabware(Lab.DiTi_1000ul,    "1000-1")
        DiTi1000_2  = wt.getLabware(Lab.DiTi_1000ul,    "1000-2")
        DiTi1000_3  = wt.getLabware(Lab.DiTi_1000ul,    "1000-3")


        self.go_first_pos()                      #  Set the initial position of the tips

        # Set volumen / sample
        LysisBufferVolume   = 100.0       # VL1 or VL

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

        # Define the reactives in each labware (Cuvette, eppys, etc.)

        LysisBufferReact = Rtv.Reagent("VL - Lysis Buffer ",
                                       LysBufCuvette,
                                       volpersample = LysisBufferVolume,
                                       defLiqClass  = 'MN VL',
                                       num_of_samples= self.num_plates * NumOfSamples)

        # Show the CheckList GUI to the user for possible small changes

        self.CheckList()
        self.set_EvoMode()

        Itr.wash_tips(wasteVol=5, FastWash=True).exec()

        LysPlat = [wt.getLabware(Lab.MP96deepwell, "Plate lysis-"+str(i+1)) for i in range(self.num_plates)]

        par = LysPlat[0].parallelOrder(self.nTips, all_samples)

        # Define place for temporal reactions
        for i, LP in enumerate(LysPlat):
            for s in all_samples:
                Rtv.Reagent("lysis_{:d}-{:02d}".format(i + 1, s + 1),
                            LP,
                            initial_vol =0.0,
                            pos         =s + 1,
                            excess      =0)

        with group("Prefill plates with LysisBufferReact"):

            Itr.userPrompt("Put the plates for LysisBufferReact").exec()

            for LP in LysPlat:
                with self.tips(reuse=True, drop=False):
                    self.spread(reactive=LysisBufferReact, to_labware_region=LP.selectOnly(all_samples))
                self.dropTips()

        self.done()
Example #24
0
 def go_first_pos(self):
     if self.firstTip:
         rack, firstTip = self.worktable.get_first_pos(posstr=self.firstTip)
         Itr.set_DITI_Counter2(labware=rack, posInRack=firstTip).exec()
Example #25
0
def parallel_execution_of(subroutine, repeat=1):
    # todo improve this idea: execute repeatably one after other and only at end wait.
    # for rep in range(repeat):
    if repeat == 1:
        Itr.subroutine(subroutine, Itr.subroutine.Continues).exec()
        yield
        Itr.subroutine(subroutine, Itr.subroutine.Waits_previous).exec()
    else:
        # rep_sub = br"C:\Prog\robotevo\EvoScriPy\repeat_subroutine.esc" .decode(EvoMode.Mode.encoding)
        Itr.variable("repetitions",
                     repeat,
                     queryString="How many time repeat the subroutine?",
                     type=Itr.variable.Numeric).exec()
        Itr.variable("subroutine",
                     subroutine,
                     queryString="The subroutine path",
                     type=Itr.variable.String).exec()
        Itr.subroutine(Rbt.rep_sub, Itr.subroutine.Continues).exec()
        yield
        Itr.subroutine(Rbt.rep_sub, Itr.subroutine.Waits_previous).exec()
    def Run(self):
        self.set_EvoMode()
        self.initialize()                       # set_defaults ??
        Rtv.NumOfSamples = self.NumOfSamples
        NumOfSamples = self.NumOfSamples
        wt           = self.worktable

        Itr.comment('Prefill plates with VEW1, Elution buffer and VEW2 for {:s} samples.'.format(str(NumOfSamples))).exec()


        # Get Labwares (Cuvette, eppys, etc.) from the work table

        ElutBuf     = wt.getLabware(Lab.Trough_100ml,   "1-VEL-ElutionBuffer"   )

        DiTi1000_1  = wt.getLabware(Lab.DiTi_1000ul,    "1000-1")
        DiTi1000_2  = wt.getLabware(Lab.DiTi_1000ul,    "1000-2")
        DiTi1000_3  = wt.getLabware(Lab.DiTi_1000ul,    "1000-3")

        Plate_VEW1  = wt.getLabware(Lab.MP96deepwell,   "Plate VEW1"    )  # Plate 12 x 8 ?
        Plate_VEW2  = wt.getLabware(Lab.MP96deepwell,   "Plate VEW2"    )  # Plate 12 x 8 ?
        Plate_Eluat = wt.getLabware(Lab.MP96well,       "Plate ElutB"   )  # Plate 12 x 8 ? MP96well !!


        #  Set the initial position of the tips

        self.go_first_pos()

        # Set volumen / sample

        VEW1Volume          = 600.0
        VEW2Volume          = 600.0
        ElutionBufferVolume = 100.0


        # Liquid classes used for pippetting. Others liquidClass names are defined in "protocol_steps.py"

        # SampleLiqClass = "Serum Asp"  # = TissueHomLiqClass   # SerumLiqClass="Serum Asp preMix3"


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


        # Define the reactives in each labware (Cuvette, eppys, etc.)

        VEW1            = Rtv.Reagent("VEW1 - Wash Buffer ",
                                      wt.getLabware(Lab.Trough_100ml, "4-VEW1 Wash Buffe"),
                                      volpersample  = VEW1Volume,
                                      defLiqClass   = B_liquidClass)

        VEW2            = Rtv.Reagent("VEW2 - WashBuffer ",
                                      wt.getLabware(Lab.Trough_100ml,  "5-VEW2-WashBuffer" ),
                                      volpersample  =VEW2Volume,
                                      defLiqClass   =B_liquidClass)

        ElutionBuffer   = Rtv.Reagent("Elution Buffer ",
                                      ElutBuf,
                                      volpersample  =ElutionBufferVolume,
                                      defLiqClass   =B_liquidClass)

        # Show the CheckList GUI to the user for posible small changes

        self.CheckList()
        self.set_EvoMode()

        Itr.wash_tips(wasteVol=30, FastWash=True).exec()

        par = Plate_VEW1.parallelOrder(self.nTips, all_samples)

        # Define samples and the place for temporal reactions
        for s in all_samples:
            Rtv.Reagent("VEW1_{:02d}".format(s + 1),
                        Plate_VEW1,
                        initial_vol  = 0.0,
                        pos          = par[s]+1,
                        excess       = 0)  # todo revise order !!!

            Rtv.Reagent("VEW2_{:02d}".format(s + 1),
                        Plate_VEW2,
                        initial_vol = 0.0,
                        pos         = par[s] + 1,
                        excess      = 0)

            Rtv.Reagent("Eluat_{:02d}".format(s + 1),
                        Plate_Eluat,
                        initial_vol = 0.0,
                        pos         = par[s] + 1,
                        excess      = 0)


        with group("Prefill plates with VEW1, Elution buffer and VEW2"):

            Itr.userPrompt("Put the plates for VEW1, Elution buffer and VEW2 in that order").exec()

            with self.tips(reuse=True, drop=False):
                self.spread(reactive=ElutionBuffer, to_labware_region=Plate_Eluat.selectOnly(all_samples) )  # ,optimize=False

            with self.tips(reuse=True, drop=False):
                self.spread(reactive=VEW2, to_labware_region=Plate_VEW2.selectOnly(all_samples) )  # , optimize=False

            with self.tips(reuse=True, drop=False):
                self.spread(reactive=VEW1, to_labware_region=Plate_VEW1.selectOnly(all_samples))  # , optimize=False

        self.dropTips()

        self.done()
Example #27
0
def transfer(from_labware_region,
             to_labware_region,
             volume,
             using_liquid_class=None,
             optimizeFrom=True,
             optimizeTo=True,
             NumSamples=None):
    """


        :param NumSamples: Priorized   !!!! If true reset the selection
        :param from_reactive: Reactive to spread
        :param to_labware_region: Labware in which the destine well are selected
        :param volume: if not, volume is set from the default of the source reactive
        :param optimize: minimize zigzag of multipippeting
        """
    assert isinstance(
        from_labware_region,
        Lab.Labware), 'A Labware expected in from_labware_region to transfer'
    assert isinstance(
        to_labware_region,
        Lab.Labware), 'A Labware expected in to_labware_region to transfer'
    # assert isinstance(using_liquid_class, tuple)
    nt = Rbt.Robot.current.curArm(
    ).nTips  # the number of tips to be used in each cycle of pippeting

    if NumSamples:  # OK?  select convenient def
        oriSel = range(NumSamples)
        dstSel = range(NumSamples)
    else:
        oriSel = to_labware_region.selected()
        dstSel = from_labware_region.selected()

        if not dstSel:
            if not oriSel:
                oriSel = range(Rtv.NumOfSamples)
                dstSel = range(Rtv.NumOfSamples)
            else:
                dstSel = oriSel
        else:
            if not oriSel:
                oriSel = dstSel
            else:
                l = min(
                    len(oriSel), len(dstSel)
                )  # todo transfer the minimun of the selected ???? Best reise error
                oriSel = oriSel[:l]
                dstSel = dstSel[:l]
    if optimizeFrom: oriSel = from_labware_region.parallelOrder(nt, oriSel)
    if optimizeTo: dstSel = to_labware_region.parallelOrder(nt, dstSel)

    NumSamples = len(dstSel)
    SampleCnt = NumSamples

    assert isinstance(volume, (int, float))
    if nt > SampleCnt: nt = SampleCnt
    lf = from_labware_region
    lt = to_labware_region
    Asp = Itr.aspirate(Rbt.tipsMask[nt],
                       volume=volume,
                       labware=from_labware_region)
    Dst = Itr.dispense(Rbt.tipsMask[nt],
                       volume=volume,
                       labware=to_labware_region)
    msg = "Transfer: {v:.1f} µL of {n:s}".format(v=volume, n=lf.label)
    with group(msg):
        msg += " [grid:{fg:d} site:{fs:d}] in order {oo:s} into {to:s}[grid:{tg:d} site:{ts:d}] in order {do:s}:" \
            .format(fg=lf.location.grid, fs=lf.location.site+1, oo=str([i+1 for i in oriSel]),
                    do=str([i+1 for i in dstSel]),  to=lt.label, tg=lt.location.grid, ts=lt.location.site+1)
        Itr.comment(msg).exec()
        while SampleCnt:
            curSample = NumSamples - SampleCnt
            if nt > SampleCnt:
                nt = SampleCnt
                Asp.tipMask = Rbt.tipsMask[nt]
                Dst.tipMask = Rbt.tipsMask[nt]

            src = oriSel[curSample:curSample + nt]
            trg = dstSel[curSample:curSample + nt]
            spl = range(curSample, curSample + nt)

            sw = Asp.labware.selected_wells()

            if isinstance(using_liquid_class, tuple):
                if using_liquid_class[0]:
                    Asp.liquidClass = using_liquid_class[0]
                else:
                    Asp.liquidClass = sw[0].reactive.defLiqClass
                if using_liquid_class[1]:
                    Dst.liquidClass = using_liquid_class[1]
                else:
                    Dst.liquidClass = sw[0].reactive.defLiqClass
            else:
                Asp.liquidClass = sw[0].reactive.defLiqClass
                Dst.liquidClass = sw[0].reactive.defLiqClass

            with tips(Rbt.tipsMask[nt], selected_samples=spl
                      ):  # todo what if volume > maxVol_tip ?
                Asp.labware.selectOnly(src)
                Asp.exec()
                Dst.labware.selectOnly(trg)
                Dst.exec()
                for s, d in zip(Asp.labware.selected_wells(),
                                Dst.labware.selected_wells()):
                    d.track = s.track
            SampleCnt -= nt
    Asp.labware.selectOnly(oriSel)
    Dst.labware.selectOnly(dstSel)
    return oriSel, dstSel
Example #28
0
def spread(volume=None,
           reactive=None,
           to_labware_region=None,
           optimize=True,
           NumSamples=None):
    """


        :param NumSamples: Priorized   !!!! If true reset the selection
        :param reactive: Reactive to spread
        :param to_labware_region: Labware in which the destine well are selected
        :param volume: if not, volume is set from the default of the source reactive
        :param optimize: minimize zigzag of multipippeting
        """
    assert isinstance(
        reactive, Rtv.Reactive), 'A Reactive expected in reactive to spread'
    assert isinstance(
        to_labware_region,
        Lab.Labware), 'A Labware expected in to_labware_region to spread'
    nt = Rbt.Robot.current.curArm(
    ).nTips  # the number of tips to be used in each cycle of pippeting

    if NumSamples:
        to_labware_region.selectOnly(range(NumSamples))
    else:
        if not to_labware_region.selected():
            to_labware_region.selectOnly(range(Rtv.NumOfSamples))

    to = to_labware_region.selected()
    if optimize: to = to_labware_region.parallelOrder(nt, to)
    NumSamples = len(to)
    SampleCnt = NumSamples

    volume = volume or reactive.volpersample

    if nt > SampleCnt: nt = SampleCnt

    lf = reactive.labware
    lt = to_labware_region
    msg = "Spread: {v:.1f} µL of {n:s}".format(v=volume, n=reactive.name)
    with group(msg):
        msg += " {v:.1f} µL total from [grid:{fg:d} site:{fs:d} well:{fw:d}] into {to:s}[grid:{tg:d} site:{ts:d}] in order {do:s}:" \
            .format(v=reactive.minVol(), fg=lf.location.grid, fs=lf.location.site+1, fw=reactive.pos+1, do=str([i+1 for i in to]),
                    to=lt.label, tg=lt.location.grid, ts=lt.location.site+1)
        Itr.comment(msg).exec()
        availableDisp = 0
        while SampleCnt:
            if nt > SampleCnt: nt = SampleCnt
            with tips(
                    Rbt.tipsMask[nt], usePreserved=False,
                    preserve=False):  # OK want to use preserved ?? selected=??
                maxMultiDisp_N = Rbt.Robot.current.curArm(
                ).Tips[0].type.maxVol // volume  # assume all tips equal
                dsp, rst = divmod(SampleCnt, nt)
                if dsp >= maxMultiDisp_N:
                    dsp = maxMultiDisp_N
                    vol = [volume * dsp] * nt
                    availableDisp = dsp
                else:
                    vol = [volume *
                           (dsp + 1)] * rst + [volume * dsp] * (nt - rst)
                    availableDisp = dsp + bool(rst)

                aspiremultiTips(nt, reactive, vol)

                while availableDisp:
                    if nt > SampleCnt: nt = SampleCnt
                    curSample = NumSamples - SampleCnt
                    sel = to[curSample:curSample +
                             nt]  # todo what if volume > maxVol_tip ?
                    dispensemultiwells(nt, reactive.defLiqClass,
                                       to_labware_region.selectOnly(sel),
                                       [volume] * nt)
                    availableDisp -= 1
                    SampleCnt -= nt
Example #29
0
def waste(from_labware_region=None,
          using_liquid_class=None,
          volume=None,
          to_waste_labware=None,
          optimize=True):
    """

    :param from_labware_region:
    :param using_liquid_class:
    :param volume:
    :param to_waste_labware:
    :param optimize:
    :return:
    """
    to_waste_labware = to_waste_labware or Lab.def_WashWaste
    assert isinstance(
        from_labware_region,
        Lab.Labware), 'A Labware expected in from_labware_region to transfer'
    if not volume or volume < 0.0: volume = 0.0
    assert isinstance(volume, (int, float))
    oriSel = from_labware_region.selected()
    nt = Rbt.Robot.current.curArm(
    ).nTips  # the number of tips to be used in each cycle of pippeting
    if not oriSel:
        oriSel = range(Rtv.NumOfSamples)
    if optimize:
        oriSel = from_labware_region.parallelOrder(nt, oriSel)
    NumSamples = len(oriSel)
    SampleCnt = NumSamples

    if nt > SampleCnt:
        nt = SampleCnt
    tm = Rbt.tipsMask[nt]
    nt = to_waste_labware.autoselect(maxTips=nt)
    mV = Lab.def_DiTi.maxVol  # todo revise !! What tip tp use !

    Rest = 50  # the volume we cannot more aspire with liquid detection, to small, collisions
    RestPlus = 50
    CtrVol = 0.5

    if volume:
        v = volume
    else:
        v = from_labware_region.Wells[oriSel[0]].vol

    Asp = Itr.aspirate(tm, Te_Mag_LC, volume, from_labware_region)
    # Asp = Itr.aspirate(tm, using_liquid_class[0], volume, from_labware_region)
    Dst = Itr.dispense(tm, using_liquid_class, volume, to_waste_labware)
    # Ctr = Itr.moveLiha(Itr.moveLiha.y_move, Itr.moveLiha.z_start, 3.0, 2.0, tm, from_labware_region)

    lf = from_labware_region
    msg = "Waste: {v:.1f} µL of {n:s}".format(v=v, n=lf.label)
    with group(msg):
        msg += " [grid:{fg:d} site:{fs:d}] in order:".format(fg=lf.location.grid, fs=lf.location.site+1) \
                                 + str([i+1 for i in oriSel])
        Itr.comment(msg).exec()
        while SampleCnt:
            curSample = NumSamples - SampleCnt
            if nt > SampleCnt:
                nt = SampleCnt
                tm = Rbt.tipsMask[nt]
                Asp.tipMask = tm
                Dst.tipMask = tm

            sel = oriSel[curSample:curSample + nt]
            spl = range(curSample, curSample + nt)
            Asp.labware.selectOnly(sel)

            if volume:
                r = volume  # r: Waste_available yet; volume: to be Waste
            else:
                vols = [w.vol for w in Asp.labware.selected_wells()]
                r_min, r_max = min(vols), max(vols)
                assert r_min == r_max
                r = r_max

            if not using_liquid_class:
                if sel:
                    Dst.liquidClass = Asp.labware.selected_wells(
                    )[0].reactive.defLiqClass

            with tips(tm, drop=True, preserve=False, selected_samples=spl):
                while r > Rest:  # dont aspire Rest with these Liq Class (Liq Detect)
                    dV = r if r < mV else mV
                    if dV < Rest: break  # ??
                    dV -= Rest  # the last Rest uL have to be aspired with the other Liq Class
                    Asp.volume = dV  #  with Liq Class with Detect: ">> AVR-Serum 1000 <<	365"
                    Dst.volume = dV
                    Asp.liquidClass = Te_Mag_LC  # ">> AVR-Serum 1000 <<	365"  # "No Liq Detect"
                    Asp.exec()
                    Asp.volume = CtrVol
                    Asp.liquidClass = Te_Mag_Centre

                    with tips(allow_air=CtrVol):
                        Asp.exec()
                        if dV + Rest + RestPlus + 2 * CtrVol > mV:
                            Dst.exec()
                            r -= dV
                            Dst.volume = 0
                        else:
                            break

                Asp.volume = Rest
                Asp.liquidClass = Te_Mag_Rest  # ">> AVR-Serum 1000 <<	367" # "No Liq Detect"
                with tips(allow_air=Rest):
                    Asp.exec()
                Asp.volume = CtrVol
                Asp.liquidClass = Te_Mag_Force_Centre
                with tips(allow_air=CtrVol):
                    Asp.exec()
                Asp.volume = RestPlus
                Asp.liquidClass = Te_Mag_RestPlus  # ">> AVR-Serum 1000 <<	369" # "No Liq Detect"
                with tips(allow_air=RestPlus):
                    Asp.exec()
                #Ctr.exec()
                Asp.volume = CtrVol
                Asp.liquidClass = Te_Mag_Force_Centre
                Dst.volume += Rest + RestPlus
                with tips(allow_air=CtrVol):
                    Asp.exec()
                with tips(allow_air=Rest + RestPlus):
                    Dst.exec()

            SampleCnt -= nt
        Asp.labware.selectOnly(oriSel)
    Itr.wash_tips(wasteVol=4).exec()
    return oriSel
    def Run(self):
        self.set_EvoMode()
        self.initialize()
        Rtv.NumOfSamples = self.NumOfSamples
        NumOfSamples = self.NumOfSamples
        wt           = self.worktable

        Itr.comment((self.version + 'for extracting RNA from {:s} samples with the MN-Vet kit').format(str(NumOfSamples))).exec()

                                                               # Get Labwares (Cuvette, eppys, etc.) from the work table

        if self.add_VL:
            LysBuf      = wt.getLabware(Lab.Trough_100ml,   "2-Vl Lysis Buffer"     )

        if self.do_extraction:
            BindBuf     = wt.getLabware(Lab.Trough_100ml,   "3-VEB Binding Buffer"  )
            ElutBuf     = wt.getLabware(Lab.Trough_100ml,   "1-VEL-ElutionBuffer"   )
            Eluat       = wt.getLabware(Lab.EppRack3x16R,    "Eluat")

        Samples     = wt.getLabware(Lab.EppRack3x16,     "Proben")
        Lysis       = Samples

        DiTi1000_1  = wt.getLabware(Lab.DiTi_1000ul,    "1000-1")
        DiTi1000_2  = wt.getLabware(Lab.DiTi_1000ul,    "1000-2")
        DiTi1000_3  = wt.getLabware(Lab.DiTi_1000ul,    "1000-3")

        Reactives   = wt.getLabware(Lab.GreinRack16_2mL, "Reactives" )

        if self.do_extraction:
            self.TeMg_Heat = wt.getLabware(Lab.TeMag48, "48 Pos Heat")
            self.TeMag     = wt.getLabware(Lab.TeMag48, "48PosMagnet")
            TeMag          = self.TeMag
            Lysis  =  TeMag

                                                               #  Set the initial position of the tips

        self.go_first_pos()

                                                               # Set volumen / sample

        SampleVolume        = 200.0
        LysisBufferVolume   = 180.0             # VL
        IC2Volume           = 4.0               # IC2
        BindingBufferVolume = 600.0             # VEB
        B_BeadsVolume       = 20.0              # B-Beads
        VEW1Volume          = 600.0             # VEW1
        VEW2Volume          = 600.0             # VEW2
        EtOH80pVolume       = 600.0
        ProtKVolume         = 20.0
        cRNAVolume          = 4.0
        IC_MS2Volume        = 20.0              # MS2
        ElutionBufferVolume = 100.0             # VEL

        InitLysisVol        = 0.0
        if self.do_extraction:
            if not self.add_samples:    InitLysisVol += SampleVolume
            if not self.add_preMix:     InitLysisVol += ProtKVolume + cRNAVolume + IC_MS2Volume
            if not self.add_VL:         InitLysisVol += LysisBufferVolume


        # Liquid classes used for pippetting.
                                                        # Others liquidClass names are defined in "protocol_steps.py"

        SampleLiqClass      = "Serum Asp"  # = TissueHomLiqClass   # SerumLiqClass="Serum Asp preMix3"

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

                                                        # Define the reactives in each labware (Cuvette, eppys, etc.)

        # IC2         = Rtv.Reagent("IC2 - synthetic RNA " ,  Reactives, pos=13, volpersample=  IC2Volume ,defLiqClass=W_liquidClass)

        if self.add_preMix:
            ProtK = Rtv.Reagent("Proteinase K ",
                                Reactives,
                                replicas=2,
                                pos=[15, 16],  # only 16 ?  pos=16
                                volpersample=ProtKVolume,
                                defLiqClass=Small_vol_disp)

            cRNA   = Rtv.Reagent("Carrier RNA ", Reactives, pos=14, volpersample=cRNAVolume, defLiqClass=Small_vol_disp)
            IC_MS2 = Rtv.Reagent("IC MS2 phage culture ", Reactives, pos=13, volpersample=IC_MS2Volume, defLiqClass=Small_vol_disp)

            pK_cRNA_MS2 = Rtv.preMix("ProtK+cRNA+IC-MS2 mix ",
                                     Reactives,
                                     pos=8,
                                     components=[cRNA, ProtK, IC_MS2],
                                     defLiqClass=W_liquidClass,
                                     excess=20)

        if self.add_VL:
            LysisBuffer = Rtv.Reagent("VL - Lysis Buffer ", LysBuf, volpersample=LysisBufferVolume, defLiqClass='MN VL')

        if self.do_extraction:
            B_Beads         = Rtv.Reagent("B - Beads ",
                                          Reactives,
                                          pos          = [1,2],
                                          initial_vol  = 1200,
                                          volpersample = B_BeadsVolume,
                                          defLiqClass  = Beads_LC_2,
                                          maxFull      = 70)

            BindingBuffer   = Rtv.Reagent("VEB - Binding Buffer ", BindBuf, volpersample=BindingBufferVolume, defLiqClass=B_liquidClass)

            VEW1            = Rtv.Reagent("VEW1 - Wash Buffer ",
                                          wt.getLabware(Lab.Trough_100ml, "4-VEW1 Wash Buffe"),
                                          volpersample  = VEW1Volume,
                                          defLiqClass   = B_liquidClass)

            VEW2            = Rtv.Reagent("VEW2 - WashBuffer ",
                                          wt.getLabware(Lab.Trough_100ml,  "5-VEW2-WashBuffer" ),
                                          volpersample  =VEW2Volume,
                                          defLiqClass   =B_liquidClass)

            EtOH80p         = Rtv.Reagent("Ethanol 80% ",
                                          Lab.getLabware(Lab.Trough_100ml,  "7-EtOH80p"     ),
                                          volpersample=EtOH80pVolume, defLiqClass=B_liquidClass)

            ElutionBuffer   = Rtv.Reagent("Elution Buffer ",
                                          ElutBuf,
                                          volpersample  =ElutionBufferVolume,
                                          defLiqClass   =B_liquidClass)            # defLiqClass="Eluat"   ??

                                                        # Show the CheckList GUI to the user for possible small changes
        self.CheckList()
        self.set_EvoMode()
                                                        # Define the reactives not shown in the CheckList GUI
                                                        # Define samples and the place for temporal reactions
        for s in all_samples:
            Rtv.Reagent("lysis_{:02d}".format(s + 1), Lysis, initial_vol=InitLysisVol,
                        pos=s + 1, defLiqClass=SampleLiqClass, excess=0)
            if self.do_extraction:
                Rtv.Reagent("RNA_{:02d}".format(s + 1), Eluat, initial_vol= 0.0,
                            pos=s+1, defLiqClass=def_liquidClass, excess=0)
                if self.add_samples:
                    Rtv.Reagent("probe_{:02d}".format(s + 1), Samples, single_use=SampleVolume,
                                pos=s+1, defLiqClass=SampleLiqClass, excess=0)

        Itr.wash_tips(wasteVol=30, FastWash=True).exec()
        if self.do_extraction:
            Te_MagS_ActivateHeater(50).exec()
            Te_MagS_MoveToPosition(Te_MagS_MoveToPosition.Dispense).exec()

        if self.add_preMix:                                                               #  add  ProtK+cRNA+MS2 mix
            with self.tips(tipsMask=maxMask, reuse=True, drop=False):
                self.makePreMix(pK_cRNA_MS2)
                self.spread  (  reactive=pK_cRNA_MS2,   to_labware_region= Lysis.selectOnly(all_samples))

        if self.add_samples:                                                               # add samples
            with self.tips(reuse=True, drop=True, preserve=True):
                self.transfer( from_labware_region  = Samples,
                               to_labware_region    = Lysis,
                               volume               = SampleVolume,
                               using_liquid_class   = (SampleLiqClass, "Serum Disp postMix3"),
                               optimizeFrom         = False,
                               optimizeTo           = True,
                               NumSamples           = NumOfSamples)
            Itr.wash_tips(wasteVol=4, FastWash=True).exec()

        if self.add_VL:                                                                     # add  LysisBuffer
            with self.tips(reuse=True, drop=False):    # better reuse=True, drop=False ??
                self.spread  (  reactive=LysisBuffer,   to_labware_region= Lysis.selectOnly(all_samples))


        if not self.do_extraction:
            self.done()
            return

        with incubation(10): pass


        with group("Beads binding"):

            with self.tips(tipsMask=maxMask, reuse=True, drop=False):
                for p in [40, 50, 60, 65]:
                    self.mix_reactive(B_Beads, LiqClass=Beads_LC_1, cycles=1, maxTips=maxTips, v_perc=p)
            with self.tips(reuse=True, drop=True):
                self.spread( reactive=B_Beads,      to_labware_region=TeMag.selectOnly(all_samples))

            with self.tips(reuse=True, drop=False, preserve=True, usePreserved=True):
                self.wash_in_TeMag(reactive=BindingBuffer, wells=all_samples)



        with self.tips(reuse=True, drop=False, preserve=True):
            self.wash_in_TeMag(reactive=VEW1, wells=all_samples)
            self.wash_in_TeMag(reactive=VEW2, wells=all_samples)

            with self.group("Wash in TeMag with " + EtOH80p.name), self.tips():
                self.spread( reactive=EtOH80p, to_labware_region= TeMag.selectOnly(all_samples))

                with parallel_execution_of(mix_mag_sub, repeat=NumOfSamples//self.nTips + 1):
                    self.mix( TeMag.selectOnly(all_samples), EtOH80p.defLiqClass)
                with incubation(minutes=0.5):
                    Te_MagS_MoveToPosition(Te_MagS_MoveToPosition.Aspirate, z_pos=24).exec()
                with self.tips(usePreserved=self.preserveingTips()):
                    self.waste( from_labware_region=    TeMag.selectOnly(all_samples))

                with incubation(minutes=4):
                    Te_MagS_MoveToPosition(Te_MagS_MoveToPosition.Incubation).exec()
                with incubation(minutes=4):
                    Te_MagS_MoveToPosition(Te_MagS_MoveToPosition.Aspirate, z_pos=24).exec()


            self.spread( reactive=ElutionBuffer, to_labware_region=TeMag.selectOnly(all_samples))
            with incubation(minutes=2):
                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//self.nTips+1):
                self.mix(TeMag.selectOnly(all_samples), ElutionBuffer.defLiqClass)

            with self.tips(usePreserved=self.preserveingTips(), preserve=False, drop=True):
                with incubation(minutes=1.0, timer=2):
                    Te_MagS_MoveToPosition(Te_MagS_MoveToPosition.Aspirate).exec()
                self.transfer(   from_labware_region=   TeMag.selectOnly(all_samples),
                                 to_labware_region=     Eluat.selectOnly(all_samples),
                                 volume=                ElutionBufferVolume,
                                 optimizeTo=            False,
                                 using_liquid_class=(ElutionBuffer.defLiqClass, ElutionBuffer.defLiqClass))
        self.done()
Example #31
0
    def Run(self):
        self.set_EvoMode()
        self.initialize()                       #  set_defaults ??
        wt           = self.worktable

        Itr.comment('Extracting RNA from {:s} samples with the MN-Vet kit'.format(str(NumOfSamples))).exec()


        #  Get Labwares (Cuvette, eppys, etc.) from the work table

        DiTi1000_1  = wt.getLabware(Lab.DiTi_1000ul,    "1000-1")
        DiTi1000_2  = wt.getLabware(Lab.DiTi_1000ul,    "1000-2")
        DiTi1000_3  = wt.getLabware(Lab.DiTi_1000ul,    "1000-3")

        Reactives   = wt.getLabware(Lab.GreinRack16_2mL,"Reactives" )

        #  Set the initial position of the tips

        self.go_first_pos()

        # Set volumen / sample

        SampleVolume        = 200.0
        EtOH80pVolume       = 600.0



        SampleLiqClass = "Serum Asp"  # = TissueHomLiqClass   # SerumLiqClass="Serum Asp preMix3"

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


        # Define the reactives in each labware (Cuvette, eppys, etc.)


        VEB             = Rtv.Reagent("VEB - Binding Buffer ",
                                      BindBuf, volpersample=BindingBufferVolume, defLiqClass=B_liquidClass)
        EtOH80p         = Rtv.Reagent("Ethanol 80% ",
                                      wt.getLabware(Lab.Trough_100ml,  "7-EtOH80p"     ),
                                      volpersample=EtOH80pVolume, defLiqClass=B_liquidClass)


        # Show the CheckList GUI to the user for possible small changes

        self.CheckList()
        self.set_EvoMode()

        Itr.wash_tips(wasteVol=30, FastWash=True).exec()

        Plate_lysis = wt.getLabware(Lab.MP96deepwell,   "Plate lysis"   )  # Plate 12 x 8 ?
        Plate_EtOH  = wt.getLabware(Lab.MP96deepwell,   "Plate EtOH"    )  # Plate 12 x 8 ? MP96well !!
        Samples     = wt.getLabware(Lab.EppRack6x16,    "Proben"        )  # 6x16 = 12 x 8 ?


        # Define samples and the place for temporal reactions
        par = Plate_lysis.parallelOrder(self.nTips, all_samples)
        for s in all_samples:
            Rtv.Reagent("probe_{:02d}".format(s + 1), Samples, single_use=SampleVolume,
                        pos=s + 1, defLiqClass=SampleLiqClass, excess=0)
            Rtv.Reagent("lysis_{:02d}".format(s + 1), Plate_lysis, initial_vol=0.0, pos=par[s] + 1,
                        excess=0)  # todo revise order !!!

            Rtv.Reagent("EtOH80p_{:02d}".format(s + 1), Plate_EtOH, initial_vol=0.0, pos=par[s] + 1,
                        excess=0)  # todo revise order !!!


        with group("Prefill plate with EtOH80p"):
            with tips(reuse=True, drop=False, drop_last=True):
                spread(reactive=EtOH80p, to_labware_region=Plate_EtOH.selectOnly(all_samples))
        dropTips()
        self.done()




        PanFla_119 = PrimerMix("PanFLA", ID="119", components=[Primer.IDs[320], Primer.IDs[321]])
        WNV_INNT_37 = PrimerMix("WNV_5p", ID="37", components=[Primer.IDs[20], Primer.IDs[21], Primer.IDs[22]])

        Exp_300 = PCRexperiment(300, "PanFLA mosq Grecia")

        samples = ["Pool-1",
                   "Pool-2",
                   "Pool-3",
                   "Pool-4"]

        Exp_300.addReactions(PanFla_119, samples)
        Exp_300.addReactions(WNV_INNT_37, samples)

        Exp_300.pippete_mix()  # Evo75
        Exp_300.pippete_samples()  # Evo100
Example #32
0
def parallel_execution_of(subroutine, repeat=1):
    # todo improve this idea: execute repeatably one after other and only at end wait.
    # for rep in range(repeat):
    if repeat == 1:
        Itr.subroutine(subroutine, Itr.subroutine.Continues).exec()
        yield
        Itr.subroutine(subroutine, Itr.subroutine.Waits_previous).exec()
    else:
        # rep_sub = br"C:\Prog\robotevo\EvoScriPy\repeat_subroutine.esc" .decode(EvoMode.Mode.encoding)
        Itr.variable("repetitions", repeat, queryString="How many time repeat the subroutine?",
                      type=Itr.variable.Numeric).exec()
        Itr.variable("subroutine",subroutine, queryString="The subroutine path",
                      type=Itr.variable.String).exec()
        Itr.subroutine(Rbt.rep_sub, Itr.subroutine.Continues).exec()
        yield
        Itr.subroutine(Rbt.rep_sub, Itr.subroutine.Waits_previous).exec()
Example #33
0
def group(titel, mode=None):
    Itr.group(titel).exec(mode)
    yield
    Itr.group_end().exec(mode)
Example #34
0
def incubation(minutes, timer=1):
    Itr.startTimer(timer).exec()
    yield
    Itr.waitTimer(timer=timer, timeSpan= minutes*60).exec()
Example #35
0
    def makePreMix(self,  preMix: Rtv.preMix,
                          NumSamples: int     = None,
                          force_replies: bool = False):
        """
        A preMix is just that: a premix of reactive (aka - components)
        which have been already defined to add some vol per sample.
        Uses one new tip per component.
        It find and check self the min and max number of replica of the resulting preMix
        :param preMix: what to make, predefined preMix
        :param NumSamples:
        :param force_replies: use all the preMix predefined replicas
        :return:
        """

        assert isinstance(preMix, Rtv.preMix)
        robot       = self.robot
        mxnTips     = robot.curArm().nTips  # max number of Tips
        ncomp       = len(preMix.components)
        nt          = min(mxnTips, ncomp)
        NumSamples  = NumSamples or self.NumOfSamples
        labw        = preMix.labware
        tVol        = preMix.minVol(NumSamples)
        mxnrepl     = len(preMix.Replicas)                        # max number of replies
        mnnrepl     = preMix.min_num_of_replica(NumSamples)       # min number of replies
        assert mxnrepl >= mnnrepl, 'Please choose at least {:d} replies for {:s}'.format(mnnrepl, preMix.name)
        nrepl       = mxnrepl if force_replies else mnnrepl
        if nrepl < mxnrepl:
            print("WARNING !!! The last {:d} replies of {:s} will not be used.".format(mxnrepl-nrepl, preMix.name))
            preMix.Replicas = preMix.Replicas[:nrepl]

        msg = "preMix: {:.1f} µL of {:s}".format(tVol, preMix.name)
        with group(msg):
            msg += " into grid:{:d} site:{:d} {:s} from {:d} components:"\
                                .format( labw.location.grid,
                                         labw.location.site + 1,
                                         str([str(well) for well in preMix.Replicas]) ,
                                         ncomp                        )
            Itr.comment(msg).exec()
            samples_per_replicas = [(NumSamples + nrepl - (ridx+1))//nrepl for ridx in range(nrepl)]
            with self.tips(Rbt.tipsMask[nt]):   #  want to use preserved ?? selected=??
                tip = -1
                ctips = nt
                for ridx, react in enumerate(preMix.components):       # iterate reactive components
                    labw = react.labware
                    sVol = react.volpersample*preMix.excess       # vol we need for each sample
                    rVol = sVol*NumSamples                        # the total vol we need of this react component
                    msg = "   {idx:d}- {v:.1f} µL from grid:{g:d} site:{st:d}:{w:s}"\
                                .format( idx = ridx + 1,
                                         v   = rVol,
                                         g   = labw.location.grid,
                                         st  = labw.location.site + 1,
                                         w   = str([str(well) for well in react.Replicas])   )
                    Itr.comment(msg).exec()
                    tip += 1  # use the next tip
                    if tip >= nt:
                        ctips = min(nt, ncomp - ridx) # how many tips to use for the next gruop
                        tipsType = robot.curArm().Tips[0].type    # only the 0 ??
                        self.dropTips(Rbt.tipsMask[ctips])
                        self.getTips(Rbt.tipsMask[ctips], tipsType)
                        tip = 0
                    mV = robot.curArm().Tips[tip].type.maxVol
                    # aspire/dispense multiple times if rVol don't fit in the tip (mV)
                    # but also if there is not sufficient reactive in the current component replica
                    current_comp_repl = 0
                    while rVol > 0:
                        while (react.Replicas[current_comp_repl].vol < 1):      # todo define sinevoll min vol
                            current_comp_repl +=1
                        dV = min (rVol, mV, react.Replicas[current_comp_repl].vol)
                        self.aspire(tip, react, dV, offset=react.Replicas[current_comp_repl].offset)
                        self.multidispense_in_replicas(ridx, preMix, [sp/NumSamples * dV for sp in samples_per_replicas])
                        rVol -= dV
                self.mix_reactive(preMix, maxTips=ctips)
    def Run(self):
        self.set_EvoMode()
        self.initialize()                       # set_defaults ??
        Rtv.NumOfSamples = self.NumOfSamples
        NumOfSamples = self.NumOfSamples
        wt           = self.worktable

        Itr.comment('Extracting RNA from {:s} samples with the MN-Vet kit'.format(str(NumOfSamples))).exec()

                                                              # Get Labwares (Cuvette, eppys, etc.) from the work table

        LysBuf      = wt.getLabware(Lab.Trough_100ml,   "2-Vl Lysis Buffer"     )
        BindBuf     = wt.getLabware(Lab.Trough_100ml,   "3-VEB Binding Buffer"  )

        DiTi1000_1  = wt.getLabware(Lab.DiTi_1000ul,    "1000-1")
        DiTi1000_2  = wt.getLabware(Lab.DiTi_1000ul,    "1000-2")
        DiTi1000_3  = wt.getLabware(Lab.DiTi_1000ul,    "1000-3")

        Reactives   = wt.getLabware(Lab.GreinRack16_2mL, "Reactives" )

                                                              #  Set the initial position of the tips

        self.go_first_pos()

                                                              # Set volumen / sample

        ProtKVolume         =  20.0
        cRNAVolume          =   4.0
        LysisBufferVolume   = 100.0                 # VL1 or VL
        IC_MS2Volume        =  10.0                 # IC2
        IC2Volume           =   5.0                 # ? 4
        BindingBufferVolume = 350.0                 # VEB
        B_BeadsVolume       =  20.0                 # B-Beads
        EtOH80pVolume       = 600.0
        SampleVolume        = 100.0
        InitLysisVol        = 0.0

        if self.version == 'in-VL inactivated':
            InitLysisVol  = SampleVolume + LysisBufferVolume

        elif self.version == 'pre Inactivated':
            InitLysisVol  = SampleVolume + ProtKVolume + cRNAVolume + IC_MS2Volume + LysisBufferVolume

                                                        # Liquid classes used for pippetting.
                                                        # Others liquidClass names are defined in "protocol_steps.py"

        SampleLiqClass = "Serum Asp"  # = TissueHomLiqClass   # SerumLiqClass="Serum Asp preMix3"

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

                                                        # Define the reactives in each labware (Cuvette, eppys, etc.)

        if self.version != 'pre Inactivated':             # we need to add ProtK+cRNA+MS2 mix
            ProtK       = Rtv.Reagent("Proteinase K ",
                                      Reactives,
                                      replicas     = 2,
                                      pos          = [15, 16],
                                      volpersample = ProtKVolume,
                                      defLiqClass  = Small_vol_disp)

            cRNA        = Rtv.Reagent("Carrier RNA ", Reactives, pos=14, volpersample=  cRNAVolume, defLiqClass=Small_vol_disp)
            IC_MS2      = Rtv.Reagent("IC MS2 phage culture ", Reactives, pos=13, volpersample= IC_MS2Volume, defLiqClass=Small_vol_disp)

            # IC2         = Rtv.Reagent("IC2 - synthetic RNA " ,  Reactives, pos=13, volpersample=  IC2Volume ,defLiqClass=W_liquidClass)

            pK_cRNA_MS2 = Rtv.preMix  ("ProtK+cRNA+IC-MS2 mix "  ,
                                           Reactives,
                                           pos=8,
                                           components=[  cRNA, ProtK, IC_MS2] ,
                                           defLiqClass=W_liquidClass,
                                           excess=20)

            if self.version != 'in-VL inactivated':
                LysisBuffer     = Rtv.Reagent("VL - Lysis Buffer ", LysBuf, volpersample=LysisBufferVolume, defLiqClass='MN VL')



        B_Beads         = Rtv.Reagent("B - Beads ",
                                      Reactives,
                                      pos          = [1,2],
                                      initial_vol  = 1200,
                                      volpersample = B_BeadsVolume,
                                      defLiqClass  = Beads_LC_2,
                                      maxFull      = 70)

        VEB             = Rtv.Reagent("VEB - Binding Buffer ", BindBuf, volpersample=BindingBufferVolume, defLiqClass=B_liquidClass)

        EtOH80p         = Rtv.Reagent("Ethanol 80% ", wt.getLabware(Lab.Trough_100ml, "7-EtOH80p"), volpersample=EtOH80pVolume, defLiqClass=B_liquidClass)


                                                        # Show the CheckList GUI to the user for possible small changes

        self.CheckList()
        self.set_EvoMode()

                                                        # Define the reactives not shown in the CheckList GUI
                                                        # Define samples and the place for temporal reactions

        Plate_lysis = wt.getLabware(Lab.MP96deepwell,   "Plate lysis"   )  # Plate 12 x 8 ?
        Plate_EtOH  = wt.getLabware(Lab.MP96deepwell,   "Plate EtOH"    )  # Plate 12 x 8 ? MP96well !!

        if self.version != 'original samples':
           Samples  = wt.getLabware(Lab.EppRack6x16,    "Proben"        )  # 6x16 = 12 x 8 ?


        par = Plate_lysis.parallelOrder(self.nTips, all_samples)

        for s in all_samples:

            if self.version == 'original samples':
                Rtv.Reagent("probe_{:02d}".format(s + 1), Samples, single_use=SampleVolume,
                            pos=s + 1, defLiqClass=SampleLiqClass, excess=0)

            Rtv.Reagent("lysis_{:02d}".format(s + 1), Plate_lysis, initial_vol=InitLysisVol, pos=s + 1,
                        excess=0)

            Rtv.Reagent("EtOH80p_{:02d}".format(s + 1), Plate_EtOH, initial_vol=0.0, pos=par[s] + 1,
                        excess=0)  # todo revise order !!!


        Itr.wash_tips(wasteVol=30, FastWash=True).exec()

        with group("Prefill plate with EtOH80p"):
            with self.tips(reuse=True, drop=False, drop_last=True):
                self.spread(reactive=EtOH80p, to_labware_region=Plate_EtOH.selectOnly(all_samples))


        with group("Sample Lysis"):
            if self.version != 'pre Inactivated':                            #  add  ProtK+cRNA+MS2 mix

                with self.tips(tipsMask=maxMask, reuse=True, drop=False, drop_last=True):
                    self.makePreMix(pK_cRNA_MS2)
                    self.spread  (  reactive=pK_cRNA_MS2,   to_labware_region= Plate_lysis.selectOnly(all_samples))


                if self.version != 'in-VL inactivated':                      # add  LysisBuffer

                    with self.tips(tipsMask=maxMask, reuse=True, drop=False, drop_last=True):
                        self.spread  (  reactive=LysisBuffer,   to_labware_region= Plate_lysis.selectOnly(all_samples))


            if self.version == 'original samples':                       # add samples

                Itr.userPrompt("Please make sure the samples are in place").exec()
                with self.tips(reuse=False, drop=True):
                    self.transfer(  from_labware_region= Samples,
                               to_labware_region=   Plate_lysis,
                               volume=              SampleVolume,
                               using_liquid_class=  (SampleLiqClass, "Serum Disp postMix3"),
                               optimizeFrom         = False,
                               optimizeTo           = False,           # todo Really ??
                               NumSamples           = NumOfSamples)
                Itr.wash_tips(wasteVol=4, FastWash=True).exec()

            if self.version != 'pre Inactivated':
                Itr.userPrompt("Please Schutteln the plates for lysis in pos 1").exec()
                with incubation(minutes=5): pass

        if self.version != 'prefill inactivation':
            Itr.userPrompt("Please make sure the samples are back in place").exec()

        with group("Beads binding"):
            with self.tips(tipsMask=maxMask, reuse=True, drop=False):
                for p in [40, 50, 60, 65]:
                    self.mix_reactive(B_Beads, LiqClass=Beads_LC_1, cycles=1, maxTips=maxTips, v_perc=p)
            with self.tips(reuse=True, drop=False):
                self.spread( reactive=B_Beads,      to_labware_region=Plate_lysis.selectOnly(all_samples))
            self.dropTips()

            with self.tips(reuse=True, drop=False):
                self.spread( reactive=VEB,          to_labware_region=Plate_lysis.selectOnly(all_samples))

            Itr.userPrompt("Please Schutteln the plates for lysis in pos 1").exec()

        self.dropTips()
        self.done()
Example #37
0
def incubation(minutes, timer=1):
    Itr.startTimer(timer).exec()
    yield
    Itr.waitTimer(timer=timer, timeSpan=minutes * 60).exec()
    def Run(self):
        self.set_EvoMode()   # this add: self.iRobot = EvoMode.iRobot(Itr.Pipette.LiHa1, nTips=self.nTips)
                             # in which: self.robot = Rbt.Robot(index=index, arms=arms, nTips=nTips)
        self.initialize()    # if needed calls Executable.initialize() and set_EvoMode
                             # which calls GUI.update_parameters() and set_defaults() from Evo200

        Rtv.NumOfSamples = self.NumOfSamples
        NumOfSamples = self.NumOfSamples
        wt           = self.worktable

        Itr.comment('Prefill {:d} plates with LysisBufferReact for {:d} samples.'\
                       .format(self.num_plates,
                               NumOfSamples     )).exec()

                                                            # Get Labwares (Cuvette, eppys, etc.) from the work table
        BufCuvette = wt.getLabware(Lab.Trough_100ml, "2-Vl Lysis Buffer")




        self.go_first_pos()                                                     #  Set the initial position of the tips

                                                                                  # Set volumen / sample
        BufferVolume   = 100.0       # VL1 or VL

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

                                                        # Define the reactives in each labware (Cuvette, eppys, etc.)

        BufferReact = Rtv.Reagent("Buffer ",
                                  BufCuvette,
                                  volpersample = BufferVolume,
                                  defLiqClass  = 'MN VL',
                                  num_of_samples= self.num_plates * NumOfSamples)

        # Show the CheckList GUI to the user for possible small changes

        self.CheckList()
        self.set_EvoMode()

        Itr.wash_tips(wasteVol=5, FastWash=True).exec()

        LysPlat = [wt.getLabware(Lab.MP96deepwell, "Plate lysis-"+str(i+1)) for i in range(self.num_plates)]

        par = LysPlat[0].parallelOrder(self.nTips, all_samples)

        # Define place for temporal reactions
        for i, LP in enumerate(LysPlat):
            for s in all_samples:
                Rtv.Reagent("lysis_{:d}-{:02d}".format(i + 1, s + 1),
                            LP,
                            initial_vol =0.0,
                            pos         =s + 1,
                            excess      =0)

        with group("Prefill plates with BufferReact"):

            Itr.userPrompt("Put the plates for BufferReact").exec()

            for LP in LysPlat:
                with self.tips(reuse=True, drop=False):
                    self.spread(reactive=BufferReact, to_labware_region=LP.selectOnly(all_samples))
                self.dropTips()

        self.done()
Example #39
0
def mix(in_labware_region,
        using_liquid_class=None,
        volume=None,
        optimize=True):
    """

    :param in_labware_region:
    :param using_liquid_class:
    :param volume:
    :param optimize:
    :return:
    """
    mix_p = 0.9
    in_labware_region = in_labware_region or Lab.WashWaste
    assert isinstance(
        in_labware_region,
        Lab.Labware), 'A Labware expected in in_labware_region to be mixed'
    if not volume or volume < 0.0: volume = 0.0
    assert isinstance(volume, (int, float))
    oriSel = in_labware_region.selected()
    nt = Rbt.Robot.current.curArm(
    ).nTips  # the number of tips to be used in each cycle of pippeting
    if not oriSel:
        oriSel = range(Rtv.NumOfSamples)
    if optimize:
        oriSel = in_labware_region.parallelOrder(nt, oriSel)
    NumSamples = len(oriSel)
    SampleCnt = NumSamples
    if nt > SampleCnt:
        nt = SampleCnt
    # mV = Rbt.Robot.current.curArm().Tips[0].type.maxVol * 0.8
    mV = Lab.def_DiTi.maxVol * mix_p  # What tip tp use !
    if volume:
        v = volume
    else:
        v = in_labware_region.Wells[oriSel[0]].vol
    v = v * mix_p
    v = v if v < mV else mV

    lf = in_labware_region
    mx = Itr.mix(Rbt.tipsMask[nt], using_liquid_class, volume,
                 in_labware_region)
    msg = "Mix: {v:.1f} µL of {n:s}".format(v=v, n=lf.label)
    with group(msg):
        msg += " [grid:{fg:d} site:{fs:d}] in order:".format(fg=lf.location.grid, fs=lf.location.site+1) \
                                    + str([i+1 for i in oriSel])
        Itr.comment(msg).exec()
        while SampleCnt:
            curSample = NumSamples - SampleCnt
            if nt > SampleCnt:
                nt = SampleCnt
                mx.tipMask = Rbt.tipsMask[nt]

            sel = oriSel[curSample:curSample + nt]
            spl = range(curSample, curSample + nt)
            with tips(Rbt.tipsMask[nt], selected_samples=spl):
                mV = Rbt.Robot.current.curArm().Tips[0].type.maxVol * mix_p
                mx.labware.selectOnly(sel)
                if not using_liquid_class:
                    if sel:
                        mx.liquidClass = mx.labware.selected_wells(
                        )[0].reactive.defLiqClass
                if volume:
                    r = volume  # r: Waste_available yet; volume: to be Waste
                else:
                    vols = [w.vol for w in mx.labware.selected_wells()]
                    r_min, r_max = min(vols), max(vols)
                    assert r_min == r_max
                    r = r_max
                r = r * mix_p
                r = r if r < mV else mV
                mx.volume = r
                mx.exec()
            SampleCnt -= nt
    mx.labware.selectOnly(oriSel)
    return oriSel
    def Run(self):
        self.set_EvoMode()
        self.initialize()                       # set_defaults ??
        Rtv.NumOfSamples = self.NumOfSamples
        NumOfSamples = self.NumOfSamples
        wt           = self.worktable

        Itr.comment('Extracting RNA from {:s} samples with the MN-Vet kit'.format(str(NumOfSamples))).exec()


        #  Get Labwares (Cuvette, eppys, etc.) from the work table

        ElutBuf     = wt.getLabware(Lab.Trough_100ml,   "1-VEL-ElutionBuffer"   )
        LysBuf      = wt.getLabware(Lab.Trough_100ml,   "2-Vl Lysis Buffer"     )
        BindBuf     = wt.getLabware(Lab.Trough_100ml,   "3-VEB Binding Buffer"  )

        DiTi1000_1  = wt.getLabware(Lab.DiTi_1000ul,    "1000-1")
        DiTi1000_2  = wt.getLabware(Lab.DiTi_1000ul,    "1000-2")
        DiTi1000_3  = wt.getLabware(Lab.DiTi_1000ul,    "1000-3")

        Reactives   = wt.getLabware(Lab.GreinRack16_2mL, "Reactives" )

        #  Set the initial position of the tips

        self.go_first_pos()

        # Set volumen / sample

        SampleVolume        = 200.0
        LysisBufferVolume   = 180.0       # VL1
        IC2Volume           =   5.0       # ? 4
        BindingBufferVolume = 600.0
        B_BeadsVolume       =  20.0
        VEW1Volume          = 600.0
        VEW2Volume          = 600.0
        EtOH80pVolume       = 600.0
        ProtKVolume         =  20.0
        cRNAVolume          =   4.0
        IC_MS2Volume        =  20.0
        ElutionBufferVolume = 100.0


        # Liquid classes used for pippetting. Others liquidClass names are defined in "protocol_steps.py"

        SampleLiqClass = "Serum Asp"  # = TissueHomLiqClass   # SerumLiqClass="Serum Asp preMix3"


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


        # Define the reactives in each labware (Cuvette, eppys, etc.)

        LysisBuffer     = Rtv.Reagent("VL - Lysis Buffer ",
                                      LysBuf, volpersample=LysisBufferVolume, defLiqClass=B_liquidClass)
        IC2             = Rtv.Reagent("IC2 - synthetic RNA ",
                                      Reactives, pos=11, volpersample=  IC2Volume, defLiqClass=W_liquidClass)
        VEB             = Rtv.Reagent("VEB - Binding Buffer ",
                                      BindBuf, volpersample=BindingBufferVolume, defLiqClass=B_liquidClass)
        B_Beads         = Rtv.Reagent("B - Beads ", Reactives, initial_vol=1200,
                                      pos=1, volpersample= B_BeadsVolume, replicas=2, defLiqClass=Beads_LC_2)

        VEW1            = Rtv.Reagent("VEW1 - Wash Buffer ",
                                      wt.getLabware(Lab.Trough_100ml,  "4-VEW1 Wash Buffe"),
                                      volpersample=VEW1Volume, defLiqClass=B_liquidClass)
        VEW2            = Rtv.Reagent("VEW2 - WashBuffer ",
                                      wt.getLabware(Lab.Trough_100ml,  "5-VEW2-WashBuffer" ),
                                      volpersample=VEW2Volume, defLiqClass=B_liquidClass)
        EtOH80p         = Rtv.Reagent("Ethanol 80% ",
                                      wt.getLabware(Lab.Trough_100ml,  "7-EtOH80p"     ),
                                      volpersample=EtOH80pVolume, defLiqClass=B_liquidClass)
        ElutionBuffer   = Rtv.Reagent("Elution Buffer ",
                                      ElutBuf, volpersample=ElutionBufferVolume, defLiqClass="Eluat")

        ProtK           = Rtv.Reagent("Proteinase K ",
                                      Reactives, pos=16, volpersample= ProtKVolume, defLiqClass=Small_vol_disp)
        cRNA            = Rtv.Reagent("Carrier RNA ",
                                      Reactives, pos=15, volpersample=  cRNAVolume, defLiqClass=Small_vol_disp)
        IC_MS2          = Rtv.Reagent("IC MS2 phage culture ",
                                      Reactives, pos=14, volpersample= IC_MS2Volume, defLiqClass=Small_vol_disp)
        pK_cRNA_MS2     = Rtv.preMix  ("ProtK+cRNA+IC-MS2 mix "        ,
                                       Reactives, pos=12,   components=[ ProtK, cRNA, IC2 ]
                                         , defLiqClass=W_liquidClass, replicas=2)
#        Waste           = Rtv.Reagent("Waste "  , self.WashWaste )

        # Show the CheckList GUI to the user for posible small changes

        self.CheckList()
        self.set_EvoMode()

        Itr.wash_tips(wasteVol=30, FastWash=True).exec()


        with group("Prefill plates with VEW1, VEW2, EtOH and Elution buffer"):

            Itr.userPrompt("Put the plates for VEW1, Elution Buffer and VEW2"
                           " in the worktable defined order").exec()

            Plate_VEW1  = wt.getLabware(Lab.MP96deepwell, "Plate VEW1" )  # Plate 12 x 8 ?
            Plate_ElutB = wt.getLabware(Lab.MP96well,     "Plate ElutB")  # Plate 12 x 8 ? MP96well !!
            Plate_VEW2  = wt.getLabware(Lab.MP96deepwell, "Plate VEW2" )  # Plate 12 x 8 ?

            # Define samples and the place for temporal reactions
            for s in all_samples:
                Rtv.Reagent("VEW1_{:02d}".format(s + 1), Plate_VEW1, initial_vol=0.0, pos=s + 1,
                            excess=0)  # todo revise order !!!
                Rtv.Reagent("VEW2_{:02d}".format(s + 1), Plate_VEW2, initial_vol=0.0, pos=s + 1,
                            excess=0)  # todo revise order !!!
                Rtv.Reagent("ElutB_{:02d}".format(s + 1), Plate_ElutB, initial_vol=0.0, pos=s + 1,
                            excess=0)  # todo revise order !!!

            with tips(reuse=True, drop=False):
                spread(reactive=VEW1, to_labware_region=Plate_VEW1.selectOnly(all_samples))

            with tips(reuse=True, drop=False):
                spread(reactive=VEW2, to_labware_region=Plate_VEW2.selectOnly(all_samples))

            with tips(reuse=True, drop=False):
                spread(reactive=ElutionBuffer, to_labware_region=Plate_ElutB.selectOnly(all_samples))

            Itr.userPrompt("Retire the plates for VEW1, VEW2 and Elution Buffer, and "
                           "Put the plates for the lysis -in place of VEW1- and for EtOH80p -in place of VEW2-").exec()

            Plate_EtOH = wt.replaceWithNew(Plate_VEW2, "Plate_EtOH")  # Plate 12 x 8 ?
            for s in all_samples:
                Rtv.Reagent("EtOH_{:02d}".format(s + 1), Plate_EtOH, initial_vol=0.0, pos=s + 1,
                            excess=0)  # todo revise order !!!
            with tips(reuse=True, drop=False):
                spread(reactive=EtOH80p, to_labware_region=Plate_EtOH.selectOnly(all_samples))



        with group("Sample Lysis"):
            Samples     = wt.getLabware(Lab.EppRack6x16, "Proben")  # 6x16 = 12 x 8 ?
            Plate_lysis = wt.replaceWithNew(Plate_VEW1, "Lysis_Plate")  # Plate 12 x 8 ?

            # Define samples and the place for temporal reactions

            for s in all_samples:
                Rtv.Reagent("probe_{:02d}".format(s + 1), Samples, single_use=SampleVolume,
                            pos=s + 1, defLiqClass=SampleLiqClass, excess=0)
                Rtv.Reagent("lysis_{:02d}".format(s + 1), Plate_lysis, initial_vol=0.0, pos=s + 1,
                            excess=0)  # todo revise order !!!

            with tips(tipsMask=maxMask, reuse=True, drop=True):
                pK_cRNA_MS2.make(NumOfSamples)
                spread  (  reactive=pK_cRNA_MS2,   to_labware_region= Plate_lysis.selectOnly(all_samples))
                spread  (  reactive=LysisBuffer,   to_labware_region= Plate_lysis.selectOnly(all_samples))
            with tips(reuse=False, drop=True):
                transfer(  from_labware_region= Samples,
                           to_labware_region=   Plate_lysis,
                           volume=              SampleVolume,
                           using_liquid_class=  (SampleLiqClass, "Serum Disp postMix3"),
                           optimizeFrom         =False,     # optimizeTo= True,           # todo Really ??
                           NumSamples=          NumOfSamples)
            Itr.wash_tips(wasteVol=4, FastWash=True).exec()
            # with tips(reuse=False, drop=True):        # better reuse=True, drop=False, with normal Liquid Class ??
            #     spread  (  reactive=LysisBuffer,
            #                to_labware_region= Plate_lysis.selectOnly(all_samples),
            #                using_liquid_class=(None,"Serum Disp postMix3"))

            with incubation(minutes=15):
                Itr.userPrompt("Please Schutteln the plates for lysis in pos 1").exec()

        with group("Beads binding"):
            with tips(tipsMask=maxMask, reuse=True, drop=False):
                for p in [40, 50, 60, 65]:
                    mix_reactive(B_Beads, LiqClass=Beads_LC_1, cycles=1, maxTips=maxTips, v_perc=p)

            with tips(reuse=True, drop=True):
                spread( reactive=B_Beads,      to_labware_region=Plate_lysis.selectOnly(all_samples))
                spread( reactive=VEB,          to_labware_region=Plate_lysis.selectOnly(all_samples))

            # with tips(reuse=False, drop=True):   # better reuse=True, drop=False, with normal Liquid Class ??
            #     spread  (  reactive=VEB,
            #                to_labware_region= Plate_lysis.selectOnly(all_samples),
            #                using_liquid_class=(None,"Serum Disp postMix3"))
            with incubation(minutes=5):
                Itr.userPrompt("Please Schutteln the plates for lysis in pos 1").exec()

        self.done()
Example #41
0
def extractRNA_with_MN_Vet_Kit(NumOfSamples, CheckList=None):

    Rtv.NumOfSamples = NumOfSamples
    import protocols.RNAextractionMN_Mag.RobotInitRNAextraction as RI

    Itr.comment('Extracting RNA from {:s} samples with the MN-Vet kit'.format(
        str(NumOfSamples))).exec()

    # DiTi1000_1.fill('C06')
    # DiTi1000_2.fill('A11')
    # DiTi1000_3.fill('A10')
    Itr.set_DITI_Counter2(RI.DiTi1000_1, posInRack='A01').exec()

    SampleVolume = 200.0
    LysisBufferVolume = 180.0
    IC2Volume = 4.0
    BindingBufferVolume = 600.0
    B_BeadsVolume = 20.0
    VEW1Volume = 600.0
    VEW2Volume = 600.0
    EtOH80pVolume = 600.0
    ProtKVolume = 20.0
    cRNAVolume = 4.0
    IC_MS2Volume = 20.0
    ElutionBufferVolume = 100.0

    SampleLiqClass = "Serum Asp"  # = TissueHomLiqClass   # SerumLiqClass="Serum Asp preMix3"

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

    LysisBuffer = Rtv.Reactive("VL - Lysis Buffer ",
                               RI.LysBuf,
                               volpersample=LysisBufferVolume,
                               defLiqClass=B_liquidClass)
    IC2 = Rtv.Reactive("IC2 - synthetic RNA ",
                       RI.Reactives,
                       pos=11,
                       volpersample=IC2Volume,
                       defLiqClass=W_liquidClass)
    BindingBuffer = Rtv.Reactive("VEB - Binding Buffer ",
                                 RI.BindBuf,
                                 volpersample=BindingBufferVolume,
                                 defLiqClass=B_liquidClass)
    B_Beads = Rtv.Reactive("B - Beads ",
                           RI.Reactives,
                           initial_vol=1200,
                           pos=1,
                           volpersample=B_BeadsVolume,
                           replicas=2,
                           defLiqClass=Beads_LC_2)

    VEW1 = Rtv.Reactive("VEW1 - Wash Buffer ",
                        Lab.Cuvette(Lab.Trough_100ml,
                                    Lab.Labware.Location(22, 4),
                                    "4-VEW1 Wash Buffer"),
                        volpersample=VEW1Volume,
                        defLiqClass=B_liquidClass)
    VEW2 = Rtv.Reactive("VEW2 - WashBuffer ",
                        Lab.Cuvette(Lab.Trough_100ml,
                                    Lab.Labware.Location(22, 5),
                                    "5-VEW2-WashBuffer"),
                        volpersample=VEW2Volume,
                        defLiqClass=B_liquidClass)
    EtOH80p = Rtv.Reactive("Ethanol 80% ",
                           Lab.Cuvette(Lab.Trough_100ml,
                                       Lab.Labware.Location(24, 1),
                                       "7-Ethanol 80%"),
                           volpersample=EtOH80pVolume,
                           defLiqClass=B_liquidClass)
    ElutionBuffer = Rtv.Reactive("Elution Buffer ",
                                 RI.ElutBuf,
                                 volpersample=ElutionBufferVolume,
                                 defLiqClass="Eluat")

    ProtK = Rtv.Reactive("Proteinase K ",
                         RI.Reactives,
                         pos=16,
                         volpersample=ProtKVolume,
                         defLiqClass=Small_vol_disp)
    cRNA = Rtv.Reactive("Carrier RNA ",
                        RI.Reactives,
                        pos=15,
                        volpersample=cRNAVolume,
                        defLiqClass=Small_vol_disp)
    IC_MS2 = Rtv.Reactive("IC MS2 phage culture ",
                          RI.Reactives,
                          pos=14,
                          volpersample=IC_MS2Volume,
                          defLiqClass=Small_vol_disp)
    pK_cRNA_MS2 = Rtv.preMix("ProtK+cRNA+IC-MS2 mix ",
                             RI.Reactives,
                             pos=12,
                             components=[ProtK, cRNA, IC_MS2],
                             defLiqClass=W_liquidClass,
                             replicas=2)
    Waste = Rtv.Reactive("Waste ", RI.WashWaste)

    if CheckList is not None:
        CheckList()

    for s in all_samples:
        Rtv.Reactive("probe_{:02d}".format(s + 1),
                     RI.Samples,
                     single_use=SampleVolume,
                     pos=s + 1,
                     defLiqClass=SampleLiqClass,
                     excess=0)
        Rtv.Reactive("lysis_{:02d}".format(s + 1),
                     RI.TeMag,
                     initial_vol=0.0,
                     pos=par[s] + 1,
                     defLiqClass=def_liquidClass,
                     excess=0)
        Rtv.Reactive("RNA_{:02d}".format(s + 1),
                     RI.Eluat,
                     initial_vol=0.0,
                     pos=s + 1,
                     defLiqClass=def_liquidClass,
                     excess=0)

    Itr.wash_tips(wasteVol=30, FastWash=True).exec()
    Te_MagS_ActivateHeater(50).exec()
    Te_MagS_MoveToPosition(Te_MagS_MoveToPosition.Dispense).exec()

    with tips(tipsMask=maxMask, reuse=True, drop=False):
        pK_cRNA_MS2.make()
        spread(reactive=pK_cRNA_MS2,
               to_labware_region=RI.TeMag.selectOnly(all_samples))

    with tips(reuse=True, drop=True, preserve=True):
        transfer(from_labware_region=RI.Samples,
                 to_labware_region=RI.TeMag,
                 volume=SampleVolume,
                 using_liquid_class=(SampleLiqClass, "Serum Disp postMix3"),
                 optimizeFrom=False,
                 optimizeTo=True,
                 NumSamples=Rtv.NumOfSamples)
    Itr.wash_tips(wasteVol=4, FastWash=True).exec()

    with tips(reuse=False, drop=True):
        spread(reactive=LysisBuffer,
               to_labware_region=RI.TeMag.selectOnly(all_samples))

    with incubation(10):
        pass

    with tips(tipsMask=maxMask, reuse=True, drop=False):
        for p in [40, 50, 60, 65]:
            mix_reactive(B_Beads,
                         LiqClass=Beads_LC_1,
                         cycles=1,
                         maxTips=maxTips,
                         v_perc=p)


#        mix_reactive(B_Beads, LiqClass=Beads_LC_2, cycles=3, maxTips=maxTips, v_perc=90)

    with tips(reuse=True, drop=True):
        spread(reactive=B_Beads,
               to_labware_region=RI.TeMag.selectOnly(all_samples))

    with tips(reuse=True, drop=False, preserve=True, usePreserved=True):
        wash_in_TeMag(reactive=BindingBuffer, wells=all_samples)

    with tips(reuse=True, drop=False, preserve=True):
        wash_in_TeMag(reactive=VEW1, wells=all_samples)
        wash_in_TeMag(reactive=VEW2, wells=all_samples)

        with group("Wash in TeMag with " + EtOH80p.name), tips():
            spread(reactive=EtOH80p,
                   to_labware_region=RI.TeMag.selectOnly(all_samples))

            with parallel_execution_of(mix_mag_sub,
                                       repeat=Rtv.NumOfSamples // Rbt.nTips +
                                       1):
                mix(RI.TeMag.selectOnly(all_samples), EtOH80p.defLiqClass)
            with incubation(minutes=0.5):
                Te_MagS_MoveToPosition(Te_MagS_MoveToPosition.Aspirate,
                                       z_pos=24).exec()
            with tips(usePreserved=preserveingTips()):
                waste(from_labware_region=RI.TeMag.selectOnly(all_samples))

            with incubation(minutes=4):
                Te_MagS_MoveToPosition(
                    Te_MagS_MoveToPosition.Incubation).exec()
            with incubation(minutes=4):
                Te_MagS_MoveToPosition(Te_MagS_MoveToPosition.Aspirate,
                                       z_pos=24).exec()

        spread(reactive=ElutionBuffer,
               to_labware_region=RI.TeMag.selectOnly(all_samples))
        with incubation(minutes=2):
            Te_MagS_MoveToPosition(Te_MagS_MoveToPosition.Incubation).exec()

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

        with tips(usePreserved=preserveingTips(), preserve=False, drop=True):
            with incubation(minutes=1.0, timer=2):
                Te_MagS_MoveToPosition(Te_MagS_MoveToPosition.Aspirate).exec()
            transfer(from_labware_region=RI.TeMag.selectOnly(all_samples),
                     to_labware_region=RI.Eluat.selectOnly(all_samples),
                     volume=ElutionBufferVolume,
                     optimizeTo=False,
                     using_liquid_class=(ElutionBuffer.defLiqClass,
                                         ElutionBuffer.defLiqClass))