Git Product home page Git Product logo

scmayomap's Introduction

scMayoMap

scMayoMap aims to annotate cell clusters in single-cell data, facilitating the analysis and interpretation of single-cell RNA-sequencing (scRNA-seq) data.

1. Installation

Install the development version of scMapping using the following commands:

devtools::install_github("chloelulu/scMayoMap")
pkgs <- c("ggplot2", "dplyr","tidyr","tibble","reshape2")
new.packages <- pkgs[!(pkgs %in% installed.packages()[,"Package"])]
if(length(new.packages)) install.packages(new.packages)

Load the necessary packages:

pkgs <- c("ggplot2", "dplyr","tidyr","tibble","reshape2")
sapply(pkgs, require, character.only = TRUE)
library(scMayoMap)

Upon loading scMayoMap, the demo "data" and integrated "scMayoMapDatabase" will automatically be available.

head(data)

scMayoMapDatabase is included within the package. Users can also utilize their marker pool, ensuring they match the format of scMappingDatabase.

head(scMayoMapDatabase[,c(1:4)])

2. Run scMayoMap

To annotate a scRNA-seq data analysis output generated by FindAllMarkers You can specify the tissue type (i.e.,tissue = 'muscle') or not (tissue = NULL, default). But we do suggest to specify the tissue type, which will be more accurate. Additionally, please make sure your data is in the same format as demo data.

obj <- scMayoMap(data = data, tissue = 'muscle')

User can also define their own database as input. For example, if you want to use your own marker pool. The database should be in the same format as scMayoMapDatabase. Presence of a gene in a celltype will be 1, otherwise 0. column names should contain 'gene' column. Currently, our database only supports gene symbols. If you have a data with Ensembl ID, please refer biomaRt or other methods to convert the gene names.

head(demodata)
db <- tidyr::spread(demodata, key = c('celltype'), value = 'value')
db[is.na(db)] <- 0
obj <- scMayoMap(data = data, database = db)

You can retrieve the result summary table and export it in a format of your choosing.

res <- obj$res
head(res)

You can retrieve the table of marker genes utilized for predictions. Refer to the scMayoMap R Documentation for detailed descriptions of each column.

markers <- obj$markers
head(markers)

scMayoMap provides a plotting function to aid in visualizing the results. You can specify a directory where the plot will be saved (e.g., directory = '~/Desktop/'); if none is provided, the plot will be automatically saved to the current working directory (default is "directory = NULL"). Users should adjust the "width" and "height" parameters to suit their preferred figure size.

plt <- scMayoMap.plot(scMayoMap.object = obj, directory = '~/Desktop/', width = 8, height = 6)

3. Using scMayoMap start from Seurat

Below code illustrates how to use scMayoMap if you start with a Seurat analysis. We will use a demo dataset from SeuratData. You need to install package Seurat and SeuratData before try below example. However, if you have a large dataset, you may refer to multi-thread to speed up FindAllMarkers procedure.

library(SeuratData)
library(Seurat)
seurat.obj <- LoadData(ds = "pbmc3k") 
seurat.obj <- NormalizeData(object = seurat.obj)
seurat.obj <- FindVariableFeatures(object = seurat.obj)
seurat.obj <- ScaleData(object = seurat.obj)
seurat.obj <- RunPCA(object = seurat.obj)
seurat.obj <- FindNeighbors(object = seurat.obj)
seurat.obj <- FindClusters(object = seurat.obj)
seurat.markers <- FindAllMarkers(seurat.obj, method = 'MAST')
scMayoMap.obj <- scMayoMap(data = seurat.markers, database=scMayoMapDatabase, tissue = 'blood')
plt <- scMayoMap.plot(scMayoMap.object = scMayoMap.obj)

You can also retrieve the markers identified by scMayoMap to create a dot plot. The following code illustrates how to visualize the genes mapped to cluster 0, where the predicted cell type is Granulocyte.

gns <- scMayoMap.obj$markers$genes[scMayoMap.obj$markers$cluster==0 & scMayoMap.obj$markers$celltype=='Granulocyte']
gns <- strsplit(gns, ',')[[1]]
DotPlot(seurat.obj, features = gns)

4. References

If you use scMayoMap, please cite:

  • Yang, L., Ng, Y.E., Sun, H. et al. Single-cell Mayo Map (scMayoMap): an easy-to-use tool for cell type annotation in single-cell RNA-sequencing data analysis. BMC Biol 21, 223 (2023). https://doi.org/10.1186/s12915-023-01728-6.

scmayomap's People

Contributors

chloelulu avatar

Stargazers

StarFall avatar Jana Roels avatar  avatar Musa Marrah avatar  avatar You Junpeng avatar Zhenwu Dai avatar 久绊A avatar  avatar  avatar  avatar  avatar Andrew Chen avatar Aki Hoji avatar Henrik Lindehell avatar

Watchers

 avatar

scmayomap's Issues

How to truncate the scMayoMap DB to make it only have one cell type

Hi,
When I am using scMayoMap to annotate cells known to be neuronal ones, some clusters are annotated as other cell types like astrocyte and B cell. I am wondering if the DB of scMayoMap can be tailored to have only one cell type for some tissues (in my case, 'brain').
Thank you.

Validate the annotation by scMayoMap

scMayoMap is an excellent tool, and I want to test the annotation quality in a dataset. It is limit to the numeric clusters, so I have changed some code in scMayoMap.plot.

Error in sample.int(length(x), 1) : invalid first argument

Hi,

I am trying the tool following way with my custom made database (mouse) (attached)

seurat.markers <- FindAllMarkers(Combined.subset, min.pct = 0.25, logfc.threshold = 0.25,test.use = "wilcox")
db <- read.table("signature.txt", sep="\t", header=TRUE, check.names = FALSE)
scMayoMap.obj <- scMayoMap(data = seurat.markers, database=db, tissue = 'skin')

User defined marker pool will be used!
Error in sample.int(length(x), 1) : invalid first argument

The code works fine (no error) if I use the default database (scMayoMapDatabase), or after downloading this database and reading it as external file using the above code. But not working for my database. How to solve it please?

thanks.
signature.txt

How does scMayoMap deals with mm10 Gene markers?

Hi!
I've used your excellent tool (many thanks for developing it!) in my mm10 datasets, but when I inspect the scMayoMap.obj$markers, the genes seem to be human. I've looked into the function, but I cannot find how does the function takes into account this difference between mouse and human marker genes?
Also, I can't find an specific entry on the function to introduce "mouse blood" tissue to be used. Nor have I changed the gene names in my dataset. I am worried that the scores that I have are underestimated.
Would you be so kind to explain how does the scMayoMap takes care of this? So that I can be confident that I don't need to map the mouse genes with the human orthologs.
Many thanks for developing this excelent tool,
Maria

Tissue Specific Markers

Hello! Think this is a great tool, but was wondering how tissue specific markers were compiled? And how we would try extending existing databases i.e. if I want to add several breast specific markers to be run alongside the other breast markers already in the database, is there a recommended way to do this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.