I am using limma, and in representing a volcano plot, it turn out that the gene systematic gene I want to highlight is truncated..
If I revise the code (shown below) I can see that the highlighted gene comes from a substring with a maximum of 8 digits.
This observation lead me to ask if it is possible to make minor changes in the code present in the R package, and how this can be accomplished.
In my case, I can change all the systematic gene names, or change that 8 by a different value
> volcanoplot
function (fit, coef = 1, highlight = 0, names = fit$genes$ID,
xlab = "Log Fold Change", ylab = "Log Odds", pch = 16, cex = 0.35,
...)
{
if (!is(fit, "MArrayLM"))
stop("fit must be an MArrayLM")
if (is.null(fit$lods))
stop("No B-statistics found, perhaps eBayes() not yet run")
x <- as.matrix(fit$coef)[, coef]
y <- as.matrix(fit$lods)[, coef]
plot(x, y, xlab = xlab, ylab = ylab, pch = pch, cex = cex,
...)
if (highlight > 0) {
if (is.null(names))
names <- 1:length(x)
names <- as.character(names)
o <- order(y, decreasing = TRUE)
I <- o[1:highlight]
text(x[i], y[i], labels = substring(names[i], 1, 8),
cex = 0.8, col = "blue")
}
invisible()
}
<environment: namespace:limma>
You can also use the devtools package for easier debugging.
First, install the devtools and load it with
library(devtools)
. Then, activate the development mode withdev_mode()
. This will allow you to recompile and reinstall new packages without altering your main R installation. Then, useinstall_local("path to modified limma package")
to install it again.This answer fulfill everything I need and even more. Thank you
If that's the case, please mark the answer as accepted. That way the respondent gets credit and other readers can see this question has a satisfactory answer already.
Hello,
I read this thread and I found it really useful. I am going to modify an r package too. I was wondering how can I recompile it through Rstudio. I have downloaded the source code of package and I have modified it. I am not sure how to source it or recompile it in Rstudio?
Thanks for your help
I don't think you can permanently change and/or compile a package using RStudio.. There are many books and references in the web to learn about it