I had to split the compound with more than 1 million entries into several files, so I looked it up.
At first I was looking at open babel etc. http://openbabel.org/wiki/--splitinto As far as I can see, it seems that this function is not implemented as of openbabel 2.3.0, and 2.3.1 at hand was also useless.
So I made my own code. Just move for the time being! The soul is revealed! https://github.com/keisuke-yanagisawa/python-tools/blob/master/split_mol2.py
python split_mol2.py hoge.mol2 #Default for every 10000 compounds
python split_mol2.py -n 100 hoge.mol2 #Divided every 100 compounds
You can use it like this.
A -v
option is also provided so that you can see what name the file is being output.
2016.04.17 It also supports sdf files. (The way of execution has not changed https://github.com/keisuke-yanagisawa/python-tools/blob/master/split_sdf.py
python split_sdf.py hoge.sdf #Default for every 10000 compounds
python split_sdf.py -n 100 hoge.sdf #Divided every 100 compounds
python split_sdf.py -v hoge.sdf #You can see what the name of the file was output
Recommended Posts