Re: [PyMOL] Paths to loaded objects

2006-08-23 Thread Robert Campbell
Hi folks,

* Michael Lerner mgler...@gmail.com [2006-08-21 12:26] wrote:
 I think he means for you to have a Load button as part of your
 plugin.  That button would first record the path to the file and then
 call through to cmd.load().

Perhaps what Ron needs to do is not use the cmd.load() function but
use his own file reading procedure.  The lines containing coordinates
could be extracted from the file (by recognizing them with a regexp) and
passed to the cmd.read_pdbstr() function.  The CGO commands could be
read separately.  Then there is no need to worry about where cmd.load()
thinks file is.

 On 8/19/06, Ron Jacak r...@email.unc.edu wrote:

  Peter,
 
   I'm working on a plugin that reads information appended to the
   end of PDB files to draw CGO objects.  Right now, I have the
   user specify the filesystem path to the currently loaded objects
   through the plugin GUI so that I know where to go to find the
   file.  For one object, this isn't so bad.  But if users load
   multiple objects that are in different directories, I will have
   to change the GUI so that the user has to specify the path to
   each object loaded.  This kind of situation would quickly become
   tedious.  Does PyMOL store the paths for objects that are loaded
   somewhere?  I know I can get the current working directory using
   getcwd(), so I'm hoping there's a way to get the path to the
   loaded objects as well.
 
   I don't know of a way to get file information from a pymol object,
   but you could work around this by using a python dictionary (when
   the pdb file is loaded, store the full path to the file in a
   dictionary using the pymol object name as the key).
 
  I'm not sure I fully understand your suggestion.  It sounds to
  me like what you're saying is that I should add code (e.g. a
  dictionary) to the importing.py load() function which saves the
  file information of objects as they're loaded.  But then instead of
  just distributing my plugin, I would have to get users to change
  their PyMOL source, as well (which I'm not willing to do).  Am I
  understanding correctly?
 
  Any other ways around this problem?

Cheers,
Rob
-- 
Robert L. Campbell, Ph.D.
Senior Research Associate/Adjunct Assistant Professor 
Department of Biochemistry, Queen's University
Kingston, ON K7L 3N6  Canada
Tel: 613-533-6821Fax: 613-533-2497
robert.campb...@queensu.ca http://adelie.biochem.queensu.ca/~rlc



Re: [PyMOL] Paths to loaded objects

2006-08-23 Thread Ron Jacak



I think he means for you to have a Load button as part of your
plugin.  That button would first record the path to the file and then
call through to cmd.load().


Perhaps what Ron needs to do is not use the cmd.load() function but
use his own file reading procedure.  The lines containing coordinates
could be extracted from the file (by recognizing them with a  
regexp) and

passed to the cmd.read_pdbstr() function.  The CGO commands could be
read separately.  Then there is no need to worry about where  
cmd.load()

thinks file is.



Rob, thanks for the response.  I'm currently using a variation of  
what you wrote above.  It's just that the primary use case in my  
lab is to load multiple structures at once when starting pymol on the  
command line.

$ pymol 1AAA.pdb 1AAB.pdb 1AAC.pdb  or, more frequently
$ pymol *.pdb

I then want the user to be able to click on my plugin in the Plugin  
menu and have it run without the need for a GUI asking where to find  
the files (so I can reread them for the extra info I need).  In the  
example above, there's no problem: The files are all located in the  
current working directory so I know where to find them.  I start  
having problems when users do things as below:


$ pymol ../1AAD.pdb ~/jsmith/1AAE.pdb ./structures/1AAF.pdb

When PyMOL loads these structures, it drops the path information to  
create the object name and none of these structures are in the  
current working directory.  Hence, my plugin can't find the files.


For the time being, I'm going to instruct users in my lab that the  
structures they load must be in the same directory as the one from  
which they execute pymol.  At some point I will (hopefully) release  
the plugin to the public.  If I see that it's being used, I'll  
consider adding some preprocessing step that checks to see if the  
files can be found and if not, maybe execute a restricted find  
command up and down one or two directories or pop up a GUI that asks  
users to specify where to find the files (that couldn't be found).


I don't want to beat/flog a dead horse here, but other suggestions  
are always welcome.


Best,
-Ron





Re: [PyMOL] Paths to loaded objects

2006-08-22 Thread Peter Adrian Meyer
Ron,

 I'm not sure I fully understand your suggestion.  It sounds to me
 like what you're saying is that I should add code (e.g. a dictionary)
 to the importing.py load() function which saves the file information
 of objects as they're loaded.  But then instead of just distributing
 my plugin, I would have to get users to change their PyMOL source, as
 well (which I'm not willing to do).  Am I understanding correctly?

Well, I may have been misunderstanding you...I'd though you mentioned you
were using a gui to load the pdb files, which would be the natural place
to add additional code.  I'd assumed the gui you were talking about was
specific to your plugin (if this isn't the case, then my suggestion
doesn't help that much).

 Any other ways around this problem?

You could try turning on logging, and scan through the logfile looking for
load events (on my system, using the standard gui menus to open a pdb,
this stores the full path to the input pdb file; although it does not
associate it with the object name).  Of course then you're stuck with the
problem of getting the name/path of the logfile...

Good luck,

Pete

Pete Meyer
Fu Lab
BMCB grad student
Cornell University




Re: [PyMOL] Paths to loaded objects

2006-08-21 Thread Michael Lerner

I think he means for you to have a Load button as part of your
plugin.  That button would first record the path to the file and then
call through to cmd.load().

On 8/19/06, Ron Jacak r...@email.unc.edu wrote:

Peter,

 I'm working on a plugin that reads information appended to the end of
 PDB files to draw CGO objects.  Right now, I have the user specify
 the
 filesystem path to the currently loaded objects through the
 plugin GUI so that I know where to go to find the file.  For one
 object,
 this isn't so bad.  But if users load multiple objects that are in
 different directories, I will have to change the GUI so that the user
 has to specify the path to each object loaded.  This kind of
 situation
 would quickly become tedious.  Does PyMOL store the paths for objects
 that are loaded somewhere?  I know I can get the current working
 directory using getcwd(), so I'm hoping there's a way to get the
 path to
 the loaded objects as well.

 I don't know of a way to get file information from a pymol object,
 but you
 could work around this by using a python dictionary (when the pdb
 file is
 loaded, store the full path to the file in a dictionary using the
 pymol
 object name as the key).

I'm not sure I fully understand your suggestion.  It sounds to me
like what you're saying is that I should add code (e.g. a dictionary)
to the importing.py load() function which saves the file information
of objects as they're loaded.  But then instead of just distributing
my plugin, I would have to get users to change their PyMOL source, as
well (which I'm not willing to do).  Am I understanding correctly?

Any other ways around this problem?

-Ron


Ron Jacak
Graduate Student
University of North Carolina - Chapel Hill

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
PyMOL-users mailing list
PyMOL-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pymol-users





Re: [PyMOL] Paths to loaded objects

2006-08-19 Thread Ron Jacak

Peter,


I'm working on a plugin that reads information appended to the end of
PDB files to draw CGO objects.  Right now, I have the user specify  
the

filesystem path to the currently loaded objects through the
plugin GUI so that I know where to go to find the file.  For one  
object,

this isn't so bad.  But if users load multiple objects that are in
different directories, I will have to change the GUI so that the user
has to specify the path to each object loaded.  This kind of  
situation

would quickly become tedious.  Does PyMOL store the paths for objects
that are loaded somewhere?  I know I can get the current working
directory using getcwd(), so I'm hoping there's a way to get the  
path to

the loaded objects as well.


I don't know of a way to get file information from a pymol object,  
but you
could work around this by using a python dictionary (when the pdb  
file is
loaded, store the full path to the file in a dictionary using the  
pymol

object name as the key).


I'm not sure I fully understand your suggestion.  It sounds to me  
like what you're saying is that I should add code (e.g. a dictionary)  
to the importing.py load() function which saves the file information  
of objects as they're loaded.  But then instead of just distributing  
my plugin, I would have to get users to change their PyMOL source, as  
well (which I'm not willing to do).  Am I understanding correctly?


Any other ways around this problem?

-Ron


Ron Jacak
Graduate Student
University of North Carolina - Chapel Hill



[PyMOL] Paths to loaded objects

2006-08-18 Thread Ron Jacak

Hi all,

I'm working on a plugin that reads information appended to the end of  
PDB files to draw CGO objects.  Right now, I have the user specify  
the filesystem path to the currently loaded objects through the  
plugin GUI so that I know where to go to find the file.  For one  
object, this isn't so bad.  But if users load multiple objects that  
are in different directories, I will have to change the GUI so that  
the user has to specify the path to each object loaded.  This kind of  
situation would quickly become tedious.  Does PyMOL store the paths  
for objects that are loaded somewhere?  I know I can get the current  
working directory using getcwd(), so I'm hoping there's a way to get  
the path to the loaded objects as well.


I've searched all over the Wiki and the mailing list archives and I  
haven't been able to find anything relevant.  I also looked through  
importing.py but all I saw was cmd.exp_path() and it doesn't seem to  
me like the full path that's returned is being stored anywhere.   
Perhaps in the C layers it gets saved somewhere?


Thanks for any help,
-Ron


Ron Jacak
Graduate Student
University of North Carolina - Chapel Hill



Re: [PyMOL] Paths to loaded objects

2006-08-18 Thread Peter Adrian Meyer
Hi,

 I'm working on a plugin that reads information appended to the end of
PDB files to draw CGO objects.  Right now, I have the user specify the
filesystem path to the currently loaded objects through the
 plugin GUI so that I know where to go to find the file.  For one object,
this isn't so bad.  But if users load multiple objects that are in
different directories, I will have to change the GUI so that the user
has to specify the path to each object loaded.  This kind of situation
would quickly become tedious.  Does PyMOL store the paths for objects
that are loaded somewhere?  I know I can get the current working
directory using getcwd(), so I'm hoping there's a way to get the path to
the loaded objects as well.

I don't know of a way to get file information from a pymol object, but you
could work around this by using a python dictionary (when the pdb file is
loaded, store the full path to the file in a dictionary using the pymol
object name as the key).

Of course the fact that I don't know how to get the full path from a pymol
object doesn't mean that there isn't a way...

Good luck,

Pete



Pete Meyer
Fu Lab
BMCB grad student
Cornell University