Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG?] Complex selections with OR gate #804

Open
JavierSanchez-Utges opened this issue Aug 27, 2024 · 2 comments
Open

[BUG?] Complex selections with OR gate #804

JavierSanchez-Utges opened this issue Aug 27, 2024 · 2 comments
Labels

Comments

@JavierSanchez-Utges
Copy link

Hi, I am dealing with multiple models and complex selections and I think something is not working as expected, possibly due to the way I build my selections.

First a general question about selections:

I have generated many selections like so, and they all seemed to work so far, selecting the correct residues in the right chains in the specific model.

sel = {model: activeModel, resi: protResi, chain: protChain, resn: protResn};

Now, I am playing with AND and OR gates to do more detailed selections and I just wondered: is this first selection the same as this second one?

sel = {and:[{model: activeModel}, {resi: protResi}, {chain: protChain}, {resn: protResn}]};

The issue I have is that when I apply the model to the union of those selections I generated in the loop like so:

viewer.addStyle({or:ligandSitesHash[activeModel][ligNam]}, {cartoon:{hidden: false, color: ligColor}, stick: {hidden: false, color: ligColor, radius: stickRadius}});

The style is also applied to another model, which is unexpected, as in each one of the selections in ligandSitesHash[activeModel][ligNam] I specify the model: activeModel.

This is the array containing the different selections:

Screenshot 2024-08-27 at 10 21 47

and somehow the style is applied to another model (not 96) too.

Thanks a lot!

@JavierSanchez-Utges
Copy link
Author

I have noticed that when I pass
{model: 96, resi: 49, chain: 'A', resn: 'LEU'}
directly as the selection, the styles apply only to model 96. However, when I include multiple selections with OR like so: {or:[{model: 96, resi: 49, chain: 'A', resn: 'LEU'}, {model: 96, resi: 51, chain: 'A', resn: 'THR'}]}
or even just the one using OR:
{or:[{model: 96, resi: 49, chain: 'A', resn: 'LEU'}]}
the styles apply to my other model too. This made me think that perhaps there is an issue with the way the logic is implemented for the OR gate.

Help is much appreciated!

@JavierSanchez-Utges
Copy link
Author

I have solved it by specifying again the model directly in the selection:

viewer.addStyle({or:ligandSitesHash[activeModel][ligNam], model: activeModel}, {cartoon:{hidden: false, color: ligColor}, stick: {hidden: false, color: ligColor, radius: stickRadius}});

But I am still confused of why the OR of different selections, all of the same model, ends up including a different model...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant