Exemple #1
0
def lseqin(x, op=0):
    if len(x) != 11:
        raise IOError('Wrong Usauge 11nt long only')
    x = x.upper()
    barcode = x
    count157 = 0
    genedict = []
    glist = []
    tarlist = []
    while count157 <= 11:
        basec = 0
        basedict = []
        while basec <= 3:
            __o = list(barcode)
            __o.insert(count157, bases[basec])
            tbarcode = ''.join(__o)
            basec += 1

            if tbarcode not in seqlist:
                glist.append(0)
                pass
            elif tbarcode in tarlist:
                glist.append(0)
            else:
                wo = seqcompare.seqin(tbarcode, seqlist)[1]
                basedict.append(wo)
                glist.append(wo)
            tarlist.append(tbarcode)
        count157 += 1
    if seqcompare.seqone(glist):
        pos8 = glist.index(1)
        pos8 += 1
        n1 = pos8 / 4
        r1 = pos8 % 4
        if r1 != 0:
            n1 += 1
        r1 -= 1
        p12 = n1 - 1
        b12 = bases[r1]
        _r = list(barcode)
        _r.insert(p12, b12)
        barcode = "".join(_r)
    if op == 1:
        if barcode in seqlist:
            return seqlist[barcode]
        elif barcode not in seqlist:
            return 'None'
        else:
            return IOError('something was wrong')
    if barcode not in seqlist:
        return False
    elif barcode in seqlist:
        return True
    else:
        return IOError('something was wrong')
Exemple #2
0
def oseqin2(barcode, op=0):
    barcode = barcode.upper()
    count157 = 0
    genedict = []
    glist = []
    while count157 <= 11:
        basec = 0
        basedict = []
        while basec <= 3:
            __o = list(barcode)
            __o[count157] = bases[basec]
            tbarcode = ''.join(__o)
            basec += 1
            if tbarcode not in seqlist:
                glist.append(0)
                pass
            else:
                wo = seqcompare.seqin(tbarcode, seqlist)[1]
                basedict.append(wo)
                glist.append(wo)
        count157 += 1
    if seqcompare.seqone(glist):
        pos8 = glist.index(1)
        pos8 += 1
        n1 = pos8 / 4
        r1 = pos8 % 4
        if r1 != 0:
            n1 += 1
        r1 -= 1
        p12 = n1 - 1
        b12 = bases[r1]
        _r = list(barcode)
        _r[p12] = b12
        barcode = "".join(_r)
    if op == 1:
        if barcode in seqlist:
            return seqlist[barcode]
        elif barcode not in seqlist:
            return 'None'
        else:
            return IOError('something was wrong')
    if barcode not in seqlist:
        return False
    elif barcode in seqlist:
        return True
    else:
        return IOError('something was wrong')
Exemple #3
0
def dseqin(x, op=0):
    if len(x) != 13:
        raise IOError('Wrong Usauge 13nt long only')
    x = x.upper()
    barcode = x
    count157 = 0
    genedict = []
    glist = []
    tarlist = []
    while count157 <= 12:
        basedict = []
        __o = list(barcode)
        del __o[count157]
        tbarcode = ''.join(__o)
        if tbarcode not in seqlist:
            glist.append(0)
            pass
        elif tbarcode in tarlist:
            glist.append(0)
        else:
            wo = seqcompare.seqin(tbarcode, seqlist)[1]
            basedict.append(wo)
            glist.append(wo)
        tarlist.append(tbarcode)
        count157 += 1
    if seqcompare.seqone(glist):
        pos8 = glist.index(1)
        pos8 += 1
        n1 = pos8
        p12 = n1 - 1
        _r = list(barcode)
        del _r[p12]
        barcode = "".join(_r)
    if op == 1:
        if barcode in seqlist:
            return seqlist[barcode]
        elif barcode not in seqlist:
            return 'None'
        else:
            return IOError('something was wrong')
    if barcode not in seqlist:
        return False
    elif barcode in seqlist:
        return True
    else:
        return IOError('something was wrong')