rcsb / rcsb-saguaro-3d

MIT License
23 stars 8 forks source link

How can I update block config using RcsbFv3DCustom.updateConfig? #2

Closed cyrus0824 closed 2 years ago

cyrus0824 commented 2 years ago

Hello, I'm in a team that's trying to use your saguaro-3d app to display papillomavirus protein structures along with some pairwise alignments and other associated data. We found this project when researching how to integrate molstar into our project, and it seems like you've already done a lot of the legwork, thank you so much.

I had a question about how to update the sequence panel block config after the initial object instantiation. We are using saguaro-3d as in your cdn-examples currently.

When I call the updateConfig function, I can change the sequence panel's title and subtitle, but not its blockConfig (for example to change the alignment shown, remove an Axis, change a color, etc.).

I made a jsfiddle with the single-chain example config, and a button with a handler that attempts to change the config. I assume it's something in the structure of the config I'm passing, but it seems like this conforms to the documentation.

What am I doing wrong?

Thanks again for all your great work.

bioinsilico commented 2 years ago

Thank you, @cyrus0824 for your interest in rcsb-saguaro-3d. The updateConfig method expected a new full state. I have updated the method so partial states are also allowed (v1.3.5). However, if the different 1D views are known, I recommend following the multiple-chain example and defining a blockSelectorElement to switch between the different 1D views. Please, let me know if I was not clear or more help is needed.

cyrus0824 commented 2 years ago

Hi @bioinsilico , thanks again for your prompt response. Sorry it's taken me a bit to respond - I've been digesting your idea of using the multiple-chain example and trying to figure out if it is feasible for our use-case. We essentially have many (500-1000) pairwise alignments between a single structure sequence and many protein sequences. We want to display the alignment between the structure sequence and a selected protein sequence when the user clicks on a row in an associated table. I think it would be technically possible to use the multiple-chain example, but it would require a lot of pre-loading. This is why I was wondering if I could update the feature viewer dynamically using updateConfig.

I'm still doing some testing, but I just wanted to give you a little update and thank you again for your response and feedback.

bioinsilico commented 2 years ago

Hi @cyrus0824! I am happy to help you with your project. You wouldn't need to load all the structures simultaneously, but it will force you to define the multiple 1D views. The CustomViewInterface interface exposes a callback method (blockChangeCallback) that would allow you to load new structures. However, it might be easier to update the configuration. If it doesn't affect the performance, it is also an option.

cyrus0824 commented 2 years ago

Hi @bioinsilico thanks so much again for the advice - I was able to make our page work with a blockSelectorElement.

This is a somewhat unrelated question, so it might be better if i made another issue (let me know if you want me to do this), but is there a way to specify the sequence loaded into the molstar sequence panel (for example by labelAsymId) on startup?

I saw that there was a params and a props that seem to pass values to the molstar init, but I don't see any options that might relate to setting the initial state (e.g. chain, entity, etc) on the sequence pane.

Do you have any advice?

Thanks again

bioinsilico commented 2 years ago

Hi @cyrus0824! I am happy to hear that you could make it work :). Do you mind closing this ticket and starting a new one for this request? I can help you with this.

cyrus0824 commented 2 years ago

Sure, no problem!