smfishHmrf.generate.centroid.it {smfishHmrf} | R Documentation |
Generate cluster centroids, where input is a file.
Description
This function generates cluster centroids from applying kmeans. It accepts an expression matrix file as input.
Usage
smfishHmrf.generate.centroid.it(
expr_file,
par_k,
par_seed = -1,
nstart,
name = "test",
output_dir = "."
)
Arguments
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 |
Details
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.
Value
A kmeans object which is a list with centers and cluster fields
Examples
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())