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

Superpose many pdbs, use different colors, but keep heavy atoms in a different color. #1050

Open
pguillem opened this issue Aug 12, 2024 · 2 comments

Comments

@pguillem
Copy link

pguillem commented Aug 12, 2024

Hi.

I superposed 5 pdbs mutated on positions 1, 45, 67. The idea is to superpose the backbone structures and highlight the sidechains of those 3 positions only. For this i'm using 2 representations. One where each structure has a different color and display ribbons, and other where the sidechains are highlighted. The heavy atoms should assume the color of their structure (same as the ribbon), but the heavy atoms should keep their default colors (O=red, N=blue, S=yellow, etc).

This is my line representation and selection for displaying the sidechains:
o.addRepresentation("line", {sele: "(1, 45, 67) and (not hydrogen)"})

However, when I assign each structure a color, the heavy atoms in the sidechain lose the default colors and assume the color of the structure.

I tried a ColormakerRegistry like this:

var schemeId = NGL.ColormakerRegistry.addSelectionScheme([
                ['green', "(1 or 45 or 67) and .C"], 
                ['blue', "(1 or 45 or 67) and .N"],
                ['red', "(1 or 45 or 67) and .O"]
], "Name for the structure");

but no luck.

Is there a way that I can keep the default color for heavy atoms on every structure, regardless of the color of carbons?
Thanks in advance

@fredludlow
Copy link
Collaborator

The element colormaker does this, if you set the colorValue to a color name like "green" (or hex code like "#0F0") then it'll color the carbons in that colour and all the other atoms their default element-based scheme.

Codepen example

You can combine element colorscheme with a selection for specific atoms

@pguillem
Copy link
Author

Worked like a charm. Thanks!

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

No branches or pull requests

2 participants