예제 #1
0
def ether_groups(gra, filterlst=()):
    """ Determine the location of ether groups

        Returns a lsts of idxs of C-O-C groups
    """

    ether_grps = tuple()

    # Determing the indices of all rings in the molecule

    _ring_idxs = ring_idxs(rings(gra))

    coc_grps = two_bond_idxs(gra, asymb1='C', cent='O', asymb2='C')
    for coc_grp in coc_grps:
        c1_idx, o_idx, c2_idx = coc_grp
        if not _ring_idxs:
            ether_grps += ((c1_idx, o_idx, c2_idx),)
        else:
            for idxs in _ring_idxs:
                if not set(coc_grp) <= set(idxs):
                    ether_grps += ((c1_idx, o_idx, c2_idx),)

    ether_grps = filter_idxs(ether_grps, filterlst=filterlst)

    return ether_grps
예제 #2
0
def ether_groups(gra, filterlst=()):
    """ Determine the location of ether groups. The locations are
        specified as tuple of idxs indicating the C-O-C atoms
        of the group: (C-idx, O-idx, C-idx).

        :param gra: molecular graph
        :type gra: molecular graph data structure
        :rtype: tuple(int)
    """

    ether_grps = tuple()

    # Determing the indices of all rings in the molecule

    _ring_idxs = ring_idxs(rings(gra))

    coc_grps = two_bond_idxs(gra, symb1='C', cent='O', symb2='C')
    for coc_grp in coc_grps:
        c1_idx, o_idx, c2_idx = coc_grp
        if not _ring_idxs:
            ether_grps += ((c1_idx, o_idx, c2_idx), )
        else:
            for idxs in _ring_idxs:
                if not set(coc_grp) <= set(idxs):
                    ether_grps += ((c1_idx, o_idx, c2_idx), )

    ether_grps = filter_idxs(ether_grps, filterlst=filterlst)

    return ether_grps
예제 #3
0
def alcohol_groups(gra, filterlst=()):
    """ Determine the location alcohol groups

        Returns a lsts of idxs of C-O-H groups
    """
    alc_grps = two_bond_idxs(gra, asymb1='C', cent='O', asymb2='H')
    alc_grps = filter_idxs(alc_grps, filterlst=filterlst)

    return alc_grps
예제 #4
0
def alcohol_groups(gra, filterlst=()):
    """ Determine the location of alcohol groups. The locations are
        specified as tuple-of-tuple of idxs indicating the C-O-H atoms
        of the group: (C-idx, O-idx, H-idx).

        :param gra: molecular graph
        :type gra: molecular graph data structure
        :rtype: tuple(int)
    """

    alc_grps = two_bond_idxs(gra, symb1='C', cent='O', symb2='H')
    alc_grps = filter_idxs(alc_grps, filterlst=filterlst)

    return alc_grps
예제 #5
0
def ketone_groups(gra, filterlst=()):
    """ Determine the location of ketone groups

        Returns C-O bond idxs
    """

    ket_grps = tuple()

    co_bonds = bonds_of_type(gra, asymb1='C', asymb2='O', mbond=2)
    for co_bond in co_bonds:
        c_idx, o_idx = co_bond
        c_neighs = neighbors_of_type(gra, c_idx, asymb='H')
        if not c_neighs:
            ket_grps += ((c_idx, o_idx),)

    ket_grps = filter_idxs(ket_grps, filterlst=filterlst)

    return ket_grps
예제 #6
0
def aldehyde_groups(gra, filterlst=()):
    """ Determine the location of aldehyde groups

        Returns C-O bond idxs
    """

    ald_grps = tuple()

    co_bonds = bonds_of_type(gra, asymb1='C', asymb2='O', mbond=2)
    for co_bond in co_bonds:
        c_idx, o_idx = co_bond
        c_neighs = neighbors_of_type(gra, c_idx, asymb='H')
        if c_neighs:
            ald_grps += ((c_idx, o_idx),)

    ald_grps = filter_idxs(ald_grps, filterlst=filterlst)

    return ald_grps
예제 #7
0
def ketone_groups(gra, filterlst=()):
    """ Determine the location of ketone groups. The locations are
        specified as tuple-of-tuple of idxs indicating the C-O atoms
        of the group: (C-idx, O-idx).

        :param gra: molecular graph
        :type gra: molecular graph data structure
        :rtype: tuple(int)
    """

    ket_grps = tuple()

    co_bonds = bonds_of_type(gra, symb1='C', symb2='O', mbond=2)
    for co_bond in co_bonds:
        c_idx, o_idx = co_bond
        c_neighs = neighbors_of_type(gra, c_idx, symb='H')
        if not c_neighs:
            ket_grps += ((c_idx, o_idx), )

    ket_grps = filter_idxs(ket_grps, filterlst=filterlst)

    return ket_grps