Description Usage Arguments Details Examples
View source: R/NanoSatelliteR_functions.R
extract_centroids() obtains the squiggle current levels which best represent their respective clusters.
1 | extract_centroids(tsclust_obj)
|
tsclust_obj |
A tsclust object generated by dtwclust::tsclust() |
dtwclust::tsclust() can be used to cluster tandem repeat unit squiggles and centroids are calculated for each cluster. This centroid aims to provide the the most representative squiggle current level for each cluster. extract_centroids extracts the centroid information from a tsclust object and returns a data.frame with the results
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | 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))
cent=extract_centroids(positive_clustering)
ggplot(cent,aes(x=pos,y=signal,colour=factor(cluster)))+geom_point()+geom_line()+theme_minimal()+facet_grid(. ~ cluster)+guides(colour=guide_legend(title="cluster"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.