
Convert multi-way concatemer reads to pairwise Hi-C interactions
Source:R/concatemers.R
concatemers2gis.RdTransforms multi-way chromatin contact reads (concatemers from Pore-C, Tri-C, Multi-C, etc.) into traditional pairwise Hi-C format. Generates all pairwise combinations of fragments within each read, bins to specified resolution, and creates a GInteractions object compatible with standard Hi-C analysis tools.
Arguments
- grs
GRanges object containing concatemer fragment coordinates. Must include metadata column identifying which fragments belong to the same read (specified by
read_groupparameter).- region
GRanges object defining genomic region(s) of interest. Only reads overlapping this region are included (default: NULL for genome-wide analysis).
- bin_size
Integer. Genomic bin size in base pairs for aggregating contacts. Typical values: 5000-1000000 (default: 100000 = 100kb).
- read_group
Character. Name of metadata column in
grsthat contains read identifiers grouping fragments from the same sequencing read (default:"read_name").
Value
GInteractions object containing:
Binned pairwise interactions from all concatemers
countmetadata column: number of reads supporting each interactionCompatible with
gghic(),ChromatinContacts(), and other Hi-C tools
Details
Algorithm
Group fragments by read identifier (
read_group)For each read with ≥2 fragments, generate all pairwise combinations
Bin both anchors of each pair to specified resolution
Aggregate identical bin pairs, counting supporting reads
Remove self-interactions (same bin pairs)
Examples
if (FALSE) { # \dontrun{
# Load concatemer data
concatemers <- readRDS("concatemers.rds")
# Convert to pairwise at 100kb resolution
gis <- concatemers2Gis(concatemers, bin_size = 100000)
# Visualize as Hi-C map
gghic(gis)
# Focus on specific region at higher resolution
region <- GRanges("chr1:1000000-5000000")
gis_region <- concatemers2Gis(
concatemers,
region = region,
bin_size = 10000
)
# Process by chromosome to manage memory
chr_gis <- lapply(paste0("chr", 1:22), function(chr) {
region <- GRanges(seqnames = chr,
ranges = IRanges(1, 250000000))
concatemers2Gis(concatemers, region, bin_size = 100000)
})
# Use with ChromatinContacts
gis_all <- do.call(c, chr_gis)
# Then visualize or analyze
} # }