-
Notifications
You must be signed in to change notification settings - Fork 5
/
RS.py
29 lines (19 loc) · 564 Bytes
/
RS.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env python
# coding: utf-8
import pandas as pd
import numpy as np
from rdkit import Chem
import random
from rdkit.Chem.Draw import IPythonConsole
from rdkit.Chem import Draw
from rdkit.Chem import DataStructs
from rdkit.Chem import AllChem
IPythonConsole.ipython_useSVG=True
import sys
name = sys.argv[1]
mols = [ mol for mol in Chem.SDMolSupplier( name + ".sdf", removeHs=False ) ]
random_mol = random.sample(mols, 15000)
w = Chem.SDWriter(name + '15KRandom'+'.sdf')
for m in random_mol:
w.write(m)
w.close()