Skip to content

Error in cor calculation in getMarkerFeatures function when groupBy input is a factor class #3

Description

@ycl6

When groupBy input is a factor class, the table() output in Line 821 will include groups that has 0 frequencies, resulting in different vector lengths in estbgd (only non-zero groups) and obsbgd, and other objects derived from these.

ArchR/R/MarkerFeatures.R

Lines 818 to 824 in 8b7c4bc

estbgd <- sort(floor(minTotal * bgdProbx))
obsbgd <- rep(0, length(estbgd))
names(obsbgd) <- names(estbgd)
tabGroups <- table(groups[idY])
obsbgd[names(tabGroups)] <- tabGroups
estbgdP <- round(100 * estbgd / sum(estbgd),3)
obsbgdP <- round(100 * obsbgd / sum(obsbgd),3)

During the "Matching Known Biases" step, we can see these warning messages when ArchR is creating the out object in the following lines.

Warning message in rbind(estbgd, obsbgd):number of columns of result is not a multiple of vector length (arg 1)”
Warning message in rbind(estbgdP, obsbgdP):number of columns of result is not a multiple of vector length (arg 1)”

Due to the different lengths of estbgdP and obsbgdP, the correlation calculation in Line 847 fail to execute.

ArchR/R/MarkerFeatures.R

Lines 845 to 847 in 8b7c4bc

.logThis(out, paste0("MatchSummary : Pre", useGroups[x]), logFile = logFile)
out$corbgdGroups <- suppressWarnings(cor(estbgdP, obsbgdP))

Error in cor(estbgdP, obsbgdP) : incompatible dimensions

This has been reported in these issues in ArchR repo:

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions