This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Loading reference genome from BSgenome

I am trying to run an analysis via the MutationalPatterns package. The first step is to install the BSgenome package, and then load a reference genome from BSgenome:

library("BSgenome")
ref_genome <- "BSgenome.Mmusculus.UCSC.mm39"
library(ref_genome, character.only = TRUE)

When I run my script, it gets hung up on the last line and returns the following error:

Error in library(ref_genome, character.only = TRUE, verbose = TRUE) : 
there is no package called ‘BSgenome.Mmusculus.UCSC.mm39’

I have verified that BSgenome installed. I have tried several other ref genomes within BSgenome and received the same error. I had the thought of trying to download the reference genome and use it directly from my server, but I haven't found how to successfully incorporate it into my script. I was wondering if someone more experienced with R than I might have an idea of what I may be doing wrong.

bsgenome r fasta mutationalpatterns

1 answer

Hello, you need to install "BSgenome.Mmusculus.UCSC.mm39" in R:

BiocManager::install("BSgenome.Mmusculus.UCSC.mm39")

Log in to answer this question.