I looked into this a little. I think the apbs script (its apbs.py or something -- if you can't find it search for it on google) calls a function called cmd.ramp_new() with a bunch of arguements. Apparently this 'ramp' is a built in c-level object. You maybe able to mimic the code in apbs. What part of the color ramp are you trying to use in your app ?

~Dan


Hi Dan,
I saw this function in "apbs_tools.py":
        ramp_name = 'e_lvl'
        map_name = self.map.getvalue()
        molecule_name = self.molecule.getvalue()
        low = float(self.mol_surf_low.getvalue())
        mid = float(self.mol_surf_middle.getvalue())
        high = float(self.mol_surf_high.getvalue())
        range = [low,mid,high]
        print "range is",range
        pymol.cmd.delete(ramp_name)
        pymol.cmd.ramp_new(ramp_name,map_name,range)
        pymol.cmd.set('surface_color',ramp_name,molecule_name)
        pymol.cmd.show('surface',molecule_name)
        pymol.cmd.sort()

My range will be always the same, and the ramp_name too.
But, how to set map_name and molecule_name ?
With coordinates, or something else ?

I found a way to add a legend box:

load Legend.dx, map   #with Legend.dx as an empty file
zoom PDB_ID           #to view our structure again
ramp_new legend, map, [1.0,5.0,9.0], color=['C1',[1.0,1.0,1.0],'C9']
                      #legend is the object name for the names panel
                      #map is the fake map
                      #[1.0,5.0,9.0] is the legend range with
                      #   [min,medium,max] values
                      #color C1 is the min color, and C9 the max color
cmd.delete("map")     #delete the map object

I hope this will help someone.

Hello,
I try to make a legend box as apbs plugin does with colors it uses (the
box is set at the bottom of the visualization screen).

Does someone know if a kind of tutorial exists for ?

Thanks

--
Sébastien Moretti
http://www.igs.cnrs-mrs.fr/
CNRS - IGS
31 chemin Joseph Aiguier
13402 Marseille cedex

Reply via email to