예제 #1
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()
예제 #2
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()
예제 #3
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()
예제 #4
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()
예제 #5
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()
예제 #6
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()
예제 #7
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
예제 #8
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
예제 #9
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
예제 #10
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