-
Notifications
You must be signed in to change notification settings - Fork 54
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
02 #5
Comments
Making Seurat LSI Object... |
Sorry I am not familiar with Seurat V3, the error message seems to be focused on the fact that there are no rownames in the input counts object. Just add somewhere rownames whether it be simply rownames(counts) <- paste0("n",seq_len(nrow(counts))) |
@hjack123 I modify the origin code that use Seurat V3 to do LSI dimension reduction and find cluster
addClusters <- function(obj,
minGroupSize = 50,
dims.use = seq_len(50),
initialResolution = 0.8,
n.start = 10, ...){
# get the SNN
obj<- FindNeighbors(obj, reduction = "lsi", dims = dims.use)
#First Iteration of Find Clusters
currentResolution <- initialResolution
obj <- FindClusters(obj, resolution = currentResolution)
res_name <- colnames(obj@meta.data)[grepl(currentResolution, colnames(obj@meta.data))]
minSize <- min(table(obj@meta.data[[res_name]]))
nClust <- length(unique(paste0(obj@meta.data[[res_name]])))
message(sprintf("Current Resolution = %s, No of Clusters = %s, Minimum Cluster Size = %s", currentResolution, nClust, minSize))
if (is.null(minGroupSize)){
return(obj)
}
#If clusters are smaller than minimum group size
while(minSize <= minGroupSize){
res_name <- colnames(obj@meta.data)[grepl(currentResolution, colnames(obj@meta.data))]
obj@meta.data <- obj@meta.data[,-which(colnames(obj@meta.data)==res_name)]
currentResolution <- currentResolution*initialResolution
obj <- FindClusters(obj, resolution = currentResolution)
res_name <- colnames(obj@meta.data)[grepl(currentResolution, colnames(obj@meta.data))]
minSize <- min(table(obj@meta.data[[res_name]]))
nClust <- length(unique(paste0(obj@meta.data[[res_name]])))
message(sprintf("Current Resolution = %s, No of Clusters = %s, Minimum Cluster Size = %s", currentResolution, nClust, minSize))
}
return(obj)
} |
Hi with your code I got the following msg, would you happen to have a solution? thanks! |
@hjack123 I got the msg too. It is beacuase the Seurat Group have develop a new package to process the scATAC-seq data, it is called Signac, you can ignore it. |
I get the same warnings as @hjack123 , but the real issue is the error:
|
I was able to solve that by setting the variable features as the row.names before running RunLSI in the seuratLSI function. VariableFeatures(obj) <- row.names(obj) #TF IDF LSI adapted from flyATAC
cs <- Matrix::colSums(mat)
if(binarize){
message(paste0("Binarizing matrix..."))
mat@x[mat@x > 0] <- 1
}
if(!is.null(nFeatures)){
message(paste0("Getting top ", nFeatures, " features..."))
mat <- mat[head(order(Matrix::rowSums(mat),decreasing = TRUE),nFeatures),]
}
#create a seurat object
obj <- CreateSeuratObject(mat,
assay = "ATAC",
project='scATAC',
min.cells=0, min.features=0)
#Calc TF IDF, Calc SVD then LSI
VariableFeatures(obj) <- row.names(obj)
obj <- RunLSI(object = obj, n = nComponents, scale.max = NULL)
return(obj)
} |
Thanks, @craiga02 for helping out with this issue! only a small correction. Add the
|
Making Seurat LSI Object...
Binarizing matrix...
Getting top 20000 features...
Computing Term Frequency IDF...
Computing SVD using irlba...
Making Seurat Object...
Error in CreateSeuratObject(mat, project = "scATAC", min.cells = 0, min.genes = 0) :
unused argument (min.genes = 0)
The text was updated successfully, but these errors were encountered: