<jupyter_start><jupyter_text>Similarity among docked molecules docked_mols are at the beginning of the notebook<jupyter_code>initial_docked_similarity = get_similarity_lists_of_mols([Chem.MolFromSmiles(smi) for smi in docked_mols], docked_mols)
dataframe_docked = pd.DataFrame(initial_docked_similarity, columns=['Tanimoto similarity among docked molecules distribution'])
dataframe_docked.hist()
print("MIN similarity: "+str(min(initial_docked_similarity)))
print("MAX similarity: "+str(max(initial_docked_similarity)))
list_to_be_ = []
list_to_be_
for mol in range(len(standarized_mols)): #comparision between generated mols
    simil = get_similarity(Chem.MolFromSmiles(standarized_mols[mol]), standarized_mols)
    list_to_be_.append(simil)
list_to_be_[0][0:5]
NEC = standarized_mols.copy()
KMV = standarized_mols.copy()
for elem in range(len(standarized_mols)):
    NEC[elem] = pd.DataFrame(list_to_be_[elem], columns=[standarized_mols[elem]])
frames = (NEC)
Final = pd.concat(frames, axis=1)
Final.head()
Final['CCC(=O)NCc1ccnn1[SH]1C=C(c2ccccc2F)NN1'][0]
import matplotlib.pyplot as plt
plt.figure(figsize = (30, 20))
plt.imshow(Final, interpolation='nearest')
ax = plt.gca()
ax.set_xticks(range(0,len(standarized_mols),1))
ax.set_yticks(range(0,len(standarized_mols),1))
plt.colorbar()
stg = Final.columns.values.tolist()
for i in range(len(standarized_mols)):
    for j in range(len(standarized_mols)):
        text = ax.text(j, i, round(Final[stg[i]][j],2), ha="center", va="center", color="w")
plt.savefig("../prediction_and_selection/tmp/heatmap_similarity.svg")
plt.show()
Final<jupyter_output><empty_output><jupyter_text>Checking if the data created is very similar to training data<jupyter_code>whole_data_set = pd.read_parquet('../model/data/zinc20_selected_to_create_model_processed.parquet')
whole_data_set.head()<jupyter_output><empty_output><jupyter_text>Training was done on 121,000 of molecules Tanimoto simalirity distribution among newly generated and trained SMILES<jupyter_code>whole_data_set = whole_data_set['SMILES_canonical']
len(whole_data_set)
whole_data_set_smi = [Chem.MolFromSmiles(smi) for smi in whole_data_set]
whole_data_set_smi[0]
#isomeric SMILES to canonical SMILES
whole_data_set_smi_cannonical = []
for mol in whole_data_set_smi:
    cannonical = Chem.MolToSmiles(mol, isomericSmiles=False)
    whole_data_set_smi_cannonical.append(cannonical)
whole_data_set_smi_cannonical[0:3]
whole_data_set_smi[0]
whole_data_set_smi_cannonical[0]
whole_data_set_smi_cannonical_mol = [Chem.MolFromSmiles(smi) for smi in whole_data_set_smi_cannonical]
whole_data_set_smi_cannonical_mol[0]
df = get_similarity_lists_of_mols(whole_data_set_smi_cannonical_mol, docked_mols) #second param as list of SMILES
dataframe_train = pd.DataFrame(df, columns=['Tanimoto simalirity distribution among newly generated and trained SMILES'])
dataframe_train.hist()
print("MIN similarity: "+str(min(df)))
print("MAX similarity: "+str(max(df)))
plt.figure(figsize=(10,5))
plt.hist(dataframe_train['Tanimoto simalirity distribution among newly generated and trained SMILES'],bins=100)
plt.xlabel('Tanimoto similarity', fontsize=14)
plt.ylabel('Frequency', fontsize=14)
#plt.title('Histogram of Tanimoto similarity distribution')
plt.grid(True)
plt.savefig("../prediction_and_selection/tmp/Tanimoto simalirity distribution among newly generated and trained SMILES.svg")
plt.show()

print(dataframe_train['Tanimoto simalirity distribution among newly generated and trained SMILES'].describe())
new_ = dataframe_train[dataframe_train['Tanimoto simalirity distribution among newly generated and trained SMILES']>0.5]
len(new_['Tanimoto simalirity distribution among newly generated and trained SMILES'])<jupyter_output><empty_output><jupyter_text>Check if initial SMILES is present in PUBCHEM database (ROR-gamma active)<jupyter_code>def find_smiles_in_PUBCHEM(smiles):
    compounds = []
    try:
        compound = pcp.get_compounds(smiles, 'smiles')
        compounds.append(compound)
    except:
        print("Not found : "+ str(smiles))
    return compounds
test_if_initial_data_can_be_found = [find_smiles_in_PUBCHEM(smiles) for smiles in initial_smi['SMILES']]
len(test_if_initial_data_can_be_found)
test_if_initial_data_can_be_found<jupyter_output><empty_output><jupyter_text>Check if newly generated SMILES is present in PUBCHEM database<jupyter_code>test_if_newly_generated_data_can_be_found = [find_smiles_in_PUBCHEM(smiles) for smiles in to_check_in_PUBCHEM]
test_if_newly_generated_data_can_be_found
smiles_found_in_pubchem = []
for i in range(len(test_if_newly_generated_data_can_be_found)):
    try:
        smiles_found_in_pubchem.append(test_if_newly_generated_data_can_be_found[i][0][0].canonical_smiles)
    except:
        pass
smiles_found_in_pubchem_1 = []
for val in smiles_found_in_pubchem:
    if val != None :
        smiles_found_in_pubchem_1.append(val)
smiles_found_in_pubchem_1<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10317620878009306, 'fraction_numerical': 0.010317620878009305, 'mean_word_length': 8.471264367816092, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '109113', 'license': 'MIT', 'n_tokens_mistral': 1893, 'n_tokens_neox': 1815, 'n_words': 311, 'path': 'Tanimoto_similarity/Tanimoto_similarity-SYBA_selection.ipynb', 'repo_name': 'XDamianX-coder/seq_to_seq_and_dock_AMU', 'size': '4943'}