mjemons / spatialFDA

a package to compute spatial metrics and comparing them using functional data analysis
Other
0 stars 0 forks source link

extend extractMetric to cross type metrics #5

Closed sgunz closed 2 months ago

sgunz commented 2 months ago

Refers to pull request #4

When extending the function for cross metrics I tried to follow the logic of extractMetric and made the following additions to the code:

f5e3d41a0ddee46e710d14ae3d79c9cb278264da: The default function call cannot handle cross functions of the same type. Therefore I added the second conditional statement (line 39). If the (updated) conditional statements are not fulfilled (line 47) the function will return an empty data.frame such that the functions that use extractMetrics (e.g., calcMetricPerFov) do not crash. This is a suboptimal fix and should be addressed later.

240b4a658cf41e1ca5518ebbc325af45ab771ca2: adds a function that calculates cross type functions per fov by first generating all possible combinations and then calls calcMetricPerFov. While the function / logic could be also incorporated into calcMetricPerFovdirectly there are some cases where it makes a difference wether we calculate on a combination or one vs. rest (e.g., dot functions). Therefore I think it makes sense to have separate functions for non cross and cross comparisons.

So far this works fine for the classical cross metrics (e.g., Kcross, Lcross, Kcross.inhom, etc.).

Problems

Problems to solve:

sgunz commented 2 months ago

dec9021: fixes the problem with the markconnect function

sgunz commented 2 months ago

https://github.com/mjemons/spatialFDA/commit/451795680ef026dab1413e690c72103a477d55d7: adds a conditional statement to calcCrossMetricPerFov that handles the special case of dot functions, where we want to do one vs all comparisons. In order to plot these functions I updated the plotting function in https://github.com/mjemons/spatialFDA/commit/a6d9fb30da0b533f8055532a7e5d3aace8711a32

mjemons commented 2 months ago

https://github.com/mjemons/spatialFDA/pull/4/commits/598ff15cbdac7ab9dfdc5730030607c706fc4ae7: There were issues with fPCA and NAs. Potentially, add the dropping of NAs in the calcMetric.R function direclty.

mjemons commented 2 months ago

the issue has been adressed and the PR merged