Description Usage Arguments Value Examples
Assign score and labels from raw data
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ## S4 method for signature 'Moanin'
splines_kmeans_predict(
object,
kmeans_clusters,
data = NULL,
method = c("distance", "goodnessOfFit"),
...
)
## S4 method for signature 'Moanin'
splines_kmeans_score_and_label(
object,
kmeans_clusters,
data = NULL,
proportion_genes_to_label = 0.5,
max_score = NULL,
previous_scores = NULL,
rescale_separately = FALSE
)
|
object |
the Moanin object that contains the basis functions used in creating the clusters |
kmeans_clusters |
List returned by |
data |
the data to predict. If not given, will use |
method |
If "distance", predicts based on distance of data to kmeans
centroids. If "goodnessOfFit", is a wrapper to
|
... |
arguments passed to |
proportion_genes_to_label |
float, optional, default: 0.5 Percentage of genes to label. If max_score is provided, will label genes that are either in the top 'proportion_genes_to_label' or with a score below 'max_score'. |
max_score |
optional, default: Null When provided, will only label genes below that score. If NULL, ignore this option. |
previous_scores |
matrix of scores, optional. Allows user to give the
matrix scores results from a previous run of
|
rescale_separately |
logical, whether to score separately within grouping variable |
splines_kmeans_predict
returns a vector giving the labels for
the given data.
A list consisting of
labels
the label or cluster assigned to each gene based on the
cluster with the best (i.e. lowest) score, with no label given to genes that
do not have a score lower than a specified quantity
scores
the matrix of size n_cluster x n_genes, containing for
each gene and each cluster, the goodness of fit score
score_cutoff
The required cutoff for a gene receiving an
assignment
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | data(exampleData)
moanin <- create_moanin_model(data=testData, meta=testMeta)
# Cluster on a subset of genes
kmClusters=splines_kmeans(moanin[1:50,],n_clusters=3)
# get scores on all genes
scores_and_labels <- splines_kmeans_score_and_label(object=moanin, kmClusters)
head(scores_and_labels$scores)
head(scores_and_labels$labels)
# should be same as above, only just the assignments
predictLabels1 <- splines_kmeans_predict(object=moanin, kmClusters,
method="goodnessOfFit")
# Instead use distance to centroid:
predictLabels2 <- splines_kmeans_predict(object=moanin, kmClusters,
method="distance")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.