calculateDistanceNeigboursProbes: #' updateTxtClusterOut #' generates summary text after...

View source: R/Clustering.R

calculateDistanceNeigboursProbesR Documentation

#' updateTxtClusterOut #' generates summary text after clustering #' @param traitReducedcombinedDFP_Val_Labels data structure with trait reduced results #' @param minP_Val minimum p_value for model to use for clustering #' @param maxP_Val maximum p_value for model to use for clustering #' @param minN minimum n for model to use for clustering #' @param sldNumClasses number of classes to use for clustering #' @return text #' examples updateTxtClusterOut(traitReducedcombinedDFP_Val_Labels, minP_Val, maxP_Val, minN, sldNumClasses) updateTxtClusterOut <- function(traitReducedcombinedDFP_Val_Labels, minP_Val, maxP_Val, minN, sldNumClasses) base::tryCatch( result <- NULL if (is.valid(traitReducedcombinedDFP_Val_Labels)) maxClasses <- length(traitReducedcombinedDFP_Val_Labels$mergedColnames) numRow <- nrow(traitReducedcombinedDFP_Val_Labels$dfP_Val) numCol <- ncol(traitReducedcombinedDFP_Val_Labels$dfP_Val) minClasses <- 1 #dendextend::min_depth(session$userData$sessionVariables$dendTraits) result <- base::paste0("finding trait clusters successful. found minClusters = ", minClasses, "; maxClusters: ", maxClasses, "; Clustering made for numClasses = ", sldNumClasses, ".\n", "size of result df: nrow(CpG)=", numRow, ", ncol(trait)=", numCol, ".") , error = function(e) base::message("An error occurred in updateTxtClusterOut():\n", e) , warning = function(w) base::message("A warning occurred in updateTxtClusterOut():\n", w) , finally = return(shiny::HTML(result)) ) calculateDistanceNeigboursProbes calculate distance from each probe to its neigbours and gives back data frame with distance metrics

Description

#' updateTxtClusterOut #' generates summary text after clustering #' @param traitReducedcombinedDFP_Val_Labels data structure with trait reduced results #' @param minP_Val minimum p_value for model to use for clustering #' @param maxP_Val maximum p_value for model to use for clustering #' @param minN minimum n for model to use for clustering #' @param sldNumClasses number of classes to use for clustering #' @return text #' examples updateTxtClusterOut(traitReducedcombinedDFP_Val_Labels, minP_Val, maxP_Val, minN, sldNumClasses) updateTxtClusterOut <- function(traitReducedcombinedDFP_Val_Labels, minP_Val, maxP_Val, minN, sldNumClasses) base::tryCatch( result <- NULL if (is.valid(traitReducedcombinedDFP_Val_Labels)) maxClasses <- length(traitReducedcombinedDFP_Val_Labels$mergedColnames) numRow <- nrow(traitReducedcombinedDFP_Val_Labels$dfP_Val) numCol <- ncol(traitReducedcombinedDFP_Val_Labels$dfP_Val) minClasses <- 1 #dendextend::min_depth(session$userData$sessionVariables$dendTraits) result <- base::paste0("finding trait clusters successful. found minClusters = ", minClasses, "; maxClusters: ", maxClasses, "; Clustering made for numClasses = ", sldNumClasses, ".\n", "size of result df: nrow(CpG)=", numRow, ", ncol(trait)=", numCol, ".") , error = function(e) base::message("An error occurred in updateTxtClusterOut():\n", e) , warning = function(w) base::message("A warning occurred in updateTxtClusterOut():\n", w) , finally = return(shiny::HTML(result)) ) calculateDistanceNeigboursProbes calculate distance from each probe to its neigbours and gives back data frame with distance metrics

Usage

calculateDistanceNeigboursProbes(
  wd,
  clustResProbes,
  annotation,
  distanceToLook,
  numCores
)

Arguments

wd

working directory

clustResProbes

data structure with clustering result

annotation

annotation of CpG (names, location etc.)

distanceToLook

maximum distance to look for

numCores

number of cores to use for distance calculation

Value

data.frame with min, mean, max distance and nuber of CpG in distanceToLook window examples calculateDistanceNeigboursProbes(wd, clustResProbes, annotation, distanceToLook, numCores)


SteRoe/PatternMatchR documentation built on July 1, 2024, 10:09 p.m.