Resending since I forgot to copy the PyMOL mailing list
On 23/2/21, 7:17 am, "Ali Saad Kusay" <[email protected]> wrote:
Hi Jeff,
There is several ways you can do this with string function in python
https://www.w3schools.com/python/python_ref_string.asp.
This is an easy one liner which replace "COG_" of "AA" with nothing if found
label sele, model.replace('COG_','').replace('AA_','')
Another way to do this is lets say you select an object beginning with
COG_, you can slice away the first 4 characters to get rid of COG_
label sele, model[4:]
Cheers,
Ali
On 23/2/21, 1:32 am, "Jeff Saxon" <[email protected]> wrote:
pardon, just one additional question, which might be alitle bit custom
issue, however..
Imagine, that I have 2 groups of the pdbs objects loaded into same
pymol session: 2 pdbs with the prefix COG_*.pdb, and 2 pdbs with the
prefix AA_*.pdb. Would it be possible to subtract the both prefixes
from the labels produced using cmd.label('sele', 'model') ? Or
alternatively I ought to rename the both objects before their
labelling? What are the other possible solutions ?
пн, 22 февр. 2021 г. в 15:07, Jeff Saxon <[email protected]>:
>
> Right, this is what I was looking for!
> Thank you so much, Ali!
> Cheers,
> J.
>
> пн, 22 февр. 2021 г. в 14:59, Ali Saad Kusay
<[email protected]>:
> >
> > No worries Jeff,
> >
> > Use editing mode and you can move it with mouse. See around 3:30 in
this video,
https://protect-au.mimecast.com/s/_r_iCANpgjCwqAQMtGDPTv?domain=m.youtube.com.
> >
> > You can move all labels with this command:
> >
> > set label_position (x,y,z)
> >
> > This will move the labels as needed in the x, y and z directions
> >
> > Cheers,
> >
> > Ali
> >
> >
> > On 23 Feb 2021, at 12:51 am, Jeff Saxon <[email protected]>
wrote:
> >
> > Thank you, Ali!
> > One question - is there any command which would allow to change
> > position of the text of the label produced by the label sele, model
?
> > In fact as I noticed, it produces correctly label text just above
the
> > object, while I need to move it a litle bit in one of the directions
> > ...
> > Cheers,
> >
> > пн, 22 февр. 2021 г. в 14:14, Ali Saad Kusay
<[email protected]>:
> >
> >
> > Hi Jeff,
> >
> >
> > The name of an object is stored in the model attribute.
> >
> > Select an atom in the object and use this command:
> >
> > label sele, model
> >
> >
> > If you want to automate this over all your PyMOL objects, you can
use this script, this will put a label at the centre of each object but it has
to create a pseudoatom for each one. You can change coords.mean to coords.min
or cords.max if you want the label to go at the corner of each object
> >
> > for i in cmd.get_object_list():
> >
> > coords = cmd.get_coords(i)
> >
> > mean_coords = coords.mean(axis=0).tolist()
> >
> > cmd.pseudoatom(i+"_psu", pos=mean_coords)
> >
> >
> > cmd.label(i+"_psu", "'{}'".format(i))
> >
> >
> > Cheers,
> >
> >
> > Ali
> >
> >
> > Ali Kusay | BPharm (Hons) | PhD Candidate & Pharmacist
> >
> > The University of Sydney School of Pharmacy | Faculty of Medicine
and Health
> >
> > 424, Brain and Mind Centre | The University of Sydney | NSW 2050
> >
> >
> > On 22/2/21, 10:47 pm, "Jeff Saxon" <[email protected]> wrote:
> >
> >
> > Dear Pymol Users,
> >
> >
> > I am looking for a possibility to display names of the objects
in the
> >
> > pymol session. For example I loaded 4 objects corresponded to 2
> >
> > different positions of the same ligand as well as 2 positions of
its
> >
> > centres of masses. How would it be possible to display the names
of
> >
> > each of these loaded objects just near their visualisations in
GUI in
> >
> > order that I could understand who is who without operating with
the
> >
> > objects on the context menu?
> >
> >
> >
> > _______________________________________________
> >
> > PyMOL-users mailing list
> >
> > Archives:
https://protect-au.mimecast.com/s/1Qz7CBNqjlCw25G3t6a3Ug?domain=mail-archive.com
> >
> > Unsubscribe:
https://protect-au.mimecast.com/s/FesTCD1vlpTEGl9QfAQcf7?domain=sourceforge.net
> >
> >
> >
> >
_______________________________________________
PyMOL-users mailing list
Archives: http://www.mail-archive.com/[email protected]
Unsubscribe:
https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe