Hi,

On Unix-like systems, stock pymol installs all images/data files/demo
stuff under /usr/lib/python2.x/site-packages/pymol/. I believe this is a
violation of the File Hierachy Standard (FHS) (well, at least its
spirit, I'm not sure about the letter), as only architecture-dependent
files should be under /usr/lib. 

Thus, I've cleaned up my current patch for pymol-0.88, replacing
$PYMOL_PATH with $PYMOL_DATA_PATH and $CHEMPY_DATA_PATH, under the
observation that $PYMOL_PATH is 99% only needed in order for the
examples and other stuff to find data.

Currently, I put everything under data/{pymol,chempy) under
/usr/share/pymol and test/dat/*, data/tut/*, examples/devel/cgo03.py
into /usr/share/pymol/demo. This can of course be tuned at will.

One needs to set $PYMOL_DATA_PATH and $CHEMPY_DATA_PATH of course, I'm
doing this in a small wrapper script:

#!/bin/sh
# debian wrapper script for pymol

export PYMOL_DATA_PATH=/usr/share/pymol
export CHEMPY_DATA_PATH=/usr/share/chempy

python /usr/lib/python2.2/site-packages/pymol/__init__.py


I've attached the patch, do you think that would make sense for pymol
proper as well? If not, I'll have to keep maintaining it in the debian
package.


cheers,

Michael
--- pymol-0.88.orig/examples/chempy/generate_amber.py
+++ pymol-0.88/examples/chempy/generate_amber.py
@@ -4,7 +4,7 @@
 from chempy import protein
 from chempy import protein_amber99
 
-model= io.pdb.fromFile("../../test/dat/pept.pdb")
+model= io.pdb.fromFile("$PYMOL_DATA_PATH/pept.pdb")
 
 model= protein.generate(model,forcefield=protein_amber99)
 
--- pymol-0.88.orig/examples/chempy/generate_mmff.py
+++ pymol-0.88/examples/chempy/generate_mmff.py
@@ -13,7 +13,7 @@
 #print 'c_terminal'
 #protein_mmff.check_sum(protein_mmff.c_terminal)
                        
-model= io.pdb.fromFile("../../test/dat/pept.pdb")
+model= io.pdb.fromFile("$PYMOL_DATA_PATH/pept.pdb")
 
 model= protein.generate(model,forcefield=protein_mmff,bondfield=bond_mmff)
 
--- pymol-0.88.orig/examples/devel/povray01.py
+++ pymol-0.88/examples/devel/povray01.py
@@ -4,7 +4,7 @@
 if not ('pept' in cmd.get_names()):
    cmd.delete('all')
    util.ray_shadows('heavy')
-   cmd.do('load $PYMOL_PATH/test/dat/pept.pdb')
+   cmd.do('load $PYMOL_DATA_PATH/pept.pdb')
    cmd.do('set surface_quality=1')
    cmd.do('show surface;hide lines;')
    cmd.zoom('all',10)
--- pymol-0.88.orig/modules/chempy/__init__.py
+++ pymol-0.88/modules/chempy/__init__.py
@@ -205,7 +205,7 @@
 elif os.environ.has_key('FREEMOL_MODULES'):
    path = os.environ['FREEMOL_MODULES'] + '/chempy/'
 else:
-   path = ''
+   path = '$CHEMPY_DATA_PATH/'
 
 # double check these values...
 #hvd values obtained from http://www.webelements.com/ and recorded to their
--- pymol-0.88.orig/modules/chempy/cex.py
+++ pymol-0.88/modules/chempy/cex.py
@@ -1,4 +1,3 @@
-#! /usr/bin/env python
 #A* -------------------------------------------------------------------
 #B* This file contains source code for the PyMOL computer program
 #C* copyright 1998-2000 by Warren Lyford Delano of DeLano Scientific. 
--- pymol-0.88.orig/modules/chempy/fragments/__init__.py
+++ pymol-0.88/modules/chempy/fragments/__init__.py
@@ -2,7 +2,7 @@
 import chempy
 from chempy import io
 
-path = chempy.path + 'fragments/'
+path = '$CHEMPY_DATA_PATH/fragments/'
 
 def get(name):
    return io.pkl.fromFile(path+name+'.pkl')
--- pymol-0.88.orig/modules/chempy/tinker/__init__.py
+++ pymol-0.88/modules/chempy/tinker/__init__.py
@@ -151,3 +151,4 @@
    if os.path.exists(test_path):
       params_path = test_path
 
+params_path = '$CHEMPY_DATA_PATH/tinker'
--- pymol-0.88.orig/modules/pymol/commanding.py
+++ pymol-0.88/modules/pymol/commanding.py
@@ -111,7 +111,7 @@
       r = None
       mode = int(mode)
       if mode == 1: # just show PNG
-         png_path = os.path.expandvars("$PYMOL_PATH/data/pymol/splash.png")
+         png_path = os.path.expandvars("$PYMOL_DATA_PATH/splash.png")
          if os.path.exists(png_path):
             cmd.do("_ cmd.load_png('%s',0,quiet=1)"%png_path)
             r = 1
--- pymol-0.88.orig/modules/pymol/fitting.py
+++ pymol-0.88/modules/pymol/fitting.py
@@ -59,7 +59,7 @@
       r = None
       source = selector.process(source)
       target = selector.process(target)
-      mfile = os.path.expandvars("$PYMOL_PATH/data/pymol/matrices/"+matrix)
+      mfile = os.path.expandvars("$PYMOL_DATA_PATH/matrices/"+matrix)
       if object==None: object=''
       try:
          lock()
--- pymol-0.88.orig/modules/pymol/wizard/demo.py
+++ pymol-0.88/modules/pymol/wizard/demo.py
@@ -80,10 +80,10 @@
          try:
             cmd.set("suspend_updates",1,quiet=1)
             cmd.disable()
-            cmd.do("cd $PYMOL_PATH")
+            cmd.do("cd $PYMOL_DATA_PATH")
             cmd.delete("pept")
             cmd.delete("pept_dist")
-            cmd.load("test/dat/pept.pdb")
+            cmd.load("demo/pept.pdb")
             cmd.show("sticks","(pept and not i;5:7)")
             cmd.show("surface","(pept and i;5,6)")
             cmd.show("mesh","(pept and i;1,11,12,13)")
@@ -103,7 +103,7 @@
          if not cleanup:
             cmd.disable()
             cmd.set("suspend_updates",1,quiet=1)
-            cmd.load("$PYMOL_PATH/test/dat/pept.pdb","rep1")
+            cmd.load("$PYMOL_DATA_PATH/demo/pept.pdb","rep1")
             cmd.alter("rep1///1-5+8-13/","ss='S'")
             cmd.cartoon("auto")
             cmd.hide("everything","rep1")
@@ -181,7 +181,7 @@
     -0.000086844,    0.000019042, -133.217041016,\
     11.377667427,   21.768899918,    9.270449638,\
    105.029335022,  169.626159668,    0.000000000 ))
-         cmd.load("$TUT/1hpv.r3d","cgo1")
+         cmd.load("$PYMOL_DATA_PATH/demo/1hpv.r3d","cgo1")
 #         cmd.delete("cgo1")
 #         cmd.delete("cgo2")
 #         cmd.load("test/dat/pept.r3d","cgo")
@@ -195,10 +195,10 @@
    def cgo(self,cleanup=0):
       if not cleanup:
          cmd.disable()
-         cmd.do("cd $PYMOL_PATH")
+         cmd.do("cd $PYMOL_DATA_PATH")
          try:
             cmd.set("suspend_updates",1,quiet=1)
-            cmd.do("run examples/devel/cgo03.py")
+            cmd.do("run demo/cgo03.py")
          finally:
             cmd.set("suspend_updates",0,quiet=1)
       else:
@@ -236,7 +236,7 @@
          try:
             cmd.set("suspend_updates",1,quiet=1)
             cmd.disable()
-            cmd.load("$TUT/1hpv.pdb")
+            cmd.load("$PYMOL_DATA_PATH/demo/1hpv.pdb")
             util.chainbow("1hpv")
             cmd.hide("everything","1hpv")
             cmd.show("cartoon","1hpv")
@@ -282,7 +282,7 @@
 
    def roving(self,cleanup=0):
       if not cleanup:
-         cmd.load("$PYMOL_PATH/test/dat/il2.pdb")
+         cmd.load("$PYMOL_DATA_PATH/demo/il2.pdb")
          cmd.remove("hydro")
          cmd.disable()
          cmd.enable("il2")
@@ -308,7 +308,7 @@
    def roving_density(self,cleanup=0):
       if not cleanup:
          try:
-            cmd.load("$PYMOL_PATH/test/dat/il2.pdb")
+            cmd.load("$PYMOL_DATA_PATH/demo/il2.pdb")
             cmd.set("suspend_updates",1,quiet=1)
             cmd.remove("hydro")
             cmd.disable()
@@ -354,7 +354,7 @@
             cmd.set("suspend_updates",1,quiet=1)
             cmd.disable()
             cmd.delete("1tii")      
-            cmd.load("$PYMOL_PATH/test/dat/1tii.pdb")
+            cmd.load("$PYMOL_DATA_PATH/demo/1tii.pdb")
             cmd.hide("(1tii)")
             cmd.show("cartoon","1tii")
             cmd.zoom("1tii")
@@ -373,7 +373,7 @@
          cmd.delete("pept")
          cmd.delete("e_pot")
          cmd.delete("e_lvl")
-         cmd.load("$PYMOL_PATH/test/dat/pept.pkl")
+         cmd.load("$PYMOL_DATA_PATH/demo/pept.pkl")
          cmd.hide("(pept)")
          cmd.show("surface","pept")
          cmd.set("coulomb_dielectric",80.0)
@@ -392,7 +392,7 @@
             cmd.set("suspend_updates",1,quiet=1)
             cmd.disable()
             cmd.delete("trans")
-            cmd.load("$PYMOL_PATH/test/dat/pept.pdb","trans")
+            cmd.load("$PYMOL_DATA_PATH/demo/pept.pdb","trans")
             cmd.hide("(trans)")
             cmd.show("surface","trans")
             cmd.show("sticks","trans")
@@ -410,7 +410,7 @@
          cmd.set("suspend_updates",1,quiet=1)
          cmd.disable()
          cmd.delete("ray")
-         cmd.load("$PYMOL_PATH/test/dat/il2.pdb","ray")
+         cmd.load("$PYMOL_DATA_PATH/demo/il2.pdb","ray")
          cmd.remove("(ray and hydro)")
          cmd.hide("lines","ray")
          cmd.show("spheres","ray")
@@ -433,7 +433,7 @@
          cmd.set("suspend_updates",1,quiet=1)
          cmd.disable()
          cmd.delete("sculpt")
-         cmd.load("$PYMOL_PATH/test/dat/pept.pdb","sculpt")
+         cmd.load("$PYMOL_DATA_PATH/demo/pept.pdb","sculpt")
          cmd.hide("lines","sculpt")
          cmd.show("sticks","sculpt")
          cmd.show("spheres","sculpt")
--- pymol-0.88.orig/modules/pymol/wizard/mutagenesis.py
+++ pymol-0.88/modules/pymol/wizard/mutagenesis.py
@@ -27,8 +27,7 @@
 
       Wizard.__init__(self)
 
-      self.library = io.pkl.fromFile(os.environ['PYMOL_PATH']+
-                                     "/data/chempy/sidechains/sc_library.pkl")
+      self.library = 
io.pkl.fromFile("$CHEMPY_DATA_PATH/sidechains/sc_library.pkl")
       
       self.status = 0 # 0 no selection, 1 mutagenizing
       self.error = None

Reply via email to