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

Colouring each residue #90

Open
rsakai opened this issue Jul 25, 2023 · 3 comments
Open

Colouring each residue #90

rsakai opened this issue Jul 25, 2023 · 3 comments

Comments

@rsakai
Copy link

rsakai commented Jul 25, 2023

Is it possible to loop through each residue and colour them? I am loading a PDB file and would like to colour each residue based on experimental value I get for each residue.

@CrisSherban
Copy link

Probably this could be of help for you.

I usually create a list of dicts with the necessary color and residue information and then pass it to the color function.
Here you can find a snippet:
https://github.com/bayer-science-for-a-better-life/topefind-public/blob/73a40c4f0ef38a21d49e46e7987f69ac02baffd4/topefind/dashboard/dashboard.py#L578

@KeaunAmani
Copy link

Probably this could be of help for you.

I usually create a list of dicts with the necessary color and residue information and then pass it to the color function. Here you can find a snippet: https://github.com/bayer-science-for-a-better-life/topefind-public/blob/73a40c4f0ef38a21d49e46e7987f69ac02baffd4/topefind/dashboard/dashboard.py#L578

I believe the user wants to color the residues within the viewer directly.

@midlik
Copy link
Collaborator

midlik commented Aug 29, 2024

You can use the .visual.select helper method (basically what CrisSherban suggested, thank you).
The call will look something like this:

viewerInstance.visual.select({
    data: [
        { struct_asym_id: 'A', residue_number: 1, color: '#ff0000' }, 
        { struct_asym_id: 'A', residue_number: 2, color: '#ff8800' }, 
        { struct_asym_id: 'A', start_residue_number: 3, end_residue_number: 6, color: '#ffff00' }, 
        { struct_asym_id: 'A', start_residue_number: 15, end_residue_number: 20, color: '#88ff00' },
    ],
    nonSelectedColor: '#ffffff',
});

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

4 participants