rcsb / rcsb-saguaro-3d

MIT License
25 stars 8 forks source link

Implementing support for multiple PDBs #1

Closed bisejdiu closed 2 years ago

bisejdiu commented 3 years ago

Hi,

I would like to extend the assembly example to allow for assemblies across different PDB IDs (essentially, have a select box with a custom list of PDBs for filtering). From what I can tell the software seems to support such cases (perhaps using EntryAssembliesCollector?), but since I am only superficially familiar with TypeScript I don't know how I would go about implementing this.

Perhaps I have to use the RcsbFv3DCustom class for this, instead? I'd appreciate a few pointers in terms of what direction to take.

bisejdiu commented 3 years ago

I can see that src/RcsbFvWeb/RcsbFvBuilder/RcsbFvInstanceBuilder.ts exports further functionality. As an example, if instead of calling buildInstanceSequenceFv, I call the function buildMultipleInstanceSequenceFv here: https://github.com/rcsb/rcsb-saguaro-3d/blob/e39aaeac2bd751cbe9457c43942f128f331ee785/src/RcsbFvSequence/SequenceViews/AssemblyView/AssemblyView.tsx#L178 and make the relevant adaptations, I do get a select box with the PDB ID, but unfortunately, the interactivity of the sequence viewer is completely broken. Which makes sense, I think, but I cannot figure out how to fix it.

bioinsilico commented 3 years ago

Hi! you are going in the right direction. The first problem was in buildMultipleInstanceSequenceFv that was ignoring the additional config parameter and it carries the board configuration and thus, the interactivity between viewers. I have fixed that in @rcsb/rcsb-saguaro-app. Could you update to version 1.0.1 and try again ? If you are interested in integrating this feature in master you can open a pull request and I will be very happy to help.

bisejdiu commented 3 years ago

This is great! Thank you for your help and for so quickly providing a fix! I managed to create the PDB select box using version 1.0.1 and the sequence viewer interactivity works. Now, the next steps are:

  1. What is the best way to populate the select box? I tried modifying sequenceConfig which expects a string for its entryId value to allow for Array<string> but, unfortunately, could not get it to work. If I understand it correctly, the issue has to do with sequenceConfig having AssemblyViewInterface interface. Replacing it with CustomViewInterface may work, but that seems to require a lot of work. As a test/hack, I provided ["4hhb", "2rh1"] directly as input to buildMultipleInstanceSequenceFv and that does work in terms of populating the select box, but breaks the interactivity of the app.

  2. Update the structure viewer (Mol*) based on the selected PDB. I can load two or more structures at the same time (using the MolStar Plugins LoadMethod.loadPdbIds and Array<LoadParams>), but that again breaks the interactivity of the app. It would also be much better for the structures to load upon selection, and not all of them upon DOM load. Weirdly, even though the sequence viewer updates successfully and correctly, values for currentEntryId and currentModelId do not get updated.

Hopefully fixing point 1 above will also go a long way to address the second point as well.

bioinsilico commented 3 years ago

The "custom" path would require to build everything from scratch. I have created this branch

https://github.com/rcsb/rcsb-saguaro-3d/tree/dev-js-mutiple-entries

I haven't test all functionalities but interactivity seems to be working. However, use this branch very careful because its only a quick-and-dirty fix. Try the example in src/examples/assembly/index.ts and let me know if it works for you.

bioinsilico commented 2 years ago

If no further help is needed I will close this issue.

bisejdiu commented 2 years ago

@bioinsilico Thank you so much for your help with this. I have been busy working on different projects but I plan to get back to this very soon. The new branch you have created is really helpful. I've tested it and it fixes the issues I've noted above. For me, the next step now is to fix/implement loading and removing structures from the Mol* scene based on select box choices made.

I believe this would be a nice extension to the capabilities of this repo as well and I would be happy to hopefully help in the future with this. But for now, I think you can close this issue.

Thanks so much for your help! :)