ModalFilter: Filtering genes with unimodal distribution

Description Usage Arguments Value See Also Examples

Description

Filtering genes(cells) that expressed (non zero) distribution is similar with normal distribution.

Usage

1
ModalFilter(data, geneK, cellK, width = 1, cutoff = 2)

Arguments

data

The raw continuous expression matrix

geneK

The least number of genes which expressed in a cell

cellK

The least number of cells which have expression for a gene

width

The numeric width which is used to estimate probability density distribution function, default 1.

cutoff

The numeric width which is used to estimate probability density distribution function, default 2.

Value

\res

dataThe raw expresion data after filter genes or cells which less than cellK or geneK \resgeneSummA data frame including gene names as, corresponding number of expressed cells and the peak number of probability density distribution function \rescellSummA data frame including cell ID and corresponding number of expressed genes \resbinadataThe binary expression matrix corresponding to raw data

See Also

peak, genepeak

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
data(melanoma)
melanoma1=as.matrix(melanoma[,2:dim(melanoma)[2]])
row.names(melanoma1)=melanoma[,1]
res=ModalFilter(data=melanoma1,geneK=10,cellK=10)

## The function is currently defined as
function (data, geneK, cellK, width = 1, cutoff = 2) 
{
    rawdata = data
    cellSumm = data.frame(cell = colnames(data))
    cellSumm$count <- sapply(1:dim(data)[2], genecount, data = data, 
        index = "col")
    data = data[, cellSumm$count > cellK]
    binadata = Bina(data, cutoff = cutoff)
    geneSumm = data.frame(gene = row.names(data))
    geneSumm$count <- rowSums(binadata)
    data = data[geneSumm$count > geneK, ]
    binadata = binadata[geneSumm$count > geneK, ]
    geneSumm = geneSumm[geneSumm$count > geneK, ]
    cellSumm = cellSumm[cellSumm$count > cellK, ]
    geneSumm$exppeak = apply(data, 1, genepeak, width = width)
    data = data[geneSumm$exppeak >= 2, ]
    binadata = binadata[geneSumm$exppeak >= 2, ]
    geneSumm = geneSumm[geneSumm$exppeak >= 2, ]
    obj = list(rawdata = rawdata, newdata = data, geneSumm = geneSumm, 
        cellSumm = cellSumm, binadata = binadata)
    return(obj)
  }

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