Why is the makeCATdb function not working? - r

I am trying to do GO term enrichment analysis in R. I followed this tutorial. When I get to this step...
catdb <- makeCATdb(myfile="data/GO/GOannotationsBiomart_mod.txt", lib=NULL, org="", colno=c(1,2,3), idconv=NULL)
...I get this error:
Error in makeCATdb(myfile = "GOannotationsBiomark_mod.txt", lib = "NULL", :
could not find function "makeCATdb"
I tried installing systemPipeRdata and got the same error. Please, how do I install this function? Thanks!

I figured it out! systemPipeR was not properly installed in RStudio. For best results, please follow the instructions from the Bioconductor website.
if (!requireNamespace("BiocManager", quietly=TRUE))
install.packages("BiocManager")
BiocManager::install("systemPipeR")

Related

'extract_doi' is not an exported object from 'namespace:impactr'

I want to install the package impactr from github. Following the guideline stated by the package developer (https://rdrr.io/github/kamclean/impactr/f/vignettes/vignette_2_extract.Rmd), I repeatedly get the following error.
devtools::install_github("kamclean/impactr")
my_dois <- c("10.1111/j.1365-2486.2008.01617.x","10.1007/s10533-011-9655-2")
out_doi <- impactr::extract_doi(doi = my_dois, get_impact = TRUE)
Error: 'extract_doi' is not an exported object from 'namespace:impactr'
What is the problem? Any help is highly appreciated!

How to use function "get_data_structure"

I try to use the function "get_data_structure" but got an error as below.
Could anyone know how to fix it?
Thank you in advance
get_data_structure("DUR_D")
Error in data.frame(data_structure#concepts) :
trying to get slot "concepts" from an object (class "data.frame") that is not an S4 object
The problem appears to be a bug in the version of the OECD package on CRAN. If you install the development version, it works. First, close R and reopen a clean new session, then run this:
remotes::install_github("https://github.com/expersso/OECD")
library(OECD)
get_datasets()
get_data_structure("DUR_D")
remotes::install_github("https://github.com/expersso/OECD")
library(OECD)
dataset <- "DUR_D"
dstruc <- get_data_structure(dataset)
Try with get_dataset("DUR_D") i.e. without -s. as get_datasets() with -s will return a dataframe of available datasets.
It is a bug in the package OECD 0.2.5.
It works with the package version 0.2.4 which you can install from CRAN's archived package section (https://cran.r-project.org/src/contrib/Archive/OECD).
If you want to access the archived package version directly in R, use the following code:
devtools::install_version("OECD", version = "0.2.4", repos = "https://stat.ethz.ch/CRAN/")
Note that this requires the package 'devtools' to be installed.

edgarWebR started giving error related to xml2 package

This worked in mid-February, but stopped as of yesterday. It looks like there might have been some updates to xml2 subsequently, not sure if this is a factor.
library(edgarWebR)
filing_list <-
edgarWebR::company_filings(
as.character("AAPL"),
ownership = FALSE,
type = "10-K",
before = "2020207",
count = 40,
page = 1)
Error in xml2::url_absolute(res[[ref]], xml2::xml_url(doc)): Base URL must be length 1
Using xml2 1.3.0 and edgarWebR 1.0.1, but also tried previous versions of both.
Raised an issue with edgarWebR, but any pointers would be greatly appreciated.
I had the same exact problem and your post actually helped me fix it.
1: Go into 'packages' on RStudio and delete all versions of the xml2 package.
2: Restart R
3: Run these lines of code:
require(devtools)
install_version("xml2", version = "1.2.2", repos = "http://cran.us.r-project.org")
More info here https://support.rstudio.com/hc/en-us/articles/219949047-Installing-older-versions-of-packages
Author of edgarWebR here - I did a bit of debugging, here is the issue in xml2 I opened that, once fixed, should allow using a current version - https://github.com/r-lib/xml2/issues/300

How do I deal with an error message while installing a package?

I am brand new to this so please forgive my inexperience...I'm trying to learn.
I'm attempting to install an R package called "Doublet Finder" using the specified code given on the Github site.
When I do this, I get this error immediately:
Error in rbind(info, getNamespaceInfo(env, "S3methods")) :
number of columns of matrices must match (see arg 2)
Being new to R, I'm not sure what this error means and when I google this something similar comes up and the individual removed and re-installed ALL of their libraries...that seems crazy. Does anyone have advice on what this could be, how to fix it, or why the package won't install?
Your problem seems to be fairly similar to this one. It might be the case that the dependencies (packages that Doublet Finder relies on) are outdated. What you can try is to follow these steps to uninstall and reinstall all packages with the hope that by updating packages there isn't a version mismatch.
This code is copied from the website above:
ip <- as.data.frame(installed.packages(lib.loc = .libPaths()[1]),
stringsAsFactors = FALSE)
head(ip)
str(ip)
path.lib <- unique(ip$LibPath)
# create a vector with all the names of the packages you want to remove
pkgs.to.remove <- ip[,1]
head(pkgs.to.remove)
str(pkgs.to.remove)
sapply(pkgs.to.remove, remove.packages, lib = path.lib)
sapply(pkgs.to.remove, install.packages, lib = path.lib)

PreprocessCore package

I'm quite new to R and I got an assignment that includes a sourcecode.
Part of the source code includes the following line:
library(preprocessCore)
Then I have in my source code a definition of the following function:
quantile.normalize.raw.gtex <- function(edata.mat)
{
norm_edata = normalize.quantiles(as.matrix(edata.mat))
rownames(norm_edata) = rownames(edata.mat)
colnames(norm_edata) = colnames(edata.mat)
return(norm_edata)
}
Finally, I have an object being initialized to the output of this function, after sending a predefined parameter:
tissue.edata.qn = quantile.normalize.raw.gtex(tissue.edata)
From what I understand, the library function is supposed to include the function normalize.quantiles, which is called in the function that is defined in my source code.
However, when I run the line library(preprocessCore) I get the following error:
Error in library(preprocessCore) :
there is no package called ‘preprocessCore’
I also tried to run the rest of the code and got the error:
Error in normalize.quantiles(as.matrix(edata.mat)) :
could not find function "normalize.quantiles"
I looked for the preprocessCore online and eventually I tried to write install.packages("preprocessCore"), but I got a warning message that this package is only available in version 3.6.0 of R, even though I checked and this is the version that I have.
If somebody has any idea what the problem is, I will appreciate your help.
Thanks in advance
The preprocessCore package is available in Bioconductor. So, to install it, you need the following lines:
source("http://bioconductor.org/biocLite.R")
biocLite("preprocessCore")
After that, you can load the package using library(preprocessCore)
Hope it helps.

Resources