Re: [PyMOL] Common atoms in two selections (and their indices)
Hi Tsjerk, Spencer, Osvaldo, cmd.get_raw_alignment() might be what you are looking for. http://pymolwiki.org/index.php/Get_raw_alignment Cheers, Thomas On 27 Oct 2015, at 12:49, Spencer Blivenwrote: > Tsjerk– > > You might be able to extract the ids of the aligned residues from an > alignment object: > > cmd.align(sele1,sele2copy,object="aln") > [a.id for a in cmd.get_model('aln').atom] > > Since the alignment is sequential, I think this should contain all the > aligned atoms from sele1 concatenated with the aligned atoms from sele2. > However, as far as I know the internals of the alignment objects aren't > documented, so I'm not sure if this can be relied upon. > > -Spencer > > > On Tue, Oct 27, 2015 at 12:22 PM, Tsjerk Wassenaar wrote: > Hi Osvaldo, > > Probably that's the trick, although I'd need the indices, but that's simple > enough. > The 'equivalence' one is still standing though :) > > Thanks, > > Tsjerk > > On Tue, Oct 27, 2015 at 11:44 AM, Osvaldo Martin > wrote: > So, you want to know the best way to do this? > > Z = [at_x for at_x in X for at_y in Y if at_x.id == at_y.id > ] > > Or am I still not getting it right? > > Cheers, > Osvaldo. > > On Tue, Oct 27, 2015 at 10:56 AM, Tsjerk Wassenaar wrote: > > > > Hi Osvaldo, > > I could have been more clear I guess. First of all, let's say I have obtained > the atom list of a selection: > > X = cmd.get_model(selection1).atom > > I'm doing stuff with that (PCA, to be exact), but now I want to display the > result only for a subselection. Probably getting the intersection of the > selections and then check which atoms there match with the original selection > is an approach. The question there is what the best way is for checking > identity of the atoms. > > The second issue is when there is no intersection of the selections, but > there may be correspondence, as in alignment. > > Thanks for thinking along, > > Tsjerk > > On Tue, Oct 27, 2015 at 10:44 AM, Osvaldo Martin > wrote: > Hi Tsjerk, > > Do you mean something like this? > > cmd.index("sel_1 and sel_2") > > I do not get the differences between your two cases. Whats the difference > between “atoms which are both in selection 1 and 2” and “matching atoms in > the two selections” > > Cheers, > > Osvaldo. > > On Mon, Oct 26, 2015 at 10:33 AM, Tsjerk Wassenaar wrote: > > > > > Hi Thomas e.a., > > Given two selections, would there be an easy way to > > 1. find the atoms which are both in selection 1 and 2, and the indices of > those in the selections > > and > > 2. find the matching atoms in the two selections, like align does, and the > indices of those in the selections > > Thanks, > > Tsjerk > > -- > Tsjerk A. Wassenaar, Ph.D. -- Thomas Holder PyMOL Principal Developer Schrödinger, Inc. -- ___ 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] Common atoms in two selections (and their indices)
Hi Osvaldo, I could have been more clear I guess. First of all, let's say I have obtained the atom list of a selection: X = cmd.get_model(selection1).atom I'm doing stuff with that (PCA, to be exact), but now I want to display the result only for a subselection. Probably getting the intersection of the selections and then check which atoms there match with the original selection is an approach. The question there is what the best way is for checking identity of the atoms. The second issue is when there is no intersection of the selections, but there may be correspondence, as in alignment. Thanks for thinking along, Tsjerk On Tue, Oct 27, 2015 at 10:44 AM, Osvaldo Martinwrote: > Hi Tsjerk, > > Do you mean something like this? > > cmd.index("sel_1 and sel_2") > > I do not get the differences between your two cases. Whats the difference > between “atoms which are both in selection 1 and 2” and “matching atoms in > the two selections” > > Cheers, > > Osvaldo. > > On Mon, Oct 26, 2015 at 10:33 AM, Tsjerk Wassenaar > wrote: > > >> Hi Thomas e.a., >> >> Given two selections, would there be an easy way to >> >> 1. find the atoms which are both in selection 1 and 2, and the indices of >> those in the selections >> >> and >> >> 2. find the matching atoms in the two selections, like align does, and >> the indices of those in the selections >> >> Thanks, >> >> Tsjerk >> >> -- >> Tsjerk A. Wassenaar, Ph.D. >> >> >> >> -- >> >> ___ >> 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 >> > > -- Tsjerk A. Wassenaar, Ph.D. -- ___ 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] Common atoms in two selections (and their indices)
Hi Tsjerk, Do you mean something like this? cmd.index("sel_1 and sel_2") I do not get the differences between your two cases. Whats the difference between “atoms which are both in selection 1 and 2” and “matching atoms in the two selections” Cheers, Osvaldo. On Mon, Oct 26, 2015 at 10:33 AM, Tsjerk Wassenaarwrote: > Hi Thomas e.a., > > Given two selections, would there be an easy way to > > 1. find the atoms which are both in selection 1 and 2, and the indices of > those in the selections > > and > > 2. find the matching atoms in the two selections, like align does, and the > indices of those in the selections > > Thanks, > > Tsjerk > > -- > Tsjerk A. Wassenaar, Ph.D. > > > > -- > > ___ > 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] Common atoms in two selections (and their indices)
So, you want to know the best way to do this? Z = [at_x for at_x in X for at_y in Y if at_x.id == at_y.id] Or am I still not getting it right? Cheers, Osvaldo. On Tue, Oct 27, 2015 at 10:56 AM, Tsjerk Wassenaarwrote: Hi Osvaldo, > > I could have been more clear I guess. First of all, let's say I have > obtained the atom list of a selection: > > X = cmd.get_model(selection1).atom > > I'm doing stuff with that (PCA, to be exact), but now I want to display > the result only for a subselection. Probably getting the intersection of > the selections and then check which atoms there match with the original > selection is an approach. The question there is what the best way is for > checking identity of the atoms. > > The second issue is when there is no intersection of the selections, but > there may be correspondence, as in alignment. > > Thanks for thinking along, > > Tsjerk > > On Tue, Oct 27, 2015 at 10:44 AM, Osvaldo Martin > wrote: > >> Hi Tsjerk, >> >> Do you mean something like this? >> >> cmd.index("sel_1 and sel_2") >> >> I do not get the differences between your two cases. Whats the difference >> between “atoms which are both in selection 1 and 2” and “matching atoms in >> the two selections” >> >> Cheers, >> >> Osvaldo. >> >> On Mon, Oct 26, 2015 at 10:33 AM, Tsjerk Wassenaar >> wrote: >> >> >>> Hi Thomas e.a., >>> >>> Given two selections, would there be an easy way to >>> >>> 1. find the atoms which are both in selection 1 and 2, and the indices >>> of those in the selections >>> >>> and >>> >>> 2. find the matching atoms in the two selections, like align does, and >>> the indices of those in the selections >>> >>> Thanks, >>> >>> Tsjerk >>> >>> -- >>> Tsjerk A. Wassenaar, Ph.D. >>> >>> >>> >>> -- >>> >>> ___ >>> 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 >>> >> >> > > > > -- > Tsjerk A. Wassenaar, Ph.D. > > -- ___ 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] Common atoms in two selections (and their indices)
Hi Osvaldo, Probably that's the trick, although I'd need the indices, but that's simple enough. The 'equivalence' one is still standing though :) Thanks, Tsjerk On Tue, Oct 27, 2015 at 11:44 AM, Osvaldo Martinwrote: > So, you want to know the best way to do this? > > Z = [at_x for at_x in X for at_y in Y if at_x.id == at_y.id] > > Or am I still not getting it right? > > Cheers, > Osvaldo. > > On Tue, Oct 27, 2015 at 10:56 AM, Tsjerk Wassenaar > wrote: > > Hi Osvaldo, >> >> I could have been more clear I guess. First of all, let's say I have >> obtained the atom list of a selection: >> >> X = cmd.get_model(selection1).atom >> >> I'm doing stuff with that (PCA, to be exact), but now I want to display >> the result only for a subselection. Probably getting the intersection of >> the selections and then check which atoms there match with the original >> selection is an approach. The question there is what the best way is for >> checking identity of the atoms. >> >> The second issue is when there is no intersection of the selections, but >> there may be correspondence, as in alignment. >> >> Thanks for thinking along, >> >> Tsjerk >> >> On Tue, Oct 27, 2015 at 10:44 AM, Osvaldo Martin >> wrote: >> >>> Hi Tsjerk, >>> >>> Do you mean something like this? >>> >>> cmd.index("sel_1 and sel_2") >>> >>> I do not get the differences between your two cases. Whats the >>> difference between “atoms which are both in selection 1 and 2” and >>> “matching atoms in the two selections” >>> >>> Cheers, >>> >>> Osvaldo. >>> >>> On Mon, Oct 26, 2015 at 10:33 AM, Tsjerk Wassenaar >>> wrote: >>> >>> Hi Thomas e.a., Given two selections, would there be an easy way to 1. find the atoms which are both in selection 1 and 2, and the indices of those in the selections and 2. find the matching atoms in the two selections, like align does, and the indices of those in the selections Thanks, Tsjerk -- Tsjerk A. Wassenaar, Ph.D. -- ___ 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 >>> >>> >> >> >> >> -- >> Tsjerk A. Wassenaar, Ph.D. >> >> > -- Tsjerk A. Wassenaar, Ph.D. -- ___ 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] Common atoms in two selections (and their indices)
Tsjerk– You might be able to extract the ids of the aligned residues from an alignment object: cmd.align(sele1,sele2copy,object="aln") [a.id for a in cmd.get_model('aln').atom] Since the alignment is sequential, I think this should contain all the aligned atoms from sele1 concatenated with the aligned atoms from sele2. However, as far as I know the internals of the alignment objects aren't documented, so I'm not sure if this can be relied upon. -Spencer On Tue, Oct 27, 2015 at 12:22 PM, Tsjerk Wassenaarwrote: > Hi Osvaldo, > > Probably that's the trick, although I'd need the indices, but that's > simple enough. > The 'equivalence' one is still standing though :) > > Thanks, > > Tsjerk > > On Tue, Oct 27, 2015 at 11:44 AM, Osvaldo Martin > wrote: > >> So, you want to know the best way to do this? >> >> Z = [at_x for at_x in X for at_y in Y if at_x.id == at_y.id] >> >> Or am I still not getting it right? >> >> Cheers, >> Osvaldo. >> >> On Tue, Oct 27, 2015 at 10:56 AM, Tsjerk Wassenaar >> wrote: >> >> Hi Osvaldo, >>> >>> I could have been more clear I guess. First of all, let's say I have >>> obtained the atom list of a selection: >>> >>> X = cmd.get_model(selection1).atom >>> >>> I'm doing stuff with that (PCA, to be exact), but now I want to display >>> the result only for a subselection. Probably getting the intersection of >>> the selections and then check which atoms there match with the original >>> selection is an approach. The question there is what the best way is for >>> checking identity of the atoms. >>> >>> The second issue is when there is no intersection of the selections, but >>> there may be correspondence, as in alignment. >>> >>> Thanks for thinking along, >>> >>> Tsjerk >>> >>> On Tue, Oct 27, 2015 at 10:44 AM, Osvaldo Martin >>> wrote: >>> Hi Tsjerk, Do you mean something like this? cmd.index("sel_1 and sel_2") I do not get the differences between your two cases. Whats the difference between “atoms which are both in selection 1 and 2” and “matching atoms in the two selections” Cheers, Osvaldo. On Mon, Oct 26, 2015 at 10:33 AM, Tsjerk Wassenaar wrote: > Hi Thomas e.a., > > Given two selections, would there be an easy way to > > 1. find the atoms which are both in selection 1 and 2, and the indices > of those in the selections > > and > > 2. find the matching atoms in the two selections, like align does, and > the indices of those in the selections > > Thanks, > > Tsjerk > > -- > Tsjerk A. Wassenaar, Ph.D. > > > > -- > > ___ > 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 > >>> >>> >>> >>> -- >>> Tsjerk A. Wassenaar, Ph.D. >>> >>> >> > > > > -- > Tsjerk A. Wassenaar, Ph.D. > > > > -- > > ___ > 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