Description Usage Arguments Details Value Examples
View source: R/smfishHmrf.hmrfem.R
This function generates cluster centroids from applying kmeans. It accepts an expression matrix file as input.
1 2 3 4 5 6 7 8 | smfishHmrf.generate.centroid.it(
expr_file,
par_k,
par_seed = -1,
nstart,
name = "test",
output_dir = "."
)
|
expr_file |
expression matrix file. The expression file should be a space-separated file. The rows are genes. The columns are cells. There is no header row. The first column is a gene index (ranges from 1 to the number of genes). Note the first column is not gene name. |
par_k |
number of clusters |
par_seed |
random generator seed (-1 if no fixing). Change the par_seed to vary the initialization. |
nstart |
number of starts (kmeans). It is recommended to set nstart to at least 100 (preferrably 1000). |
name |
name of this run |
output_dir |
output directory; where to store the kmeans results |
Note that after running kmeans step, the function also automatically saves the kmeans results to the output_dir
directory. The results will be found in two files:
{output_dir}
/k_{par_k}
/f{name}
.gene.ALL.centroid.txt
{output_dir}
/k_{par_k}
/f{name}
.gene.ALL.kmeans.txt
where {}
refers to the value of parameters.
A kmeans object which is a list with centers and cluster fields
1 2 3 | mem_file = system.file("extdata", "ftest.expression.txt", package="smfishHmrf")
kk = smfishHmrf.generate.centroid.it(mem_file, par_k=9, par_seed=100,
nstart=100, name="test", output_dir=tempdir())
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.