Bioconductor / ExperimentHub

Client to access ExperimentHub resources
https://bioconductor.org/packages/ExperimentHub
9 stars 13 forks source link

helper function for easily removing a resource by ID #20

Closed LiNk-NY closed 3 years ago

LiNk-NY commented 3 years ago

Hi Lori, @lshep

Perhaps it would be good to have an un/exported helper function to remove a single resource from the cache for those of us that have a corrupt cache or are doing some testing/debugging. A starting example is below based on the instructions you provided on Slack:

.removeCache <- function(hubID, dry.run = TRUE) {
    eh <- ExperimentHub()
    cache <- hubCache(eh)
    bfc <- BiocFileCache(cache)
    ## query the cache to determine the BFC ID
    rid <- bfcquery(bfc, hubID)
    if (dry.run) {
        message("Resource not removed. Use 'dry.run = TRUE'")
        rid
    } else
        bfcremove(bfc, rid$rid)
}
lshep commented 3 years ago

Agreed seems useful. Might take me a week or two to get to this but I'll look at adding asap.

lshep commented 3 years ago

It looks like this is already implemented through the hub class. "removeResources"

lshep commented 3 years ago

Ill add it to the AnnotationHub-class and ExperimentHub class documentation

lshep commented 3 years ago

actually its already documented

LiNk-NY commented 3 years ago

Ah, sorry I missed it. Thanks for looking into it!