<jupyter_start><jupyter_text>QSAR-Ready Smiles files generated from CompTox Chemistry Dashboard batch search using CASRN input type at: https://comptox.epa.gov/dashboard/dsstoxdb/batch_search<jupyter_code>ls *xlsx
xls = pd.ExcelFile('qsar_smiles_from_casn_ChemistryDashboard-Batch-Search_2020-04-22_09_10_45.xlsx')
xls.sheet_names
mc5 = xls.parse('Worksheet1')
mc5.head()
mc5.shape
no_smiles = mc5[mc5['QSAR_READY_SMILES'] == '-']
no_smiles.head()
no_smiles.to_csv('/share/home3/ttate/ltea_R/fp_toxprints_for_genra_py/mc5_no_smiles.csv')
mc5 = mc5[mc5['QSAR_READY_SMILES'] != '-']
mc5.shape
mc5_dict = {k:v for k,v in zip(mc5['DTXSID'], mc5['QSAR_READY_SMILES'])}
smi = {k:Chem.MolFromSmiles(v) for k,v in mc5_dict.items()}<jupyter_output><empty_output><jupyter_text>Generation of Torsion Finger Prints<jupyter_code>from rdkit.Chem.rdMolDescriptors import GetHashedTopologicalTorsionFingerprintAsBitVect
tts ={k:GetHashedTopologicalTorsionFingerprintAsBitVect(v) for k,v in smi.items()}
tts_list={k:list(v) for k,v in tts.items()}
tts_df=pd.DataFrame.from_dict(tts_list).T
tts_df.head()
tts_df.shape
tts_df = tts_df.add_prefix('tptr_')
tts_df = tts_df.reset_index()
tts_df.rename(columns = {'index':'DTXSID'}, inplace = True)
tts_df = tts_df.set_index('DTXSID')
tts_df.head()
tts_df.to_csv('ltea_torsionfp_04.24.2020.tsv', sep='\t')<jupyter_output><empty_output><jupyter_text>Genearation of Morgan Fingeprints     radius=3    bit length = 2048<jupyter_code>from rdkit.Chem.rdMolDescriptors import GetMorganFingerprintAsBitVect
mfp={k:GetMorganFingerprintAsBitVect(v, 3, nBits=2048) for k, v in smi.items()}
mfp_list={k:list(v) for k,v in mfp.items()}
mfp_df=pd.DataFrame.from_dict(mfp_list).T
mfp_df.head()
mfp_df = mfp_df.add_prefix('mrgn_')
mfp_df = mfp_df.reset_index()
mfp_df.rename(columns = {'index':'DTXSID'}, inplace = True)
mfp_df = mfp_df.set_index('DTXSID')
mfp_df.shape
mfp_df.head()
mfp_df.to_csv('ltea_morganfp_04.24.2020.tsv', sep='\t')
#fps = pd.concat([mfp_df, tts_df.reindex(mfp_df.index)], axis = 1)
fps = pd.concat([mfp_df, tts_df], axis = 1)
fps.shape
fps.head()
#fps.to_csv('ltea_fps_05.08.2020.tsv', sep='\t')<jupyter_output><empty_output><jupyter_text>ToxPrints were generated from the chemical dashboard: ToxPrint fingerprints (ChemoTyper format - CSV/TSV only)<jupyter_code>txp = pd.read_csv('S6-toxprint.tsv', delimiter='\t')
txp = pd.DataFrame(txp)
txp.head()
txp.shape
txp =txp.drop(columns=['INPUT'])
pre_names = [(i, 'toxp_'+i) for i in txp.iloc[:, 2:].columns.values]
txp.rename(columns = dict(pre_names), inplace = True)
txp = txp.set_index(['DTXSID'])
txp.head()
#fps = pd.concat([txp, fps.reindex(txp.index)], axis = 1)
fps= pd.concat([txp, fps], axis = 1, join='inner')
fps.head()
fps.shape
fps.to_csv('ltea_fps_05.08.2020.tsv', sep='\t')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1601283880171184, 'fraction_numerical': 0.02781740370898716, 'mean_word_length': 7.474320241691843, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 1, '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': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '576296', 'license': 'MIT', 'n_tokens_mistral': 1328, 'n_tokens_neox': 1273, 'n_words': 181, 'path': 'notebooks/tt/001-tt-ltea-fp.ipynb', 'repo_name': 'i-shah/genra-ltea', 'size': '2804'}