Re: [PyMOL] How to forbid merging of files?

2015-06-16 Thread Folmer Fredslund
Hi Alsa,

In the line where you save the file, you need to specify a selection,
otherwise, everything will be saved
Look at http://www.pymolwiki.org/index.php/Save#PYMOL_API

So instead of
cmd.save(filenameN + '.mol')
you want something like
cmd.save(filenameN + '.mol', filename)

I haven't tested this myself though.

Hope this helps
Folmer


2015-06-06 11:53 GMT+02:00 AE alsalisb...@yahoo.com:

 Good day,

 I have several thousands of files, which I upload using the loop:

 myDir = ‘/dirWithFiles'
 for filename in os.listdir(myDir):
 cmd.load (filename)
 filenameN = os.path.splitext(filename)[0]
 cmd.save(filenameN + '.mol')
 cmd.disable(filename)

 I am trying to save them one by one in a different (.mol) format. However,
 the files are saved together, i.e.: first file opened contains only
 molecule from the first file; second: first + second; third: first + second
 + third etc. But I want firstFile.readableFormat to be converted into
 firstFile.mol, secondFile.readableFormat - secondFile.mol etc, without any
 addition of other files. How can I do that?

 Thank you,

 Best Regards,

 Alsa

 Sorry I have sent it already, accidentally forgot to finish the question
 in subject(

 --
 ___
 PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
 Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
 Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net




-- 
Folmer Fredslund
--
___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

Re: [PyMOL] How to forbid merging of files?

2015-06-07 Thread Schubert, Carsten [JRDUS]
AE, 

you need to delete the loaded file before loading another. cmd.save will save 
ALL objects in the buffer by default as you have experienced yourself. Also 
your handling of the filename is slightly off, since pymol strips the extender 
upon loading, i.e. test01.pdb becomes test01 object. You have two choices 
here, either you can retain all files in the buffer (not sure if this is your 
intention) or use Pymol as a file converter (you could use BABEL for that as 
well, might work better ?!). This is how I would write the code (untested 
however):

cmd.reinitialize()
myDir = ‘/dirWithFiles'

for filename in os.listdir(myDir):
cmd.load (filename)
obj_name = os.path.splitext(filename)[0]
filenameN = obj_name + '.mol'
cmd.save(filename, obj_name)
cmd.delete(obj_name)# comment out this line of you want to keep all 
files in the buffer


-Original Message-
From: AE [mailto:alsalisb...@yahoo.com] 
Sent: Saturday, June 06, 2015 5:54 AM
To: pymol-users@lists.sourceforge.net
Subject: Re: [PyMOL] How to forbid merging of files?

Good day,

I have several thousands of files, which I upload using the loop:

myDir = ‘/dirWithFiles'
for filename in os.listdir(myDir):
cmd.load (filename)
filenameN = os.path.splitext(filename)[0]
cmd.save(filenameN + '.mol')
cmd.disable(filename)

I am trying to save them one by one in a different (.mol) format. However, the 
files are saved together, i.e.: first file opened contains only molecule from 
the first file; second: first + second; third: first + second + third etc. But 
I want firstFile.readableFormat to be converted into firstFile.mol, 
secondFile.readableFormat - secondFile.mol etc, without any addition of other 
files. How can I do that?

Thank you,

Best Regards,

Alsa

Sorry I have sent it already, accidentally forgot to finish the question in 
subject(
--
___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
--
___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

Re: [PyMOL] How to forbid merging of files?

2015-06-06 Thread AE
Good day,

I have several thousands of files, which I upload using the loop:

myDir = ‘/dirWithFiles'
for filename in os.listdir(myDir):
cmd.load (filename)
filenameN = os.path.splitext(filename)[0]
cmd.save(filenameN + '.mol')
cmd.disable(filename)

I am trying to save them one by one in a different (.mol) format. However, the 
files are saved together, i.e.: first file opened contains only molecule from 
the first file; second: first + second; third: first + second + third etc. But 
I want firstFile.readableFormat to be converted into firstFile.mol, 
secondFile.readableFormat - secondFile.mol etc, without any addition of other 
files. How can I do that?

Thank you,

Best Regards,

Alsa

Sorry I have sent it already, accidentally forgot to finish the question in 
subject(
--
___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net