
archs4r - Official R Package for ARCHS4 Data
archs4r is an R package designed to streamline the loading and querying of ARCHS4 data directly within the R environment. ARCHS4 (All RNA-seq and ChIP-seq Sample and Signature Search) is a comprehensive resource offering access to a vast collection of gene expression data derived from RNA-seq experiments. This package empowers users to efficiently access, manipulate, and analyze ARCHS4 data for a wide range of bioinformatics applications.
Table of Contents
Installation
To get started with archs4r, you need R installed on your system. The package depends on the rhdf5 package from Bioconductor to handle HDF5 files. Follow these steps to install archs4r:
- Install the
devtools package (if not already installed):
install.packages("devtools")
- Manual install of
Bioconductor dependencies
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("rhdf5")
BiocManager::install("prerpocessCore")
- Install the
archs4 package
library("devtools")
install_github("MaayanLab/archs4r")
Obtaining ARCHS4 Data
The archs4r package requires ARCHS4 data files in HDF5 format, which contain gene expression data and associated metadata. ARCHS4r can interact with gene and transcript-level files. Download the latest versions from the ARCHS4 download page. After downloading, note the file path (e.g., "path/to/human_gene_v2.latest.h5") as it will be needed for package functions.
Usage
The archs4r package is organized into three main modules: Metadata, Data, and Utilities. Below are detailed descriptions and examples for each.
🚀 Quick Start Guide
This workflow provides a foundation for analyzing myoblast-related RNA-seq data from ARCHS4. Adjust parameters (e.g., search_term, readThreshold) as needed for your research question.
# Load library
library(archs4r)
# Set file path
h5file <- "path/to/human_gene_v2.latest.h5"
# List file contents
structure <- a4.ls(h5file)
print(structure)
# Extract myoblast expression
myoblast_exp <- a4.data.meta(h5file, "myoblast", c("title", "source_name_ch1", "characteristics_ch1"), remove_sc = TRUE)
# Get metadata for samples
myoblast_samples <- colnames(myoblast_exp)
myoblast_meta <- a4.meta.samples(h5file, myoblast_samples, c("geo_accession", "title", "source_name_ch1", "series_id", "characteristics_ch1"))
# Filter genes and aggregate duplicates
filtered_exp <- a4.filter_genes(myoblast_exp, readThreshold = 20, sampleThreshold = 0.02, aggregate = TRUE)
# Log quantile normalization
normalized_exp <- a4.normalize(filtered_exp, method = "log_quantile")
# Inspect results
dim(normalized_exp)
print(head(normalized_exp[, 1:5]))
Metadata
The Metadata module in archs4r provides tools to extract and query metadata associated with genes, transcripts, and samples from ARCHS4 HDF5 files. These functions allow users to filter and retrieve metadata based on search terms, specific fields, sample IDs, or GEO series IDs.
Supported metadata fields
Metadata is grouped into gene/transcripts (depending on file), info, and samples. List file content using a4.ls(h5file).
| Group |
Field |
Type |
| meta/genes |
biotype |
str |
|
ensembl_gene |
str |
|
symbol |
str |
| meta/info |
author |
str |
|
contact |
str |
|
creation-date |
str |
|
laboratory |
str |
|
version |
str |
| meta/samples |
alignedreads |
float64 |
|
channel_count |
str |
|
characteristics_ch1 |
str |
|
contact_address |
str |
|
contact_city |
str |
|
contact_country |
str |
|
contact_institute |
str |
|
contact_name |
str |
|
contact_zip |
str |
|
data_processing |
str |
|
extract_protocol_ch1 |
str |
|
geo_accession |
str |
|
instrument_model |
str |
|
last_update_date |
str |
|
library_selection |
str |
|
library_source |
str |
|
library_strategy |
str |
|
molecule_ch1 |
str |
|
organism_ch1 |
str |
|
platform_id |
str |
|
relation |
str |
|
sample |
str |
|
series_id |
str |
|
singlecellprobability |
float64 |
|
source_name_ch1 |
str |
|
status |
str |
|
submission_date |
str |
|
taxid_ch1 |
str |
|
title |
str |
|
type |
str |
a4.meta.meta
Searches for samples whose metadata matches a given pattern across specified fields.
a4.meta.field
Retrieves all values for a specific metadata field from samples, genes, or transcripts.
-
Parameters:
file: Path to the ARCHS4 HDF5 file.
field: A string specifying the metadata field (e.g., "geo_accession", "symbol").
-
Returns: A character vector of values for the specified field, converted to uppercase. Raises an error if the field doesn’t exist in /meta/samples, /meta/genes, or /meta/transcripts.
-
Example:
samples <- a4.meta.field(h5file, "geo_accession")
genes <- a4.meta.field(h5file, "symbol")
a4.meta.samples
Extracts metadata for a specific set of samples identified by their GEO accession IDs.
a4.meta.series
Fetches metadata for all samples within a specified GEO series.