Discriminant Non-Negative Matrix Factorization, DNMF, is to extend the Non-negative Matrix Factorization algorithm in
order to extract features that enforce not only the spatial locality, but
also the separability between classes in a discriminant manner.
a matrix, like expression profilings of some samples. the columns are samples and the rows are gene's expression.
trainlabel
a numeric vector of sample type of all the samples, this vector should ONLY contain 1 and 2 so far and length of it should equal the column (sample) size of data.
r
the dimension of expected reduction dimension, with the default value 2.
gamma
the tradeoff value for the within scatter matrix, with the default value 0.1.
delta
the tradeoff value for the between scatter matrix, with the default value 1e-4.
maxIter
the maximum iteration of update rules, with the default value 1000.
tol
the toleration of coverange, with the default value 1e-7.
log
log2 data. Default is TRUE.
plotit
whether plot H (V=WH). Default: FALSE.
checkH
whether or not check H. Default: TRUE. This parameter aims to
check whether or not the H safisfy the discriminant metagenes. Usually, this
should be TRUE.
dat <- rbind(matrix(c(rep(3, 16), rep(8, 24)), ncol=5),
matrix(c(rep(5, 16), rep(5, 24)), ncol=5),
matrix(c(rep(18, 16), rep(7, 24)), ncol=5)) +
matrix(runif(120,-1,1), ncol=5)
trainlabel <- c(1,1,2,2,2)
DNMF_result <- DNMF(dat, trainlabel, r=2)
## Not run:
# Gene ranking. dat is the raw read count maatrix with sample in column.
#normalising dat
Sizefactors <- DESeq::estimateSizeFactorsForMatrix(dat)
dat = sweep(dat, 2, Sizefactors, `/`)
res <- DNMF(dat, trainlabel, r=2)
rnk <- res$rnk
#The end of gene ranking exmaples
#Other exmaples
DNMF_result <- DNMF(dat, trainlabel, r=2, gamma=0.1, delta=0.0001, plotit=TRUE)
## End(Not run)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(DNMF)
Loading required package: foreach
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/DNMF/DNMF.Rd_%03d_medium.png", width=480, height=480)
> ### Name: DNMF
> ### Title: Discriminant Non-Negative Matrix Factorization.
> ### Aliases: DNMF
>
> ### ** Examples
>
> dat <- rbind(matrix(c(rep(3, 16), rep(8, 24)), ncol=5),
+ matrix(c(rep(5, 16), rep(5, 24)), ncol=5),
+ matrix(c(rep(18, 16), rep(7, 24)), ncol=5)) +
+ matrix(runif(120,-1,1), ncol=5)
> trainlabel <- c(1,1,2,2,2)
>
> DNMF_result <- DNMF(dat, trainlabel, r=2)
>
>
> ## Not run:
> ##D # Gene ranking. dat is the raw read count maatrix with sample in column.
> ##D
> ##D #normalising dat
> ##D Sizefactors <- DESeq::estimateSizeFactorsForMatrix(dat)
> ##D dat = sweep(dat, 2, Sizefactors, `/`)
> ##D
> ##D res <- DNMF(dat, trainlabel, r=2)
> ##D rnk <- res$rnk
> ##D
> ##D #The end of gene ranking exmaples
> ##D
> ##D #Other exmaples
> ##D DNMF_result <- DNMF(dat, trainlabel, r=2, gamma=0.1, delta=0.0001, plotit=TRUE)
> ## End(Not run)
>
>
>
>
>
> dev.off()
null device
1
>