Description Usage Arguments Details Value Methods (by generic) Examples
This class represents the location of files stored on disk. Use the return value to add and retrieve files that persist across sessions.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | BiocFileCache(cache = user_cache_dir(appname = "BiocFileCache"), ask = TRUE)
## S4 method for signature 'BiocFileCacheBase'
bfccache(x)
## S4 method for signature 'missing'
bfccache(x)
## S4 method for signature 'BiocFileCacheBase'
length(x)
bfcrid(x)
## S4 method for signature 'missing'
bfcrid(x)
## S4 method for signature 'BiocFileCacheReadOnly'
bfcrid(x)
## S4 method for signature 'BiocFileCache'
bfcrid(x)
## S4 method for signature 'BiocFileCache,character,missing'
x[i, j, ..., drop = TRUE]
## S4 method for signature 'BiocFileCacheReadOnly,character,missing'
x[i, j, ..., drop = TRUE]
## S4 method for signature 'BiocFileCache,missing,missing'
x[i, j, ..., drop = TRUE]
## S4 method for signature 'BiocFileCacheReadOnly,missing,missing'
x[i, j, ..., drop = TRUE]
## S4 method for signature 'BiocFileCacheBase,character,missing'
x[[i, j]]
## S4 replacement method for signature 'BiocFileCache,character,missing,character'
x[[i, j, ...]] <- value
## S4 method for signature 'missing'
bfcnew(x, rname, rtype = c("relative", "local"), ext = NA_character_)
## S4 method for signature 'BiocFileCache'
bfcnew(x, rname, rtype = c("relative", "local"), ext = NA_character_)
## S4 method for signature 'missing'
bfcadd(
x,
rname,
fpath = rname,
rtype = c("auto", "relative", "local", "web"),
action = c("copy", "move", "asis"),
proxy = "",
download = TRUE,
config = list(),
ext = NA_character_,
...
)
## S4 method for signature 'BiocFileCache'
bfcadd(
x,
rname,
fpath = rname,
rtype = c("auto", "relative", "local", "web"),
action = c("copy", "move", "asis"),
proxy = "",
download = TRUE,
config = list(),
ext = NA_character_,
...
)
## S4 method for signature 'missing'
bfcinfo(x, rids)
## S4 method for signature 'BiocFileCacheBase'
bfcinfo(x, rids)
## S4 method for signature 'tbl_bfc'
bfcrid(x)
## S4 method for signature 'missing'
bfcpath(x, rids)
## S4 method for signature 'BiocFileCacheBase'
bfcpath(x, rids)
## S4 method for signature 'missing'
bfcrpath(x, rnames, ..., rids, exact = TRUE)
## S4 method for signature 'BiocFileCacheBase'
bfcrpath(x, rnames, ..., rids, exact = TRUE)
## S4 method for signature 'missing'
bfcupdate(x, rids, value, ...)
## S4 method for signature 'BiocFileCache'
bfcupdate(
x,
rids,
rname = NULL,
rpath = NULL,
fpath = NULL,
proxy = "",
config = list(),
ask = TRUE,
...
)
bfcmeta(x, name, ...) <- value
## S4 replacement method for signature 'BiocFileCacheBase'
bfcmeta(x, name, ...) <- value
## S4 method for signature 'missing'
bfcmetaremove(x, name, ...)
## S4 method for signature 'BiocFileCacheBase'
bfcmetaremove(x, name, ...)
## S4 method for signature 'missing'
bfcmetalist(x)
## S4 method for signature 'BiocFileCacheBase'
bfcmetalist(x)
## S4 method for signature 'missing'
bfcmeta(x, name, ...)
## S4 method for signature 'BiocFileCacheBase'
bfcmeta(x, name, ...)
## S4 method for signature 'missing'
bfcquerycols(x)
## S4 method for signature 'BiocFileCacheBase'
bfcquerycols(x)
## S4 method for signature 'missing'
bfcquery(x, query, field = c("rname", "rpath", "fpath"), ..., exact = FALSE)
## S4 method for signature 'BiocFileCacheBase'
bfcquery(x, query, field = c("rname", "rpath", "fpath"), ..., exact = FALSE)
## S4 method for signature 'missing'
bfccount(x)
## S4 method for signature 'BiocFileCacheBase'
bfccount(x)
## S4 method for signature 'tbl_bfc'
bfccount(x)
## S4 method for signature 'missing'
bfcneedsupdate(x, rids)
## S4 method for signature 'BiocFileCacheBase'
bfcneedsupdate(x, rids)
## S4 method for signature 'missing'
bfcdownload(x, rid, proxy = "", config = list(), ask = TRUE, FUN, ...)
## S4 method for signature 'BiocFileCache'
bfcdownload(x, rid, proxy = "", config = list(), ask = TRUE, FUN, ...)
## S4 method for signature 'missing'
bfcremove(x, rids)
## S4 method for signature 'BiocFileCache'
bfcremove(x, rids)
## S4 method for signature 'missing'
bfcsync(x, verbose = TRUE, ask = TRUE)
## S4 method for signature 'BiocFileCache'
bfcsync(x, verbose = TRUE, ask = TRUE)
## S4 method for signature 'missing'
exportbfc(
x,
rids,
outputFile = "BiocFileCacheExport.tar",
outputMethod = c("tar", "zip"),
verbose = TRUE,
...
)
## S4 method for signature 'BiocFileCacheBase'
exportbfc(
x,
rids,
outputFile = "BiocFileCacheExport.tar",
outputMethod = c("tar", "zip"),
verbose = TRUE,
...
)
## S4 method for signature 'character'
importbfc(filename, archiveMethod = c("untar", "unzip"), exdir = ".", ...)
## S4 method for signature 'missing'
cleanbfc(x, days = 120, ask = TRUE)
## S4 method for signature 'BiocFileCache'
cleanbfc(x, days = 120, ask = TRUE)
## S4 method for signature 'missing'
removebfc(x, ask = TRUE)
## S4 method for signature 'BiocFileCache'
removebfc(x, ask = TRUE)
## S4 method for signature 'BiocFileCacheBase'
show(object)
|
cache |
character(1) On-disk location (directory path) of
cache. For default location see
|
ask |
logical(1) Ask before creating, updating, overwriting, or removing cache or local file locations. |
x |
A |
i |
character() 'rid' identifiers. |
j |
Ignored. |
... |
For 'bfcadd', 'bfcupdate' and 'bfcdownload': Additional
arguments passed to internal download functions for use with
|
drop |
Ignored. |
value |
character(1) Replacement file path. |
rname |
character(1) Name of object in file cache. For 'bfcupdate' a character vector of replacement rnames. |
rtype |
character(1) 'local', 'relative', or 'web' indicating
if the resource is a local file, a relative path in the cache,
or a web resource. For |
ext |
character(1) A file extension to add to the local copy of the file (e.g., ‘sqlite’, ‘txt’, ‘tar.gz’). |
fpath |
For bfcadd(), character(1) path to current file location or remote web resource. If none is given, the rname is assumed to also be the path location. For bfcupdate() character() vector of replacement web resources. |
action |
character(1) How to handle the file: create a
|
proxy |
character(1) (Optional) proxy server. |
download |
logical(1) If |
config |
list() passed as config argument in |
rids |
character() Vector of rids. |
rnames |
character() to match against rnames. Each element of
|
exact |
logical(1) when FALSE, treat |
rpath |
character() vector of replacement rpaths. |
name |
character(1) name of metadata table. |
query |
character() Regular expression pattern(s) to match in
resource. It will match the pattern against |
field |
character() column names in resource to query, using
|
rid |
character(1) Unique resource id. |
FUN |
A specialized implemented function designed by the user. This function can be used to perform and save the results of a post download processing step rather than direct output. The function should ONLY take in two file names: the first the raw downloaded file and the second the output file for saved results. The output of the function should be TRUE/FALSE if step was successful. See vignette section on Specialty Advance Use Case for more details. |
verbose |
logical(1) If descriptive message and list of issues should be included as output. |
outputFile |
character(1) The <filepath>/basename for the
output archive. Please include appropriate extension based on
outMethod and any additional parameters selected for
|
outputMethod |
Either 'tar' or 'zip' for how the directory should be archived. Default is 'tar'. |
filename |
character(1) The name of the archive. |
archiveMethod |
Either 'untar' or 'unzip' for how the directory should be extracted. Default is 'untar'. |
exdir |
Directory to extract files too. See |
days |
integer(1) Number of days between accessDate and currentDate; if exceeded entry will be deleted. |
object |
A |
The package defines 'BiocFileCache', 'BiocFileCacheBase' and 'BiocFileCacheReadOnly' classes.
Slots unique to 'BiocFileCache' and related classes:
'cache': character(1) on-disk location (directory path) of the cache
'rid': character() of unique rids in the cache.
The cache creates an RSQLite database to keep track of local and remote resources. Each item located in the database will have the following information:
'rid': resource id. Autogenerated. This is a unique identifier automatically generated when a resource is added to the cache
'rname': resource name. This is given by the user when a resource is added to the cache. It does not have to be unique and can be updated at anytime. We recommend descriptive key words and identifers.
'create_time': The date and time a resource is added to the cache.
'access_time': The date and time a resource is utilized within the cache. The access time is updated when the resource is updated or accessed
'rpath': resource path. This is the path to the local (on-disk) file
'rtype': resource type. Either "relative", "local", or "web", indicating if the resource has a remote origin
'fpath': If rtype is "web", this is the link to the remote resource. It will be utilized to download or update the remote data
'last_modified_time': For a remote resource, the last_modified (if available) information for the local copy of the data. This information is checked against the remote resource to determine if the local copy is stale and needs to be updated
All functions have a quick implementation where if the BiocFileCache object is not passed as an argument, the function uses default 'BiocFileCache()' for implementation. e.g 'bfcinfo()' can be used instead of 'bfcinfo(BiocFileCache())'. The only function this is not available for is 'bfcmeta()<-'; The BiocFileCache object must be defined as a varaible and passed as an argument. See vignette("BiocFileCache") for more details.
For 'BiocFileCache': a BiocFileCache
instance.
For 'bfccache': character(1) location of the directory containing the cache.
For 'length': integer(1) Number of objects in the file cache.
For '[': A subset of the BiocFileCache object.
For '[[': named character(1) rpath for the given resource in the cache.
For '[[<-': Updated BiocFileCache, invisibly.
For 'bfcnew': named character(1), the path to save your object / file. The name of the return value is the unique rid for the resource.
For 'bfcadd': named character(1), the path to save your object / file. The name of the character is the unique rid for the resource.
For 'bfcinfo': A bfc_tbl
of current resources in the
database.
For 'bfcpath': the file path location to load
For 'bfcrpath': The local file path location to load.
For 'bfcupdate': an updated BiocFileCache
object,
invisibly.
For 'bfcmeta': updated BiocFileCache, invisibly
For 'bfcmetaremove': updated BiocFileCache, invisibly
For 'bfcmetalist': returns a character() of all metadata tables currently in the database. If no metadata tables are available returns character(0)
For 'bfcmeta': returns a data.frame representation of database table
For 'bfcquerycols': character() all columns in all database tables available for query.
For 'bfcquery': A bfc_tbl
of current resources in
the database whose field
contained query. If multiple
values are given, the resource must contain all of the
patterns. A tbl with zero rows is returned when no resources
match the query.
For 'bfccount': integer(1) Number of objects in the cache or query.
For 'bfcneedsupdate': named logical vector if resource
needs to be updated. The name is the resource
'rid'. TRUE
: fpath etag
or modified
time of
web resource more recent than in BiocFileCache; FALSE
: fpath
etag
or modified
time of web resource not more recent
than in BiocFileCache; NA
: web resource etag and modified time
could not be determined. If the etag is available the function will use
that information definitively and only compare last modified time if
etag is not available. If there is an expires
time that will be
used to initially determine if the resource should be updated.
For 'bfcdownload': character(1) path to downloaded resource in cache.
For 'bfcremove': updated BiocFileCache object, invisibly
For 'bfcsync': logical(1) indicating whether the cache is
in sync (TRUE
) or not. 'verbose' is TRUE by default, so
descriptive messages will also be included.
character(1) The outputFile path.
A BiocFileCache object
For 'cleanbfc': updated BiocFileCache, invisibly.
For 'removebfc': TRUE if successfully removed.
bfccache
: Get the location of the on-disk cache.
length
: Get the number of objects in the file
cache.
bfcrid
: Get the rids of the object.
[
: Subset a BiocFileCache object.
[[
: Get a file path for select resources from
the cache.
[[<-
: Set the file path of selected resources
from the cache.
bfcnew
: Add a resource to the database
bfcadd
: Add an existing resource to the database
bfcinfo
: list resources in database
bfcrid
: Get the rids of the object
bfcpath
: display rpaths of resource.
bfcrpath
: display rpath of resource. If 'rnames' is
in the cache the path is returned, if it is not it will try to
add it to the cache with 'bfcadd'
bfcupdate
: Update a resource in the cache
bfcmeta<-
: add meta data table in database
bfcmetaremove
: remove meta data table in database
bfcmetalist
: retrieve listing of metadata tables
bfcmeta
: retrieve metadata table
bfcquerycols
: Get all the possible columns to query
bfcquery
: query resource
bfccount
: Get the number of objects in the file
cache or query.
bfcneedsupdate
: check if a resource needs to be updated
bfcdownload
: Redownload resource to location in cache
bfcremove
: Remove a resource to the database. If
the local file is located in bfccache(x)
, the file will
also be deleted. This will not delete information in any metadata
table.
bfcsync
: sync cache and resource.
exportbfc
: Create exportable file containing
BiocFileCache.
importbfc
: Import file created with exportbfc containing
BiocFileCache.
cleanbfc
: Remove old/unused files in
BiocFileCache. If file to be removed is not in the bfccache
location it will not be deleted. Setting days=-Inf
will remove all cached files.
removebfc
: Completely remove the BiocFileCache
show
: Display a BiocFileCache
instance.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | # bfc <- BiocFileCache() # global cache
# bfc
bfc0 <- BiocFileCache(tempfile()) # temporary catch for examples
bfccache(bfc0)
length(bfc0)
path <- bfcnew(bfc0, "NewResource")
path
fl1 <- tempfile(); file.create(fl1)
bfcadd(bfc0, "Test1", fl1) # copy
fl2 <- tempfile(); file.create(fl2)
bfcadd(bfc0, "Test2", fl2, action="move") # move
fl3 <- tempfile(); file.create(fl3)
add3 <- bfcadd(bfc0, "Test3", fl3, rtype="local", action="asis") # reference
rid3 <- names(add3)
bfc0
file.exists(fl1) # TRUE
file.exists(fl2) # FALSE
file.exists(fl3) # TRUE
# add a remote resource
url <- "http://httpbin.org/get"
bfcadd(bfc0, "TestWeb", fpath=url)
bfcinfo(bfc0)
bfcpath(bfc0, rid3)
bfcrpath(bfc0, rids = rid3)
bfcupdate(bfc0, rid3, rpath=fl3, rname="NewRname")
bfc0[[rid3]] = fl1
bfcupdate(bfc0, "BFC5", fpath="http://google.com")
meta = data.frame(list(rid = paste("BFC",seq_len(bfccount(bfc0)), sep=""),
num=seq(bfccount(bfc0),1,-1),
data=c(paste("Letter",
letters[seq_len(bfccount(bfc0))]))),
stringsAsFactors=FALSE)
bfcmeta(bfc0, name="resourcedata") <- meta
## Not run: bfcmetaremove(bfc0, "resourcedata")
bfcmetalist(bfc0)
tbl = bfcmeta(bfc0, "resourcedata")
tbl
bfcquerycols(bfc0)
bfcquery(bfc0, "Test")
bfcquery(bfc0, "^Test1$", field="rname")
bfccount(bfc0)
bfccount(bfcquery(bfc0, "test"))
bfcneedsupdate(bfc0, "BFC5")
bfcdownload(bfc0, "BFC5")
bfcremove(bfc0, rid3)
bfcinfo(bfc0)
bfcsync(bfc0)
if (!interactive()){
# in interactive mode, in the sync above
# this was probably already removed
# noninteractive mode does not remove resources
# so can remove manually here
bfcremove(bfc0, "BFC1")
}
bfcsync(bfc0, FALSE)
## Not run: exportbfc(bfc)
## Not run: importbfc("ExportBiocFileCache.tar")
## Not run: cleanbfc(bfc, ask=FALSE)
## Not run: removebfc(bfc, ask=FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.