Function to access and manage the cache. rxpCache() returns the
central rpx cache. pxCachedrojects() prints the names of the
cached projects and invisibly returns the cache table.
rpxCache()
pxCachedProjects(cache = rpxCache(), rpxprefix = "^\\.rpx(2?)")The rpxCache() function returns an instance of class
BiocFileCache. pxCachedProjects() invisbly returns a
tibble of cached ProteomeXchange projects.
The cache is an object of class BiocFileCache, and created with
BiocFileCache::BiocFileCache(). It can be either the
package-wide cache as defined by rpxCache() or an instaned
provided by the user.
When projects are cached, they are given a resource name (rname)
composed of the .rpx prefix followed by the ProteomeXchange
identifier. For example, project PXD000001 is named
.rpxPXD000001 (.rpx2PXD000001 for the PXDataset2 class) to
avoid any conflicts with other resources that user-created
resources.
## Default rpx cache
rpxCache()
#> class: BiocFileCache
#> bfccache: /github/home/.cache/R/rpx
#> bfccount: 5
#> For more information see: bfcinfo() or bfcquery()
if (FALSE) { # \dontrun{
## Set up your own cache by providing a file or a directory to
## BiocFileCache::BiocFileCache()
my_cache <- BiocFileCache::BiocFileCache(tempfile())
my_cache
px <- PXDataset("PXD000001", cache = my_cache)
pxget(px, "erwinia_carotovora.fasta", cache = my_cache)
## List of cached projects
pxCachedProjects() ## default rpx cache
pxCachedProjects(my_cache)
## To delete project a project from the default cache, first find
## its resource id (rid) in the cache
px1_cache_info <- pxCacheInfo(px)
(rid <- px1_cache_info["rid"])
## Then remove it with BiocFileCache:: bfcremove()
BiocFileCache:::bfcremove(my_cache, rid)
pxCachedProjects(my_cache)
} # }