Repository navigation
Ribocode extension - #1726
Ribocode extension#1726agdturner wants to merge 32 commits into
Conversation
Ribocode extension removed color as this is too project specific.
|
The repository for Ribocode is: https://github.com/ribocode-slola/ribocode1/ |
Add/update package-lock.json
Code style changes to pass test
big.js types
big.js types workaround Added a fallback `declare module 'big.js';` because the CI build does not recognize the built-in types from `big.js@7.x`, even though it works locally. This disables type checking for `big.js` as a temporary workaround until the CI environment can properly resolve the package's built-in types.
|
Did you see |
|
Ah, thanks @arose - no, I had not seen those - there are similarities and it would be good to compare the algorithms and performance on some data... Alignment can be difficult! I found that I could align some molecules better by eye than using the algorithm I implemented. I hard coded a 50 iteration limit for the Newton-Raphson iterative approximation which could be too small... |
dsehnal
left a comment
There was a problem hiding this comment.
Thanks for this. Before we merge this though, should do some refactoring.
| * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
| * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| */ | ||
| export class QCProt { |
There was a problem hiding this comment.
As @arose pointed out, there is already quaternion-based RMSD minimization code in https://github.com/molstar/molstar/blob/master/src/mol-math/linear-algebra/3d/minimize-rmsd.ts, although the implementation here does seem to better handle edge-cases.
I would prefer we improve the existing code instead of including a duplicate.
| * @returns A promise that resolves to an object containing arrays of | ||
| * x, y, z coordinates and atom types. | ||
| */ | ||
| export async function getAlignmentData(plugin: PluginUIContext, trajectory: any) { |
There was a problem hiding this comment.
This is a very hacky way of getting the position elements -- generally I would at least get this from the Model which has types data.
Is the purpose of the loadMoleculeFileToViewer only to get the positions? The way this thing is coded seems quite specific to the application you want to use this in.
There was a problem hiding this comment.
Ah, but you know better what you are doing with Mol* and I am trying to learn how to use it @dsehnal!
The molecule is centralised so that the coordinate origin is at the centre of the molecule (the position of each atom is translated by the average of all the atom positions). If alignment data are provided, then the atoms are also rotated. If the user requests alignment data to be returned, then the centralised atom locations are returned.
There was a problem hiding this comment.
Let's step back a little. The functionality you want is:
- Load two or more ribosomes
- Compute their alignment and apply it to the structures
- Output the translations and matrices to the user
Am I missing something?
There was a problem hiding this comment.
No, I think that is the gist of it @dsehnal.
There was a problem hiding this comment.
Ok, then you want to structure your library differently. I would suggest
- Load all the structures using built-in methods (you don't need the trajectory.ts file you added)
- Find the superpositions
- I am having some trouble understanding what
alignmentData.typemeans in relation toselectedAtomTypesinalignDataset, but basically the method should get a selection you want to align and output a transformation matrix
- I am having some trouble understanding what
- Apply
TransformStructureConformationbased on the transformations to update the visuals - To the user, you can either output the transformation matrix or the transformed positions
- But this would be part of your particular instance of Mol*, not necessarily the extension.
I would again encourage you to have a look at #1723 which achives a lot of what you want (= adding an alternative superposition method)
| * @param z Z coordinates to align with | ||
| * @return Aligned coordinates as {alignedX, alignedY, alignedZ} | ||
| */ | ||
| export function alignDataset( |
There was a problem hiding this comment.
@ddelalamo-takeda recently added support for tm-align #1723 which follows the existing patterns for superposing structures (notably the input of Structure.Loci instead of the selectedAtomTypes filtering you have inside the function). Can you follow this pattern here as well?
Due to the usage of big.js, I would still prefer this being a separate extension instead of part of the core library.
| * @param coords Array of BigVec3 coordinates. | ||
| * @returns Centroid as Vec3 | ||
| */ | ||
| export function computeBigCentroid(coords: Vec3[]): Vec3 { |
There was a problem hiding this comment.
Out of curiosity, how big structures to force the use of an arbitrary precision library?
There was a problem hiding this comment.
Ribosome datasets can have hundreds of thousands of atoms.
There was a problem hiding this comment.
I could be wrong, but the precision of the atom positions themselves isn't very accurate and 15 significant digits still seems quite good.
What is generally the error between using the 64bit floats vs the arbitrary precision computation? And if the different centroid is used in the RMSD calculation, what is the difference then?
There was a problem hiding this comment.
Extra file that should not be here?
There was a problem hiding this comment.
Sorry, not sure where that is from. I did not include it intentionally.
| "@types/node-fetch": "^2.6.13", | ||
| "@types/swagger-ui-dist": "3.30.6", | ||
| "argparse": "^2.0.1", | ||
| "big.js": "^7.0.1", |
There was a problem hiding this comment.
Generally, I prefer not to include 3rd party dependencies if it could be avoided.
BigJS is MIT and just a single file, which means we could actually just copy-paste it into mol-util/big.ts (and include proper typescript definition). I could help with that if you want.
There was a problem hiding this comment.
I read that type definitions are included in big.js 7.0.1, but I'm not sure how...
There was a problem hiding this comment.
There was a problem hiding this comment.
I understand that the Type definitions for Big.js can be added with:
npm install --save-dev @types/big.js
There was a problem hiding this comment.
Yes, but I don't want to include a dependency on another 3rd party library if it's somewhat easily avoidable.
Ribocode update for alignment
Description
Some generally useful geometry for aligning molecules
Actions
[Unreleased]section ofCHANGELOG.mdpackage.json'scontributorsdocs