(mol, radius)
return list(alternating_sentence)
Same as mol2sentence() expect it only returns the alternating sentence
    Calculates ECFP (Morgan fingerprint) and returns identifiers of substructures as 'sentence' (string).
    Returns a tuple with 1) a list with sentence for each radius and 2) a sentence with identifiers from all radii
    combined.
    NOTE: Words are ALWAYS reordered according to atom order in the input mol object.
    NOTE: Due to the way how Morgan FPs are generated, number of identifiers at each radius is smaller
    
    Parameters
    ----------
    mol : rdkit.Chem.rdchem.Mol
    radius : float 
        Fingerprint radius
    
    Returns
    -------
    list
        alternating sentence
    combined
Same as mol2sentence() expect it only returns the alternating sentence
    Calculates ECFP (Morgan fingerprint) and returns identifiers of substructures as 'sentence' (string).
    Returns a tuple with 1) a list with sentence for each radius and 2) a sentence with identifiers from all radii
    combined.
    NOTE: Words are ALWAYS reordered according to atom order in the input mol object.
    NOTE: Due to the way how Morgan FPs are generated, number of identifiers at each radius is smaller
    
    Parameters
    ----------
    mol : rdkit.Chem.rdchem.Mol
    radius : float 
        Fingerprint radius
    
    Returns
    -------
    list
        alternating sentence
    combined
Same as mol2sentence () expect it only returns the alternating sentence Calculates ECFP ( Morgan fingerprint ) and returns identifiers of substructures as sentence ( string ) . Returns a tuple with 1 ) a list with sentence for each radius and 2 ) a sentence with identifiers from all radii combined . NOTE : Words are ALWAYS reordered according to atom order in the input mol object . NOTE : Due to the way how Morgan FPs are generated number of identifiers at each radius is smaller Parameters ---------- mol : rdkit . Chem . rdchem . Mol radius : float Fingerprint radius Returns ------- list alternating sentence combined
def mol2alt_sentence(mol, radius):
    """Same as mol2sentence() expect it only returns the alternating sentence
    Calculates ECFP (Morgan fingerprint) and returns identifiers of substructures as 'sentence' (string).
    Returns a tuple with 1) a list with sentence for each radius and 2) a sentence with identifiers from all radii
    combined.
    NOTE: Words are ALWAYS reordered according to atom order in the input mol object.
    NOTE: Due to the way how Morgan FPs are generated, number of identifiers at each radius is smaller
    
    Parameters
    ----------
    mol : rdkit.Chem.rdchem.Mol
    radius : float 
        Fingerprint radius
    
    Returns
    -------
    list
        alternating sentence
    combined
    """
    radii = list(range(int(radius) + 1))
    info = {}
    _ = AllChem.GetMorganFingerprint(mol, radius, bitInfo=info)  # info: dictionary identifier, atom_idx, radius

    mol_atoms = [a.GetIdx() for a in mol.GetAtoms()]
    dict_atoms = {x: {r: None for r in radii} for x in mol_atoms}

    for element in info:
        for atom_idx, radius_at in info[element]:
            dict_atoms[atom_idx][radius_at] = element  # {atom number: {fp radius: identifier}}

    # merge identifiers alternating radius to sentence: atom 0 radius0, atom 0 radius 1, etc.
    identifiers_alt = []
    for atom in dict_atoms:  # iterate over atoms
        for r in radii:  # iterate over radii
            identifiers_alt.append(dict_atoms[atom][r])

    alternating_sentence = map(str, [x for x in identifiers_alt if x])

    return list(alternating_sentence)
def mol2alt_sentence ( mol , radius ) : radii = list ( range ( int ( radius ) + 1 ) ) info = { } _ = AllChem . GetMorganFingerprint ( mol , radius , bitInfo = info ) # info: dictionary identifier, atom_idx, radius mol_atoms = [ a . GetIdx ( ) for a in mol . GetAtoms ( ) ] dict_atoms = { x : { r : None for r in radii } for x in mol_atoms } for element in info : for atom_idx , radius_at in info [ element ] : dict_atoms [ atom_idx ] [ radius_at ] = element # {atom number: {fp radius: identifier}} # merge identifiers alternating radius to sentence: atom 0 radius0, atom 0 radius 1, etc. identifiers_alt = [ ] for atom in dict_atoms : # iterate over atoms for r in radii : # iterate over radii identifiers_alt . append ( dict_atoms [ atom ] [ r ] ) alternating_sentence = map ( str , [ x for x in identifiers_alt if x ] ) return list ( alternating_sentence )