Description Usage Arguments Details Examples
View source: R/NanoSatelliteR_functions.R
This function writes a png figure containing a heatmap based on a distance matrix of clustered tandem repeat squiggle units.
1 | ns_heatmap(distmat, file, lwd = 10, max_dist = NA, rm0 = F)
|
distmat |
A distance matrix, generated by dtwclust::tsclust() |
file |
A character of length 1 containing path and name of the file. |
lwd |
Dendrogram line width |
max_dist |
Remove distances higher than this numeric value (to obtain a graphically relevant color scale) |
rm0 |
A logical indicating wether distance equal to zero should be removed (to obtain a graphically relevant color scale) |
To visually inspect clustering, a heatmap can be constructed. Due to the potential large distance matrices generated by dtwclust::tsclust(), creating heatmaps can be troublesome. ns_heatmap() should be able to deal with large distance matrices. Distances in the resulting heatmap are shown with a color scale: Black = low distance, white = medium distance, red = high distance. In addition, this function provides a few parameters to change thickness of dendrograms and remove extreme distances.
1 2 3 4 5 6 7 8 9 10 11 12 | df <- load_summary("/storage/NanoSatellite_chunks/")
qc <- summary_qc(df)
df2 <- qual_reads(df,qc$center_cutoff)
squiggles <- load_squiggles("/storage/NanoSatellite_chunks/",df2)
library(doParallel)
library(dtwclust)
k_clusters=2
registerDoParallel(cores=8)
positive_clustering=tsclust(squiggles$positive,type="h",k=k_clusters,trace=TRUE,distance = "dtw_basic", control=hierarchical_control(method="ward.D",symmetric = T))
ns_heatmap(positive_clustering@distmat,"~/test.png",max_dist=200,rm0=T)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.