Exemplo n.º 1
0
def remove_inchi_prefix(string):
    """
    Splits off the 'InChI=1S' or 'InChI=1' layer of an InChI
    and returns the last part.
    """

    if not INCHI_PREFIX in string:
        raise InchiException('Not a valid InChI: {}'.format(string))

    return re.split(r"(InChI=1+)(S*)/", string)[-1]
Exemplo n.º 2
0
    def __new__(self, inchi):
        if not INCHI_PREFIX in inchi:
            raise InchiException('Not a valid InChI: {}'.format(inchi))

        return str.__new__(self, remove_inchi_prefix(inchi))