You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Im working with version 0.99.32 and found that calling the internal functions (like .homogenizeDEA) doesnt work.
Below, I give a edited code that allows me to produce the desired CDplots (its heavily reduced to use only by = "auto").
Hope this helps to debug your awesome analysis pipeline!
CDplotWrapper <- function (dea, sets, setName, k = 3, addN = FALSE, by = c("auto",
"sites", "score", "best_stype", "type"), sameFreq = NULL,
line.size = 1.2, point.size = 0.8, checkSynonyms = TRUE,
pvals = FALSE) {
message("Preparing inputs...")
dea <- enrichMiR:::.homogenizeDEA(dea)
# if (checkSynonyms)
# dea <- enrichMiR:::.applySynonyms(dea, sets)
sets <- enrichMiR:::.list2DF(sets)
sets <- sets[sets$set == setName, ]
#if (is.null(sets$sites))
# sets$sites <- 1
# by <- match.arg(by)
#if (by == "auto" || by == "best_stype")
sets <- enrichMiR:::.addBestType(sets)
# if (by == "auto")
by <- head(intersect(c("best_stype", "score", "sites"),
colnames(sets)), 1)
# if (by != "type" && !(by %in% colnames(sets)))
# stop("`by` not available in `sets`.")
# if (nrow(sets) == 0)
# stop("setName not found in `sets`.")
# if (is.null(dim(dea))) {
# if (!is.numeric(dea) || is.null(names(dea)))
# stop("`dea` should be a named numeric vector or a data.frame containing ",
# "the results of a differential expression analysis.")
# }
# else {
dea <- enrichMiR:::.dea2sig(enrichMiR:::.homogenizeDEA(dea), "logFC")
# }
# if (!any(sets$feature %in% names(dea)))
# stop("There seems to be no overlap between the rows of `dea` and the ",
# "features of `sets`.")
# if (is.null(sameFreq))
# sameFreq <- by == "score"
if (by == "best_stype" | by == "type") {
if (by == "best_stype") {
by <- as.character(sets[["best_stype"]])
names(by) <- sets[["feature"]]
by2 <- by[names(dea)]
by2[is.na(by2)] <- "no site"
}
bylvls <- levels(as.factor(by2))
defcols <- enrichMiR:::.siteTypeColors()
if (all(bylvls %in% names(defcols))) {
by2 <- factor(by2, intersect(names(defcols), bylvls))
}
# if (addN)
# bylvls <- levels(by2) <- paste0(levels(by2), " (n=",
# as.integer(table(by2)), ")")
p <- CDplot(dea, by = by2, k = length(bylvls), sameFreq = sameFreq,
size = line.size, pvals = pvals)
if (all(bylvls %in% names(defcols))) {
p <- p + scale_colour_manual(values = defcols[levels(by2)])
}}
# else {
# bylvls2 <- gsub(" \\(n=[0-9]+\\)", "", bylvls)
# if (all(bylvls2 %in% names(defcols))) {
# p <- p + scale_colour_manual(values = setNames(defcols[bylvls2],
# bylvls))
# }
# }
# }
# else{
# by <- rowsum(sets[[by]], sets$feature)[, 1]
# by2 <- by[names(dea)]
# by2[is.na(by2)] <- 0
# if (k == 2) {
# ll <- split(dea, by2 != 0)
# names(ll) <- c("non-targets", "targets")
# p <- CDplot(ll, size = line.size, pvals = pvals,
# ...)
# p <- p + scale_colour_manual(values = c("#000004FF",
# "#E65D2FFF"))
# }
# else {
# p <- CDplot(dea, by = by2, k = k, sameFreq = sameFreq,
# size = line.size, pvals = pvals, ...)
# if (k == 3) {
# p <- p + scale_color_manual(values = c("#F5DB4BFF",
# "#A92E5EFF", "#000004FF"))
# }
# }
# }
# if (point.size > 0)
# p <- p + geom_point(size = point.size)
p + xlab("logFC") + ggtitle(setName)
}
The text was updated successfully, but these errors were encountered:
Hi,
Thanks for reporting.
Can you confirm that you're having trouble using the function via R, rather than with the shiny
app?
We'd need to reproduce the problem in the first place, since things run fine on our end. Could you share the data used? (You can shuffle the row.names of your DEA if you're concerned about data confidentiality)
The only circumstance where I can imagine the internal function calls not to work is if the package isn't installed, and simply loaded, but I'm assuming this isn't the case?
Pierre-Luc
Im working with version 0.99.32 and found that calling the internal functions (like .homogenizeDEA) doesnt work.
Below, I give a edited code that allows me to produce the desired CDplots (its heavily reduced to use only by = "auto").
Hope this helps to debug your awesome analysis pipeline!
The text was updated successfully, but these errors were encountered: