Esempio n. 1
0
def mod_transl_except(feat, value):
    ret = []
    mods = value
    if not isinstance(mods, list):
        mods = [mods]
    for value in mods:
        if value[:1] != "(" or value[-1:] != ")":
            raise ValueError("Invalidly formatted transl_except: %s" % value)
        parts = location.location_split(value[1:-1])
        if len(parts) != 2:
            raise ValueError("Failed to split transl_except: %s" % value)
        if parts[0][:4] != "pos:":
            raise ValueError("Invalid transl_except position: %s" % parts[0])
        if parts[1][:3] != "aa:":
            raise ValueError("Unknown transl_except modification: %s" % parts[1])
        loc = location.parse_str(parts[0][4:])
        acid = parts[1][3:].upper()
        if acid not in bioseq.data.AMINO_ACID_TLC:
            raise ValueError("Unknown Amino Acid code: %s" % acid)
        ret.append(gbobj.GBObj({
            "location": loc,
            "modification": bioseq.data.AMINO_ACID_TLC[acid]
        }))
    return ret
Esempio n. 2
0
def kw_contig(stream, kw):
    _no_subkeys(stream, "CONTIG", kw)
    return location.parse_str(''.join(kw["value"].split()))