(smiles, sanitize=True)
return new_smiles
Takes list of SMILES strings and returns list of their canonical SMILES.
        Args:
            smiles (list): list of SMILES strings
            sanitize (bool): parameter specifying whether to sanitize
            SMILES or not.
            For definition of sanitized SMILES check
            www.rdkit.org/docs/api/rdkit.Chem.rdmolops-module.html#SanitizeMol
        Output:
            new_smiles (list): list of canonical SMILES and NaNs
            if SMILES string is invalid or unsanitized
            (when 'sanitize = True')
        When 'sanitize = True' the function is analogous to:
        sanitize_smiles(smiles, canonize=True).
Takes list of SMILES strings and returns list of their canonical SMILES.
        Args:
            smiles (list): list of SMILES strings
            sanitize (bool): parameter specifying whether to sanitize
            SMILES or not.
            For definition of sanitized SMILES check
            www.rdkit.org/docs/api/rdkit.Chem.rdmolops-module.html#SanitizeMol
        Output:
            new_smiles (list): list of canonical SMILES and NaNs
            if SMILES string is invalid or unsanitized
            (when 'sanitize = True')
        When 'sanitize = True' the function is analogous to:
        sanitize_smiles(smiles, canonize=True).
Takes list of SMILES strings and returns list of their canonical SMILES . Args : smiles ( list ) : list of SMILES strings sanitize ( bool ) : parameter specifying whether to sanitize SMILES or not . For definition of sanitized SMILES check www . rdkit . org / docs / api / rdkit . Chem . rdmolops - module . html#SanitizeMol Output : new_smiles ( list ) : list of canonical SMILES and NaNs if SMILES string is invalid or unsanitized ( when sanitize = True ) When sanitize = True the function is analogous to : sanitize_smiles ( smiles canonize = True ) .
def canonize_smiles(smiles, sanitize=True):
    """
    Takes list of SMILES strings and returns list of their canonical SMILES.
        Args:
            smiles (list): list of SMILES strings
            sanitize (bool): parameter specifying whether to sanitize
            SMILES or not.
            For definition of sanitized SMILES check
            www.rdkit.org/docs/api/rdkit.Chem.rdmolops-module.html#SanitizeMol
        Output:
            new_smiles (list): list of canonical SMILES and NaNs
            if SMILES string is invalid or unsanitized
            (when 'sanitize = True')
        When 'sanitize = True' the function is analogous to:
        sanitize_smiles(smiles, canonize=True).
    """
    new_smiles = []
    idx = []
    for i in range(len(smiles)):
        sm = smiles[i]
        try:
            new_smiles.append(Chem.MolToSmiles(Chem.MolFromSmiles(sm, sanitize=sanitize)))
            idx.append(i)
        except:
            new_smiles.append('')

        if len(idx) != len(smiles):
            invalid_rate = 1.0 - len(idx) / len(smiles)
            warnings.warn('Proportion of unsanitized smiles is %.3f ' % (invalid_rate))
    return new_smiles
def canonize_smiles ( smiles , sanitize = True ) : new_smiles = [ ] idx = [ ] for i in range ( len ( smiles ) ) : sm = smiles [ i ] try : new_smiles . append ( Chem . MolToSmiles ( Chem . MolFromSmiles ( sm , sanitize = sanitize ) ) ) idx . append ( i ) except : new_smiles . append ( '' ) if len ( idx ) != len ( smiles ) : invalid_rate = 1.0 - len ( idx ) / len ( smiles ) warnings . warn ( 'Proportion of unsanitized smiles is %.3f ' % ( invalid_rate ) ) return new_smiles