HeatmapCell: Heatmap of single cell based on top cluster specific genes

Usage Arguments Examples

Usage

1
HeatmapCell(obj, top)

Arguments

obj

The list objective from the function getClusterGene

top

The number of gene which showed top cluster specificity

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
data(melanoma)
melanoma1=as.matrix(melanoma[,2:dim(melanoma)[2]])
row.names(melanoma1)=melanoma[,1]
res=ModalFilter(data=melanoma1,geneK=10,cellK=10)
res=GeneFilter(obj=res)
res=getMarker(obj=res,MNN=200,MNNIndex=20)
res=SCcluster(obj=res)
res=getClusterGene(obj=res,method="Seurat")
HeatmapCell(obj=res,10)
## The function is currently defined as
function (obj, top) 
{
    feature = obj$clustergene
    topmarker = as.data.frame(feature %>% group_by(clusts) %>% 
        top_n(top, auroc))
    topmarker = topmarker[order(topmarker$clusts), ]
    method = obj$method
    if (method == "Seurat") {
        cluster = obj$seuratCluster
        cluster = cluster[order(cluster)]
    }
    else if (method == "dbscan") {
        cluster = obj$dbscanCluster
        cluster = cluster[order(cluster)]
    }
    clustertype = unique(cluster)
    data = obj$rawdata[topmarker$gene, names(cluster)]
    clustercount = table(cluster)
    gapIndex = c()
    for (i in 2:(length(clustertype) - 1)) {
        gapIndex = c(gapIndex, sum(clustercount[1:i]))
    }
    pheatmap(data, cluster_cols = F, cluster_rows = F, show_colnames = F, 
        gaps_col = gapIndex)
  }

Fang0828/SCMarker documentation built on May 13, 2019, 12:51 p.m.