acorg / Racmacs

Racmacs R package for performing antigenic cartography
https://acorg.github.io/Racmacs/
GNU Affero General Public License v3.0
20 stars 9 forks source link

Incorrect output from procrustesData #133

Closed drserajames closed 2 years ago

drserajames commented 2 years ago

The output from procrustesData is calculated incorrectly for "ag_rmsd", "sr_rmsd" and "total_rmsd". The rmsd should be the rmsd of the positions (i.e the mean of the procrustes distances), not the rmsd of distances.

shwilks commented 2 years ago

I think that's what it currently does, i.e. takes the distance between the base antigen coordinate and the coordinate in the procrustes transformed version, then does the rmsd on those, or am I missing something?

drserajames commented 2 years ago

It is doing rmsd on the distances. But, to me at least, it makes more sense to do rmsd on the positions aka means of the distances. The rmsd on the positions is what is minimised with a procrustes. What do you gain by doing rmsd on the distances? The distances are already all positive by definition.

shwilks commented 2 years ago

I think I still don't quite follow, could you write some example code that describes your alternative approach? I think the rmsd calculated currently is the same as what is being minimised by the procrustes but perhaps I am missing something.

drserajames commented 2 years ago

You're completely correct. I always thought procrustes was minimising the sum of the procrustes distance, not its square.

drserajames commented 2 years ago

Sorry!