Skip to content

Commit

Permalink
support with own data for visualization
Browse files Browse the repository at this point in the history
  • Loading branch information
junjunlab committed Dec 9, 2022
1 parent 7fd845c commit 8d7960c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .Rhistory
Original file line number Diff line number Diff line change
Expand Up @@ -413,3 +413,7 @@ library(devtools)
document()
check()
install()
library(devtools)
document()
check()
install()
14 changes: 12 additions & 2 deletions R/visCluster.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#' @title using visCluster to visualize cluster results from clusterData output
#'
#' @param object clusterData object, default NULL.
#' @param plot.data supply with own data with data.frame format for visualization, default NULL.
#' @param ht.col heatmap colors, default c("blue", "white", "red").
#' @param border whether add border for heatmap, default TRUE.
#' @param plot.type the plot type to choose which incuding "line","heatmap" and "both".
Expand Down Expand Up @@ -77,6 +78,7 @@ globalVariables(c('cell_type', 'cluster.num', 'gene',"ratio","bary",
'membership', 'norm_value','id', 'log10P', 'pval',
'Var1'))
visCluster <- function(object = NULL,
plot.data = NULL,
ht.col = c("blue", "white", "red"),
border = TRUE,
plot.type = c("line","heatmap","both"),
Expand Down Expand Up @@ -133,7 +135,11 @@ visCluster <- function(object = NULL,
# choose plot type
if(plot.type == "line"){
# process data
data <- data.frame(object$long.res)
if(is.null(plot.data)){
data <- data.frame(object$long.res)
}else{
data <- plot.data
}

# sample orders
if(!is.null(sample.order)){
Expand Down Expand Up @@ -193,7 +199,11 @@ visCluster <- function(object = NULL,
}else{
# ==========================================================================
# process data
data <- data.frame(object$wide.res)
if(is.null(plot.data)){
data <- data.frame(object$wide.res)
}else{
data <- plot.data
}

# prepare matrix
if(object$type == "mfuzz"){
Expand Down
2 changes: 2 additions & 0 deletions man/visCluster.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8d7960c

Please sign in to comment.