AlexsLemonade / OpenScPCA-analysis

An open, collaborative project to analyze data from the Single-cell Pediatric Cancer Atlas (ScPCA) Portal
Other
5 stars 14 forks source link

Add silhouette and purity functions #777

Closed sjspielman closed 6 days ago

sjspielman commented 6 days ago

Closes #771 Closes #772

This PR adds two functions - calculating silhouette width and calculating neighhorhood purity - to rOpenScPCA. These functions are pretty parallel in scope, but if there is a different strategy (like, inputs/output formats) you want to recommend let me know. I also left a few TODO comments in the code which you'll see when reviewing - one about how much bluster output to return, and one about testing.

I also ended up splitting out that matrix checking code into its own function, since I used that code as part of these functions too. I didn't add any explicit tests for that helper function so it's implicitly tested all over the place, but I can, e.g., maybe change over some extract_pc_matrix tests to focus on prepare_pc_matrix if we want something explicit here.