m2ms / fragalysis-frontend

The React, Redux frontend built by webpack
Other
1 stars 1 forks source link

Map alignments not correct? #1238

Open tdudgeon opened 9 months ago

tdudgeon commented 9 months ago

Viewing aligned map files in NGL indicates that they are in a different bit of space to the PDB files.

tdudgeon commented 9 months ago

Example: image

This is with the event map, but the others are similar.

XX01ZVNS2B-x0051_B_301_XX01ZVNS2B-x0429+B+203.zip

Waztom commented 9 months ago

@tdudgeon to check with either @matteoferla or @boriskovar-m2ms if maps can be rendered in NGL at symmetry positions. @ConorFWild if needed, can comment further.

matteoferla commented 9 months ago

This cannot be achieved in NGL via a parameter. Cf. https://github.com/nglviewer/ngl/blob/d9b2914527f66ff4033778542843c321d8a88264/src/component/component.ts#L265 It would not work I think even if using getSymmetryOperations and changing a private variable (.matrix) in the component. However, can I double check this is indeed a "symmetry positions" problem? The two are not close and it strikes me as an alibi/alias rototranslation difference.

tdudgeon commented 9 months ago

For comparison here is how the equivalent data looks in the old fraglaysis (e.g. using "fragalysis API"). Note that the maps appear in the same region of space, but seem to correspond to a box around the ligand rather than the whole protein.

image

CD44MMA-x0017_0A.zip

matteoferla commented 9 months ago

@boriskovar-m2ms Does any function expose the stage object? I was hoping to inject this snipped to run addAxis(stage) to whatever page to show the three cartesian axes at the origin.

const addAxis = (stage) => {
  let shape = new NGL.Shape("shape", { dashedCylinder: true })
shape.addArrow([ 0, 0, 0 ], [ 10, 0, 0 ], [ 1, 0, 0 ], 1.0);
shape.addText([ 12, 0, 0 ], [ 1, 0, 0 ], 2.5, "x");
shape.addArrow([ 0, 0, 0 ], [ 0, 10, 0 ], [ 0, 1, 0 ], 1.0);
shape.addText([ 0, 12, 0 ], [ 0, 1, 0 ], 2.5, "y");
shape.addArrow([ 0, 0, 0 ], [ 0, 0, 10 ], [ 0, 0, 1 ], 1.0);
 shape.addText([ 0, 0, 12 ], [ 0, 0, 1 ], 2.5, "z");
var shapeComp = stage.addComponentFromObject(shape)
shapeComp.addRepresentation("buffer");
  shapeComp.autoView()
};
image

@tdudgeon & @ConorFWild If I open both maps in PyMOL I get the same shift reported in NGL —this is consistent right with you? But when I place a axis caltrop (there here is a snippet) I get:

image
ConorFWild commented 9 months ago

Alright, so ngl does accept the offset parameter: unfortunatlely (and obviously, really ^^") this alone does not solve the issue of map registration, although it does help.

Screenshot 2023-12-07 at 14 18 50

Steps to solution:

  1. Define a new, orthogonal unit cell around the ligand
  2. Resample the aligned xmap into this cell
  3. Offset the xmap to render around the ligand

This is likely to be difficult to test, as there are many opportunities for math errors with all the transforms + sym, so eta is not likely to be until the new year @phraenquex

I'll develop against nglview to make sure issues like this don't jump up again

ConorFWild commented 9 months ago

Well, I have a prototype that aligns things correctly for this example:

Screenshot 2023-12-07 at 15 37 49

Now comes the hard part of integrating and testing it ^^"

@phraenquex I revise my update from earlier, if integration is painless it is possible for this to be done tomorrow/before the end of the year.

phraenquex commented 9 months ago

I'm duly impressed... wow.

ConorFWild commented 9 months ago

Implemented, merged to master and tested on the test dataset:

Screenshot 2023-12-07 at 16 51 35

@tdudgeon Worth checking results from the most recent version (required ligand_neighbourhood_alignment update as well!) look good in Fragalysis and @phraenquex then we can close this?

ConorFWild commented 9 months ago

For reference, the sameish orientation and same contour in coot on the original (pre-aligned!) data: it looks pretty similar ^^

Screenshot 2023-12-07 at 16 55 53
phraenquex commented 9 months ago

That's wondeful!!

@ConorFWild can you know yet whether this is a completely general fix, or is there a significant risk of corner cases?

ConorFWild commented 9 months ago

@phraenquex Unclear - works for two relatively different systems but we probably won't know until: A. Stuff goes into Fragalysis for real B. We scale up

My feeling is corner cases are only a moderate risk and will be very obvious to users so we are probably good for purple!

tdudgeon commented 9 months ago

I just ran XCA (updated xchem-align and ligand_neighbourhood_alignment repos) and I'm not seeing the maps being aligned when I just open them in NGL.

image

@ConorFWild Are all changes committed, or is there something different that has to be done to get it to display in NGL?

boriskovar-m2ms commented 8 months ago

Any update on this? Do we have a target with maps aligned?

tdudgeon commented 8 months ago

Not yet.

ConorFWild commented 8 months ago

I just ran XCA (updated xchem-align and ligand_neighbourhood_alignment repos) and I'm not seeing the maps being aligned when I just open them in NGL.

image

@ConorFWild Are all changes committed, or is there something different that has to be done to get it to display in NGL?

Hey Tim, where are the files for this? Would be helpful to be able to look at them so I can see if any offset has been entered into the maps!

If there is an offset, the issue is the method having calculated the wrong one.

If there isn't then you have an install issue.

tdudgeon commented 7 months ago

Just to confirm that this problem seems to be fixed now. Probably best to keep it open until it can be show to be correct in Fragalysis.