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

How to obtain map distance between all points #155

Closed Fika182 closed 1 year ago

Fika182 commented 1 year ago

Hello @drserajames !

It's really nice to know and use your app. Recently, I'm in the middle of my analysis and I have to obtain the map distance between all points. I couldn't find the best command for obtaining this data. Do you have any suggestion?

Thank you for replying my message!

drserajames commented 1 year ago

I can't take credit for Racmacs - that's all @shwilks . I just help by answering questions and complaining!

The mapDistances function in Racmacs only gives you the distances between antigens & sera, not antigens & antigens and sera & sera. To find the distances between all points, I just use the base R function dist on all the coordinates: dist(ptCoords(map)) . This returns a dist class object so it might be useful for your further analysis to convert it into a matrix like so: as.matrix(dist(ptCoords(map))) .

Hope this helps.

Fika182 commented 1 year ago

Your suggestion worked smoothly, thank you for your help!