aertslab / SCopeLoomR

R package (compatible with SCope) to create generic .loom files and extend them with other data e.g.: SCENIC regulons, Seurat clusters and markers, ...
MIT License
38 stars 15 forks source link

How to send query loom files through gene names and not through Gene ID #6

Open abhisheksinghnl opened 5 years ago

abhisheksinghnl commented 5 years ago

Hi,

Presently, I can generate the loom files and can also upload them in SCOPE to visualise them

I am generating the loom files as follows:

```{r scRNALoomGeneration, echo=FALSE, message=FALSE, warning=FALSE, include=TRUE, warnings=FALSE, eval=TRUE, results="asis"}
                                                      for ( i in 1:length(paths))
                                                      {
                                                        dgem <- counts(sce_list[[i]])
                                                        dim(dgem)
                                                        class(dgem)
                                                        head(colnames(dgem))
                                                        cell.info <- colData(sce_list[[i]])
                                                        cell.info$nGene <- Matrix::colSums(dgem>0)
                                                        sum(sce_list[[i]]$total_counts)
                                                        default.tsne <- sc_list[[i]]
                                                        default.tne.name <- "t-SNE on full expression matrix"
                                                        head(default.tsne)
                                                        tsne<-reducedDim(sc_list[[i]], "TSNE")[,1:2]
                                                        file.name<-paste0("file",i,".loom")
                                                        dgem.subset<-as.matrix(x=dgem)[, row.names(tsne)]
                                                        build_loom(file.name=file.name,
                                                                   dgem=dgem.subset,
                                                                   title="Fake expression dataset for examples",
                                                                   genome="Mouse", # Just for user information, not used internally
                                                                   default.embedding=tsne,
                                                                   default.embedding.name=default.tne.name)

                                                      }

The above is an code chunk from Rmarkdown.

However, I can only navigate in the SCOPE using GeneID and not gene symbol. Could you please let me know, how to incorporate the Gene Symbols and to use them to navigate through the loom files.

Many thanks for your help.

Best regards Abhishek

dweemx commented 5 years ago

Currently, It is only possible to query genes by the values save in the Gene row attribute of a Loom. By default, SCopeLoomR stores the row.names of the dgem (argument of the build_loom function) as Gene. If you would like to query based on the gene symbols, you would have to set the row.names of the dgem to the corresponding gene symbols.