Commit 3c820a2f authored by mlocatelli's avatar mlocatelli 🍁
Browse files
parents 41cef1d6 8ec6db1f
Pipeline #2513 canceled with stages
......@@ -132,6 +132,21 @@ class Molrepo(Base):
return res
def to_csv(staticmethod, filename):
"""Write molecules InChI-Key, source_id, InChI and SMILES to CSV file.
filename(str): Path to a CSV file.
import pandas as pd
molecules = Molrepo.get_by_molrepo_name(molrepo_name)
df = pd.DataFrame(molecules, columns=['molrepo','source_id','SMILES','InChIKey','InChI'])
df.sort_values('InChIKey', inplace=True)
df[['InChIKey', 'source_id', 'SMILES','InChI']].to_csv(filename, index=False)
def from_csv(filename):
"""Add entries from CSV file.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment