Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate CalculateClusterEnrichment edge case #274

Open
GWMcElfresh opened this issue Oct 28, 2024 · 0 comments
Open

Investigate CalculateClusterEnrichment edge case #274

GWMcElfresh opened this issue Oct 28, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@GWMcElfresh
Copy link
Contributor

When a cluster is 100% comprised of a single individual, CalculateClusterEnrichment fails in an unexpected way.

It is probably here:

CellMembrane/R/Analysis.R

Lines 384 to 390 in 85ff116

for (cluster in unique(clusterProportionsDataFrame[[clusterField]])) {
clusterProportionsSubset <- clusterProportionsDataFrame[clusterProportionsDataFrame[[clusterField]] == cluster,]
groupOneProportions <- clusterProportionsSubset[clusterProportionsSubset[[treatmentField]] == unique(clusterProportionsSubset[[treatmentField]])[1],]$SubjectClusterProportion
groupTwoProportions <- clusterProportionsSubset[clusterProportionsSubset[[treatmentField]] == unique(clusterProportionsSubset[[treatmentField]])[2],]$SubjectClusterProportion
#if a subject is missing from one of the groups, we need to impute the missing percentage with a zero.
#I can't figure out a way to pass a "TreatmentGroup by Subjects" table succinctly to dplyr::complete, but it will be really obvious at this stage, so we can impute.
if (length(groupOneProportions) != length(groupTwoProportions)) {

If a cluster only has one subject, then it probably only has one group and this check fails.

@GWMcElfresh GWMcElfresh added the bug Something isn't working label Oct 28, 2024
@GWMcElfresh GWMcElfresh self-assigned this Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant