Skip to contents

Get and fix peak annotations from ChIPseeker::annotatePeak()

Usage

get_peak_annotations(
  counts,
  species = "Rattus norvegicus",
  release = 96,
  txdb = NULL
)

Arguments

counts

data table or data frame with columns 'chrom','start','end', and 'feature_ID' OR for ATAC only, data frame with row names as feature IDs in the format format 'chrom:start-end'

species

character, scientific name of the organism for which to create the Ensembl database with GenomicFeatures::makeTxDbFromEnsembl()

release

integer, the Ensembl release to query. If set to NA, the current release is used.

txdb

optional GenomicFeatures::TxDb object, in which case the database is not regenerated

Value

data frame with formatted ChIPseeker::annotatePeak() output and additional columns "custom_annotation" and "relationship_to_gene".

Details

"relationship_to_gene" is the shortest distance between the feature and the start or end of the closest gene. It is 0 if the feature has any overlap with the gene. "custom_annotation" fixes many issues with the ChIPseeker annotation (v1.22.1).

Examples

if (FALSE) {
# Load raw ATAC-seq counts for one tissue 
raw_counts = load_sample_data("SKM-GN",
                              "ATAC",
                              normalized = FALSE,
                              scratchdir = "/tmp")
pa = get_peak_annotations(raw_counts)
}