getClusterSamples: Get list of samples included in the closest cluster to the...

View source: R/qtool_functions.R

getClusterSamplesR Documentation

Get list of samples included in the closest cluster to the input sample

Description

This function cluster samples including the input sample or not. If the input sample is not include, cosine similarity between the input sample and the cluster centers is computed to obtain the list of samples included in the closest cluster to the input sample

Usage

getClusterSamples(matrix, cell, include = TRUE)

Arguments

matrix

matrix with variables in rows and samples in columns

cell

one-column matrix with data of input sample, with one row per variable

include

a logical value to indicate if input sample should be used for clustering or not

Value

vector with list of samples in the closest cluster of the input sample

Examples

matrix <- cbind(s1=runif(10, min=0, max=1), s2=runif(10, min=0, max=1),s3=runif(10, min=0, max=1))
rownames(matrix)<-paste0("c", seq(1,10))
cell<-matrix(runif(n = 3, min = 0, max = 1))
colnames(cell)<-"input"
samples<-getClusterSamples(t(matrix), cell)

macintyrelab/CNpare documentation built on April 15, 2022, 4:46 a.m.