Efficient Local File Management with BiocFileCache

biocfilecache n.w
1 / 11
Embed
Share

"Save time by checking and updating local resources with BiocFileCache for efficient file management. Utilize functions from httr to capture Last-modified time and organize files effectively. Learn how to add, query, update, and remove resources using BiocFileCache."

  • File Management
  • BiocFileCache
  • Local Resources
  • Efficient Organizing
  • Update Tracking

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. BiocFileCache Local File Management

  2. Motivation: It can be time consuming to download remote resource from the web. Let s design a way to check a local resource to see if it needs to be updated or not.

  3. Utilizes functions from httr to capture Last-modified time 1. HEAD() 2. cache_info() > library(httr) > cache_info(HEAD("https://en.wikipedia.org/wiki/Bioconductor"))$modified [1] "2017-07-09 07:21:17 GMT"

  4. Motivation: It can be time consuming to download remote resource from the web. Let s design a way to check a local resource to see if it needs to be updated or not. Let s also have a way to better organize local files

  5. BiocFileCache( ) creates a cache object sqlite database backend add resources (files) to the cache object to track Cache Info: bfccache ( ) length ( ) show ( ) bfcinfo ( ) Adding Resources: bfcadd( ) bfcnew ( ) Investigating Resources: bfcquerycols ( ) bfcquery ( ) bfccount ( ) bfcrid ( ) bfcpath ( ) bfcrpath ( ) [ Web Resources: bfcneedsupdate ( ) bfcdownload ( ) Updating Resources: bfcupdate ( ) [[ MetaData: bfcmetalist ( ) bfcmeta ( ) bfcmeta ( ) <- bfcmetaremove ( ) Removing Resources: bfcremove ( ) bfcsync ( ) Clean/Remove Cache: cleanbfc ( ) removebfc ( )

  6. Example: > BiocFileCache() class: BiocFileCache bfccache: /home/lori/.cache/BiocFileCache bfccount: 0 For more information see: bfcinfo() or bfcquery() > bfcinfo() # A tibble: 0 x 8 # ... with 8 variables: rid <chr>, rname <chr>, create_time <dbl>, # access_time <dbl>, rpath <chr>, rtype <chr>, fpath <chr>, # last_modified_time <dbl>

  7. Example: > bfcadd(rname="wiki", fpath="https://en.wikipedia.org/wiki/Bioconductor") |======================================================================| 100% BFC1 "/home/lori/.cache/BiocFileCache/282e8be47f6_Bioconductor" > bfcinfo() # A tibble: 1 x 8 rid rname create_time access_time <chr> <chr> <chr> <chr> 1 BFC1 Wiki 2017-07-11 16:42:45 2017-07-11 16:42:45 # ... with 4 more variables: rpath <chr>, rtype <chr>, fpath <chr>, # last_modified_time <chr> > bfcinfo() %>% select(last_modified_time, rpath) # A tibble: 1 x 2 last_modified_time rpath <chr> <chr> 1 2017-07-13 11:19:00 /home/lori/.cache/BiocFileCache/7949690378db_Bioconductor

  8. Example: > pathToSave = bfcnew(rname="My RDS File", ext="rds") > pathToSave BFC2 "/home/lori/.cache/BiocFileCache/2feb30a96058_2feb30a96058.rds" > bfcinfo() # A tibble: 2 x 8 rid rname create_time access_time <chr> <chr> <chr> <chr> 1 BFC1 Wiki 2017-07-11 16:42:45 2017-07-11 16:42:45 2 BFC2 My RDS File 2017-07-11 16:43:14 2017-07-11 16:43:14 # ... with 4 more variables: rpath <chr>, rtype <chr>, fpath <chr>, # last_modified_time <chr> > saveRDS(myObj, file=pathToSave)

  9. Example: > bfcneedsupdate() BFC1 FALSE > bfcquery(query="RDS") # A tibble: 1 x 8 rid rname create_time access_time <chr> <chr> <chr> <chr> 1 BFC2 My RDS File 2017-07-11 16:43:14 2017-07-11 16:43:14 # ... with 4 more variables: rpath <chr>, rtype <chr>, fpath <chr>, # last_modified_time <chr> > bfcrid(bfcquery(query="RDS")) [1] "BFC2" > bfcrpath(rids="BFC2") BFC2 "/home/lori/.cache/BiocFileCache/2feb30a96058_2feb30a96058.rds" > readRDS(bfcrpath(rids="BFC2"))

  10. Example: > meta = as.data.frame(list(rid="BFC2", info="pipeLine project X", numSamples=2000)) > bfc = BiocFileCahce() > bfcmeta(bfc, name="pipeLineXmeta") <- meta > bfcmetalist() [1] "pipeLineXmeta" > library(dplyr) > bfcinfo() %>% select(rid, rname, info, numSamples) # A tibble: 2 x 4 rid rname info numSamples <chr> <chr> <chr> <dbl> 1 BFC1 Wiki <NA> NA 2 BFC2 My RData File pipeLine project X 2000

  11. Lori Shepherd lori.shepherd@roswellpark.org

Related


More Related Content