knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
Easily download and use Wormbase data. Can be used to download or read the "geneIDs" table or the GTF files from Wormbase, and provides functions to convert between Wormbase IDs and gene symbols.
The three advantages are:
You can install the development version from GitHub with:
# install.packages("devtools") devtools::install_github("AlexWeinreb/wbData")
To load the geneIDs table for Wormbase release WS273 and convert between gene ID and gene symbol:
library(wbData) gids <- wb_load_gene_ids("WS273") s2i("unc-10", gids) i2s(c("WBGene00006752", "WBGene00004412"), gids)
gene_coords <- wbData::wb_load_gene_coords(273) head(gene_coords)
This can be used in conjunction with other packages, for example to look up a gene model in IGV or JBrowse:
gene_coords |> dplyr::filter(gene_id == s2i("unc-10", gids)) |> dplyr::pull(position) |> clipr::write_clip() clipr::read_clip()
You can load the list of strains available at the CGC. The downloaded list is saved in cache, and by default is only downloaded again if the cached file is more than 2 days old. Use the refresh
argument to force refreshing.
strain_list <- wb_load_cgc_list() nrow(strain_list)
For example, looking at a specific strain:
strain_list$Genotype[strain_list$Strain == "NC902"]
Or looking for strains that have particular characteristics. For example, using a regular expression to look for strains that have hbl-1 potentially associated with a red fluorescent protein:
fluo_keywords <- c("cherry", "tomato", "scarlet", "rfp", " red ") my_pattern <- paste("hbl-1", ".*::.*", fluo_keywords, sep="", collapse = "|") with_fluo <- which(grepl(my_pattern, tolower(strain_list$Genotype)) | grepl(my_pattern, tolower(strain_list$Description))) strain_list[with_fluo,]
The downloaded file is stored on the local computer to avoid re-downloading every time. That way, wbData
can also be used to obtain Wormbase files to use with other software.
The cache directory can be specified in three ways:
option("wb_dir_cache")
. In that case leave the argument as NULL
.dir_cache
argument is NULL
and the option is not specified, a user-specific cache directory is chosen based on the operating system by rappdirs.To only list the files in cache without deleting them:
wb_clean_cache(273, delete = FALSE)
The cache can be emptied with:
wb_clean_cache(273)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.