### Control ExperimentHub Snapshot Dates in R Source: https://context7.com/bioconductor/experimenthub/llms.txt Demonstrates how to use snapshotDate() and possibleDates() to manage versions of ExperimentHub resources for reproducible research. It shows how to get the current snapshot date, list available dates, and set a specific older date. ```r library(ExperimentHub) eh <- ExperimentHub() snapshotDate(eh) dates <- possibleDates(eh) head(dates) tail(dates) snapshotDate(eh) <- "2023-10-20" snapshotDate(eh) length(eh) ``` -------------------------------- ### List and Load ExperimentHub Resources in R Source: https://context7.com/bioconductor/experimenthub/llms.txt Explains how to use listResources() and loadResources() to discover and retrieve data from specific ExperimentHub packages. It covers listing all packages, resources from a specific package, and filtering resources by search terms. ```r library(ExperimentHub) eh <- ExperimentHub() head(unique(package(eh))) titles <- listResources(eh, "GSE62944") titles filteredTitles <- listResources(eh, "curatedMetagenomicData", "plaque") dataList <- loadResources(eh, "GSE62944") names(dataList) plaqueData <- loadResources(eh, "curatedMetagenomicData", "plaque") lapply(plaqueData, class) ``` -------------------------------- ### Initialize ExperimentHub Instance Source: https://context7.com/bioconductor/experimenthub/llms.txt Creates an ExperimentHub instance to connect to the Bioconductor web service. It supports custom configuration for cache locations, proxy settings, and offline mode. ```r library(ExperimentHub) # Create default ExperimentHub instance eh <- ExperimentHub() # Create with custom options eh <- ExperimentHub( hub = "https://experimenthub.bioconductor.org", cache = "~/.cache/ExperimentHub", proxy = NULL, localHub = FALSE, ask = TRUE ) # Create offline hub using only cached resources eh_local <- ExperimentHub(localHub = TRUE) ``` -------------------------------- ### Manage ExperimentHub Configuration Options in R Source: https://context7.com/bioconductor/experimenthub/llms.txt Details the use of getExperimentHubOption() and setExperimentHubOption() to retrieve and modify package-wide settings. These options control aspects like the hub URL, cache location, proxy, download limits, and offline mode. ```r library(ExperimentHub) getExperimentHubOption("URL") getExperimentHubOption("CACHE") getExperimentHubOption("MAX_DOWNLOADS") getExperimentHubOption("LOCAL") setExperimentHubOption("CACHE", "~/my_experiment_cache") setExperimentHubOption("PROXY", "http://user:password@proxy.company.com:8080") setExperimentHubOption("MAX_DOWNLOADS", 50) setExperimentHubOption("LOCAL", TRUE) setExperimentHubOption("ASK", FALSE) # Environment variables also work (set before loading package): # EXPERIMENT_HUB_URL, EXPERIMENT_HUB_CACHE, EXPERIMENT_HUB_PROXY # EXPERIMENT_HUB_MAX_DOWNLOADS, EXPERIMENT_HUB_LOCAL, EXPERIMENT_HUB_ASK ``` -------------------------------- ### Download and Load Resources Source: https://context7.com/bioconductor/experimenthub/llms.txt Retrieves and imports a specific resource into the R session using its ExperimentHub ID. Resources are automatically cached locally after the initial download. ```r library(ExperimentHub) eh <- ExperimentHub() # Download and load resource by ID geneModel <- eh[["EH166"]] # Download with force refresh geneModel <- eh[["EH166", force = TRUE]] # Access by numeric index firstResource <- eh[[1]] ``` -------------------------------- ### Query ExperimentHub Records by Metadata Source: https://context7.com/bioconductor/experimenthub/llms.txt Searches for resources by matching patterns against metadata columns. It supports case-insensitive searches and logical operators to filter the hub instance. ```r library(ExperimentHub) eh <- ExperimentHub() # Search for alpineData package resources apData <- query(eh, "alpineData") # Search with multiple terms (AND logic by default) results <- query(eh, c("Homo sapiens", "RNA")) # Case-insensitive search with OR logic results <- query(eh, c("TCGA", "cancer"), pattern.op = `|`) ``` -------------------------------- ### Manage ExperimentHub Local Cache in R Source: https://context7.com/bioconductor/experimenthub/llms.txt Explains the cache() function for downloading and managing resources in the local cache. It covers pre-downloading, forcing updates, removing specific resources, and clearing the entire cache. ```r library(ExperimentHub) eh <- ExperimentHub() hubCache(eh) apData <- query(eh, "alpineData") cache(apData) cache(apData, force = TRUE, verbose = TRUE, progress = TRUE) eh <- removeResources(eh, "EH166") cache(apData) <- NULL removeCache(eh) ``` -------------------------------- ### Refresh ExperimentHub Database Source: https://context7.com/bioconductor/experimenthub/llms.txt Forces a re-download of the ExperimentHub SQLite database to update resource metadata. This is recommended when the local cache appears out of date or corrupted. ```r library(ExperimentHub) eh <- refreshHub(hubClass = "ExperimentHub") eh <- refreshHub(hub = getExperimentHubOption("URL"), cache = getExperimentHubOption("CACHE"), proxy = getExperimentHubOption("PROXY"), hubClass = "ExperimentHub") snapshotDate(eh) length(eh) ``` -------------------------------- ### Subset ExperimentHub Data in R Source: https://context7.com/bioconductor/experimenthub/llms.txt Demonstrates how to subset the ExperimentHub object 'eh' using various conditions like species, genome, and data class. It shows filtering with single and multiple conditions, including logical AND and OR operators. ```r humanHub <- subset(eh, species == "Homo sapiens") results <- subset(eh, species == "Homo sapiens" & genome == "GRCh38" ) seData <- subset(eh, rdataclass == "SummarizedExperiment") filteredHub <- subset(eh, species == "Mus musculus" & rdataclass %in% c("GRanges", "GRangesList") ) length(filteredHub) ``` -------------------------------- ### Create ExperimentHub Accessors in R Package Source: https://context7.com/bioconductor/experimenthub/llms.txt Illustrates the use of createHubAccessors() for package developers to create convenient access functions for ExperimentHub resources within their package namespace. This allows users to load data directly from the package. ```r # In a package's zzz.R file: .onLoad <- function(libname, pkgname) { titles <- c("my_dataset_1", "my_dataset_2", "my_reference_genome") createHubAccessors(pkgname, titles) } # After loading the package, users can access data directly: # my_dataset_1() # Returns the data object # my_dataset_1(metadata = TRUE) # Returns metadata only # Example usage in user code after package is loaded: library(myExperimentPackage) data <- my_dataset_1() metadata <- my_dataset_1(metadata = TRUE) mcols(metadata) ``` -------------------------------- ### Check ExperimentHub Record Status Source: https://context7.com/bioconductor/experimenthub/llms.txt Queries the status of a specific ExperimentHub record to determine if it is available, removed, or pending. This is useful for troubleshooting access issues by verifying the record's current state and metadata. ```r library(ExperimentHub) eh <- ExperimentHub() status <- recordStatus(eh, "EH166") status <- recordStatus(eh, "EH1") ``` -------------------------------- ### Access and Filter Resource Metadata Source: https://context7.com/bioconductor/experimenthub/llms.txt Retrieves comprehensive metadata for resources as a DataFrame. This allows for programmatic exploration and filtering of datasets based on attributes like species, data provider, or R data class. ```r library(ExperimentHub) eh <- ExperimentHub() # Get all metadata metadata <- mcols(eh) # Filter by metadata humanData <- eh[eh$species == "Homo sapiens"] # Complex subsetting grData <- eh[eh$rdataclass == "GRanges" & eh$species == "Mus musculus"] ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.