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 <tsje...@gmail.com>
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 <aloctavo...@gmail.com>
> 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 <tsje...@gmail.com>
>> 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

Reply via email to