splines_kmeans_score_and_label: Assign score and labels from raw data

Description Usage Arguments Value Examples

Description

Assign score and labels from raw data

Usage

 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
)

Arguments

object

the Moanin object that contains the basis functions used in creating the clusters

kmeans_clusters

List returned by splines_kmeans

data

the data to predict. If not given, will use assay(object). If given, the number of columns of data must match that of object

method

If "distance", predicts based on distance of data to kmeans centroids. If "goodnessOfFit", is a wrapper to splines_kmeans_score_and_label, assigning labels based on goodness of fit, including any filtering.

...

arguments passed to splines_kmeans_score_and_label

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 splines_kmeans_score_and_label, and only redo the filtering (i.e. if want to change proportion_genes_to_label without rerunning the calculation of scores)

rescale_separately

logical, whether to score separately within grouping variable

Value

splines_kmeans_predict returns a vector giving the labels for the given data.

A list consisting of

Examples

 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")

NelleV/moanin documentation built on July 28, 2021, 7:34 p.m.