Use NMF package to evaluate the optimal number of signatures.
Users should library(NMF)
firstly.
sig_estimate(nmf_matrix, range = 2:5, nrun = 10, what = "all",
cores = 1, seed = 123456, use_random = TRUE, save_plots = FALSE,
plot_basename = file.path(tempdir(), "nmf"), method = "brunet",
pConstant = NULL, verbose = FALSE)
a matrix
used for NMF decomposition (with rownames and colnames),
generate from sig_prepare function.
a numeric
vector containing the ranks of factorization to try. Note that duplicates are removed and values are sorted in increasing order. The results are notably returned in this order.
a numeric
giving the number of run to perform for each value in range
, nrun
set to 30~50 is enough to achieve robust result.
a character vector whose elements partially match one of the following item, which correspond to the measures computed by summary on each <U+2013> multi-run <U+2013> NMF result: <U+2018>all<U+2019>, <U+2018>cophenetic<U+2019>, <U+2018>rss<U+2019>, <U+2018>residuals<U+2019>, <U+2018>dispersion<U+2019>, <U+2018>evar<U+2019>, <U+2018>silhouette<U+2019> (and more specific *.coef, *.basis, *.consensus), <U+2018>sparseness<U+2019> (and more specific *.coef, *.basis). It specifies which measure must be plotted (what='all' plots all the measures).
number of cpu cores to run NMF.
specification of the starting point or seeding method, which will compute a starting point, usually using data from the target matrix in order to provide a good guess.
Should generate random data from input to test measurements. Default is TRUE
.
if TRUE
, save plots to local machine.
when save plots, set custom basename for file path.
specification of the NMF algorithm. Use 'brunet' as default. Available methods for nmf decompositions are 'brunet', 'lee', 'ls-nmf', 'nsNMF', 'offset'.
A small positive value to add to the matrix. Use it ONLY if the functions throws an non-conformable arrays
error.
if TRUE
, print extra message.
a list
contains information of NMF run and rank survey.
The most common approach is to choose the smallest rank for which cophenetic correlation coefficient starts decreasing (Used by this function). Another approach is to choose the rank for which the plot of the residual sum of squares (RSS) between the input matrix and its estimate shows an inflection point. More custom features please directly use NMF::nmfEstimateRank.
Gaujoux, Renaud, and Cathal Seoighe. "A flexible R package for nonnegative matrix factorization." BMC bioinformatics 11.1 (2010): 367.
Other signature analysis series function: sig_assign_samples
,
sig_extract
,
sig_get_activity
,
sig_get_correlation
,
sig_get_similarity
,
sig_prepare
,
sig_summarize_subtypes
# NOT RUN {
# Load copy number prepare object
load(system.file("extdata", "toy_copynumber_prepare.RData",
package = "sigminer", mustWork = TRUE
))
library(NMF)
cn_estimate <- sig_estimate(cn_prepare$nmf_matrix,
cores = 1, nrun = 5,
verbose = TRUE
)
# }
Run the code above in your browser using DataLab