On 03/01/2012 16:29, Cyberbroker1 wrote:
the -m option works good, but is there anypossibility to make the filename
the molecule name?
There have been several requests for this, so I have added this
capability. It is currently only in the development code, and is
described a little more on
great, thank you again^^
But there is still one problem left.
import pybel
for mol in pybel.readfile(mol2, -output1.mol2): # I will have plenty of
outputX.mol2 files
filename = mol.OBMol.GetTitle()
filename = filename + .mol2
output = open(filename,w) # erase existing
If I understand correctly, then something like...
import pybel
for i in range(1,100):
inputfile = output%d.mol2 % i
mol = pybel.readfile(mol2, inputfile).next()
mol.write(mol2, mol.title + .mol2, overwrite=True)
On 4 January 2012 12:27, Cyberbroker1 rene.buett...@rwth-aachen.de wrote:
How about using Python's enumerate function as follows:
import pybel
for i, mol in enumerate(smi, testfile.smi):
mol.write(mol2, mol.title + .mol2, overwrite=True)
On 4 January 2012 13:36, Cyberbroker1 rene.buett...@rwth-aachen.de wrote:
Thank you very much.
You understand me exactly! Its
Sorry - I should probably use i at some point in the loop :-)
import pybel
for i, mol in enumerate(smi, testfile.smi):
mol.write(mol2, output%d.mol2 % i, overwrite=True)
On 4 January 2012 14:03, Noel O'Boyle baoille...@gmail.com wrote:
How about using Python's enumerate function as follows:
Hi,
Given a directory that your files are in, called input_dir the
following should start an iteration over all files called
outputsomething.mol2.
filtered_files = filter(lambda x:
(os.path.basename(x).lower().startswith(output) and
(os.path.splitext(x)[1].lower() == .mol2)),
that sounds good but i get an error:
'str' object cannot be interpreted as an index
--
View this message in context:
http://forums.openbabel.org/one-input-file-multiple-output-files-tp4254723p4261398.html
Sent from the General discussion mailing list archive at Nabble.com.
Hey guys.
I have an issue i can't figure out yet. So heres my problem:
I get one big file with multiple Molecules within. The file will look
something like this:
File
Heptane
Heptanol
I get one big file with multiple Molecules within. The file will look
something like this:
File
Heptane
Well, the biggest problem I see is that as you've written it, it isn't any
particular format supported by Open Babel. CML would probably be the best, and
it does support multiple
Great thank you.
the -m option works good, but is there anypossibility to make the filename
the molecule name?
Or is the way with the serial numbers the only way possible?
The files i get will only be written in a format supported by obabel. i just
have written it in my own words.
best,
Cy
10 matches
Mail list logo