-
Notifications
You must be signed in to change notification settings - Fork 26
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
Ensembl site unresponsive when using creat_cellphonedb_file() function #11
Comments
Hi @pandaqiuqiu creat_cellphonedb_file <- function(seu_obj, group){
counts <- as.data.frame(
as.matrix(
seu_obj@assays$RNA@data)
)
mouse_genes<-rownames(counts)
human <- useMart("ensembl", dataset = "hsapiens_gene_ensembl", host = "https://dec2021.archive.ensembl.org/")
mouse <- useMart("ensembl", dataset = "mmusculus_gene_ensembl", host = "https://dec2021.archive.ensembl.org/")
genesV2 = getLDS(attributes = c("mgi_symbol"), filters = "mgi_symbol",
values = mouse_genes , mart = mouse, attributesL = c("hgnc_symbol",'ensembl_gene_id'),
martL = human, uniqueRows=F)
genesV2$Gene.stable.ID<-as.character(genesV2$Gene.stable.ID)
genesV2$MGI.symbol<-as.character(genesV2$MGI.symbol)
genesV2<-genesV2[!duplicated(genesV2$Gene.stable.ID),]
genesV2<-genesV2[!duplicated(genesV2$MGI.symbol),]
counts<-counts[genesV2$MGI.symbol,]
rownames(counts)<-genesV2$Gene.stable.ID
metadata <- data.frame(Cell = colnames(counts),
cell_type = as.character(seu_obj@active.ident)
)
metadata$Cell<-gsub('\\-','\\.',metadata$Cell)
counts<-na.omit(counts)
counts$Gene<-rownames(counts)
counts<-counts[,c(ncol(counts), 1:(ncol(counts)-1))]
colnames(counts)<-gsub('\\-','\\.',colnames(counts))
write.table(counts,
file =paste0(group, '_counts.txt'),
quote = F,
col.names = T,
row.names = F,
sep = '\t')
write.table(metadata,
file = paste0(group, '_metadata.txt'),
quote = F,
col.names = T,
row.names = F,
sep = '\t')
} |
I'm sorry for the late reply. Previously, I was using biomaRt version 2.50.3. After upgrading to version 2.60.1, I ran creat_cellphonedb_file(sce, group) and received the following error: Error in httr2::req_perform(): After that, I used your provided function and successfully obtained the two input files. Thank you very much for providing the solution. |
When I use the creat_cellphonedb_file() function to generate the input files for CellPhoneDB, I encountered the following error:
creat_cellphonedb_file(sce, Sample)
Ensembl site unresponsive, trying asia mirror
Ensembl site unresponsive, trying asia mirror
Error: biomaRt has encountered an unexpected server error.
Consider trying one of the Ensembl mirrors (for more details look at ?useEnsembl)
Additionally, I am curious why this process needs to call biomaRt. Any response will be appreciated.
The text was updated successfully, but these errors were encountered: