Open chenx9 opened 1 year ago
Hi,
Not a contributor of the package. Have you loaded SCENIC r package? library(SCENIC)
Yes, I have loaded without displaying an error
Can you try loading all the 3 functions below and see if it works?
.H <- function(pVect){
pVect <- pVect[pVect>0] # /sum(pVect) ??
- sum(pVect * log2(pVect))
}
# Jensen-Shannon Divergence (JSD)
calcJSD <- function(pRegulon, pCellType)
{
(.H((pRegulon+pCellType)/2)) - ((.H(pRegulon)+.H(pCellType))/2)
}
# Regulon specificity score (RSS)
.calcRSS.oneRegulon <- function(pRegulon, pCellType)
{
jsd <- calcJSD(pRegulon, pCellType)
1 - sqrt(jsd)
}
calcRSS <- function(AUC, cellAnnotation, cellTypes=NULL)
{
if(any(is.na(cellAnnotation))) stop("NAs in annotation")
if(any(class(AUC)=="aucellResults")) AUC <- getAUC(AUC)
normAUC <- AUC/rowSums(AUC)
if(is.null(cellTypes)) cellTypes <- unique(cellAnnotation)
#
ctapply <- lapply
if(require('BiocParallel')) ctapply <- bplapply
rss <- ctapply(cellTypes, function(thisType)
sapply(rownames(normAUC), function(thisRegulon)
{
pRegulon <- normAUC[thisRegulon,]
pCellType <- as.numeric(cellAnnotation==thisType)
pCellType <- pCellType/sum(pCellType)
.calcRSS.oneRegulon(pRegulon, pCellType)
})
)
rss <- do.call(cbind, rss)
colnames(rss) <- cellTypes
return(rss)
}
Kind regards, Saeed
When I load the function you mentioned, the following problem occurs
I had the same problem, but i solved it by updating scenic version to 1.3.1
I had the same problem, but i solved it by updating scenic version to 1.3.1
where to download SCENIC of 1.3.1?thanks!
sorry, I can't remember exactly. Mabey you can try this commond. devtools::install_github("aertslab/SCENIC")
rss <- calcRSS(AUC=getAUC(sub_regulonAUC),