-
Notifications
You must be signed in to change notification settings - Fork 38
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
Color a given part of the protein #55
Comments
What you need should be possible to accomplish by https://github.com/dsehnal/LiteMol/blob/master/examples/Commands/src/App.ts#L291 (Color Sequences here https://webchemdev.ncbr.muni.cz/LiteMol/Examples/Commands/ ) |
Thanks a lot! Is there a chance you could give me a short JavaScript example? I tried to understand these parts in the example, but i struggle with it :( |
Unfortunately, there is no "short" way to do this. |
Than a little longer one maybe? :) |
That's the one in the example. |
It is in typescript. Can i translate it to JS, or i should stop trying, and user it as typescript? |
Well, I would recommend you use TypeScript. But translation to JS isn't hard. You just remove the type annotations. You can also start with one of the examples and just modify it. For example https://github.com/dsehnal/LiteMol/tree/master/examples/SimpleController and add the code from https://github.com/dsehnal/LiteMol/blob/master/examples/Commands/src/CustomTheme.ts and https://github.com/dsehnal/LiteMol/blob/master/examples/Commands/src/App.ts#L291 |
So i tried to follow the links you provided and got this far:
The molecule is loaded perfectly fine, however here visual and model are both undefined. What am i missing? |
Yes, the applyTransform is a Promise so you need to await it or ".then" |
Thanks, that helped a little more, got stuck a little further along the way:
Which is basically a direct copy of the script you provided. It yields:
|
|
Thanks a lot!!!! I managed to color it, is there a chance you can lend me a last bit of help to show me how can i change this code to color lets say the 15th and 16th residue of the A chain? |
Yes, use the code I sent you originally from https://github.com/dsehnal/LiteMol/blob/master/examples/Commands/src/CustomTheme.ts :) |
After a long struggle, I was able to do it, thanks a lot! Do you mind if i post my solution here for future newbies like me? |
Cool. I don't mind. |
Hiiiii there! I'm a newbie suffering the same question here and am wondering if you could post you solution here for reference. Thank you so much ! |
Hi! I am not a 100% sure how this works as I completely forgot the stuff but my code looks like this:
The variable regions is a string and contains multiple regions in the format of : "start1-end1,start2-end2...". I guess the rest are self explanatory, I hope this will help :) |
Thank you so much ! I'll look into it and maybe frame a tutorial style walkthrough once I manage to solve this. |
@dsehnal Dear David! I was able to create a small script than colors a structure for x given region, however for some reason it does not work on NMR structure. Can you please help me figure out whats going on? I have a My code so far:
|
And what would the expected behavior for NMR structure be? I see you are passing If you want i-th NMR model, you have to edit this line: |
The As for the NMR, one model would be enough for me, lets say the very first one, with the apropriate region colored. I am still not able to color the NMR structures even with by changing the |
And just showing the structure without the coloring works? The { modelIndex: 0 } is correct, I thought you want to show colors on different models. If it works on non-NRM structure there is no reason it wont work on these. These is no difference in the internal data models. What are the particular data you are trying this on? |
So after some testing its nor about NMR structures, so I have no idea about the root of the problem.
The first one (1Z9I) is colored correctly, but the rest is not colored. I have no idea why :( |
@dsehnal Sorry to bother again, any idea why the mentioned scrip does not work? I tried to make sense of what happening, but failed countless times now :( |
Hi, sorry for the late reply. If you click on the 2nd or 3rd 1st, are they colored correctly? Also, are you using "label" annotations as input? Because mmCif has both label_ and auth_ columns. For example for 2m20, this is the B chain in mmCIF
Notice that the label_seq_id is 1, but auth_seq_id is 63. The theme you are using is based on the label_ coordiantes, not auth_. |
Thanks a lot, I ll look into this tomorrow! |
@dsehnal Thanks a lot for the help, it is working, and I finally understand it! One last question, and I promise I wont bother with this afterwards: Where do I need to change the script to be able to use auth_asym_id and auth_sec_id? |
Changing
to
should do the trick. Using The query is defined here: https://github.com/dsehnal/LiteMol/blob/master/src/lib/Core/Structure/Query/Queries.ts#L74 |
I would like to simple color a part of the molecule to green, and the rest to red. Lets say from residue 10-30 in the A chain to green, rest to red.
I know there is a similar question here, however that is 3 years old, and i found the explanation extremely unclear, and the codes provided there does not seem to function.
I have this protein loaded now:
The text was updated successfully, but these errors were encountered: