plotGroupedSamplesDmap: Plot diffusion map embedding of samples based on distance...

View source: R/functions-plotting.R

plotGroupedSamplesDmapR Documentation

Plot diffusion map embedding of samples based on distance matrix

Description

Visualizes diffusion map for network of samples based on square distance matrix (sample-sample pairwise dissimilarity)

Usage

plotGroupedSamplesDmap(
  my_distmat,
  cluster_assignments = NULL,
  pt_sz = 1,
  n_dim = 3,
  pt_label = NULL,
  cmap = NULL,
  w = 8,
  h = 5,
  scale.y = 1,
  angle = 40,
  autosave = FALSE,
  ...
)

Arguments

my_distmat

phemdObj object containing sample names in @snames slot

cluster_assignments

Vector containing group assignments for each sample

pt_sz

Size of points representing samples in plot (scaling factor)

n_dim

Number of dimensions for embedding (either 2 or 3)

pt_label

Vector of sample names corresponding to each point (same order as samples in my_distmat and cluster_assignments)

cmap

Vector containing colors by which points should be colored (corresponding to cluster_assignments)

w

Width of plot in inches

h

Height of plot in inches

scale.y

Scaling factor for diffusion map y-axis

angle

Rotation factor for diffusion map plot

autosave

Boolean denoting whether or not to save output diffusion map

...

Additional parameters to be passed to DiffusionMap function

Details

Requires 'destiny' package

Value

DiffusionMap object containing biological sample embedding and associated metadata

Examples


my_phemdObj <- createDataObj(all_expn_data, all_genes, as.character(snames_data))
my_phemdObj_lg <- removeTinySamples(my_phemdObj, 10)
my_phemdObj_lg <- aggregateSamples(my_phemdObj_lg, max_cells=1000)
my_phemdObj_monocle <- embedCells(my_phemdObj_lg, data_model = 'gaussianff', sigma=0.02, maxIter=2)
my_phemdObj_monocle <- orderCellsMonocle(my_phemdObj_monocle)
my_phemdObj_final <- clusterIndividualSamples(my_phemdObj_monocle)
my_phemdObj_final <- generateGDM(my_phemdObj_final)
my_EMD_mat <- compareSamples(my_phemdObj_final)
cluster_assignments <- groupSamples(my_EMD_mat, distfun = 'hclust', ncluster=4)
printClusterAssignments(cluster_assignments, my_phemdObj_final, '.', overwrite=TRUE)
dm <- plotGroupedSamplesDmap(my_EMD_mat, cluster_assignments, pt_sz=2)


KrishnaswamyLab/phemd documentation built on Oct. 2, 2024, 5:10 a.m.