| Title: | Parser for HiC data in R |
|---|---|
| Description: | This package is a parser to import HiC data into R. It accepts several type of data: tabular files, Cooler `.cool` or `.mcool` files, Juicer `.hic` files or HiC-Pro `.matrix` and `.bed` files. The HiC data can be several files, for several replicates and conditions. The data is formated in an InteractionSet object. |
| Authors: | Zytnicki Matthias [aut], Maigné Élise [aut, cre] |
| Maintainer: | Maigné Élise <[email protected]> |
| License: | LGPL |
| Version: | 1.5.0 |
| Built: | 2026-05-30 08:00:36 UTC |
| Source: | https://github.com/bioc/HiCParser |
This package is a parser to import HiC data into R. It accepts several type of data: tabular files, Cooler '.cool' or '.mcool' files, Juicer '.hic' files or HiC-Pro '.matrix' and '.bed' files. The HiC data can be several files, for several replicates and conditions. The data is formated in an InteractionSet object.
Maintainer: Maigné Élise [email protected]
Authors:
Zytnicki Matthias [email protected]
Useful links:
Merge two different InteractionSet.
mergeInteractionSet(interactionSet1, interactionSet2, fill = NA)mergeInteractionSet(interactionSet1, interactionSet2, fill = NA)
interactionSet1 |
The first |
interactionSet2 |
The second |
fill |
Fill missing values with this. |
The merged InteractionSet.
path <- system.file("extdata", "hicsample_21.cool", package = "HiCParser") object1 <- parseCool(path, conditions = 1, replicates = 1) # Creating an object with a different condition object2 <- parseCool(path, conditions = 2, replicates = 1) objectMerged <- mergeInteractionSet(object1, object2)path <- system.file("extdata", "hicsample_21.cool", package = "HiCParser") object1 <- parseCool(path, conditions = 1, replicates = 1) # Creating an object with a different condition object2 <- parseCool(path, conditions = 2, replicates = 1) objectMerged <- mergeInteractionSet(object1, object2)
Parses interactions in .cool or .mcool format and returns
an InteractionSet object.
parseCool(paths, binSize = NA, conditions, replicates)parseCool(paths, binSize = NA, conditions, replicates)
paths |
A vector of paths to |
binSize |
The resolution (span of each position in number of bases). Optionally
provided to select the appropriate resolution in |
conditions |
A vector of condition names repeated along the replicates. |
replicates |
A vector of replicate names repeated along the conditions. |
To read .cool of .mcool files, the rhdf5 package is required.
Please install it before running the function.
An InteractionSet.
# EXAMPLE FOR .cool FORMAT # Path to each file pathsCool <- c( "path/to/condition-1.replicate-1.cool", "path/to/condition-1.replicate-2.cool", "path/to/condition-1.replicate-3.cool", "path/to/condition-2.replicate-1.cool", "path/to/condition-2.replicate-2.cool", "path/to/condition-2.replicate-3.cool" ) # Condition and replicate of each file. Can be names instead of numbers. conditions <- c(1, 1, 1, 2, 2, 2) replicates <- c(1, 2, 3, 1, 2, 3) if (FALSE) { library(rhdf5) object <- parseCool( paths, conditions = conditions, replicates = replicates ) } # EXAMPLE FOR .mcool FORMAT # Resolution binSize <- 500000 # Path to each file paths <- c( "path/to/condition-1.replicate-1.mcool", "path/to/condition-1.replicate-2.mcool", "path/to/condition-1.replicate-3.mcool", "path/to/condition-2.replicate-1.mcool", "path/to/condition-2.replicate-2.mcool", "path/to/condition-2.replicate-3.mcool" ) # Condition and replicate of each file. Can be names instead of numbers. conditions <- c(1, 1, 1, 2, 2, 2) replicates <- c(1, 2, 3, 1, 2, 3) if (FALSE) { # Instantiation of data set library(rhdf5) object <- parseCool( paths, conditions = conditions, replicates = replicates, binSize = binSize ) }# EXAMPLE FOR .cool FORMAT # Path to each file pathsCool <- c( "path/to/condition-1.replicate-1.cool", "path/to/condition-1.replicate-2.cool", "path/to/condition-1.replicate-3.cool", "path/to/condition-2.replicate-1.cool", "path/to/condition-2.replicate-2.cool", "path/to/condition-2.replicate-3.cool" ) # Condition and replicate of each file. Can be names instead of numbers. conditions <- c(1, 1, 1, 2, 2, 2) replicates <- c(1, 2, 3, 1, 2, 3) if (FALSE) { library(rhdf5) object <- parseCool( paths, conditions = conditions, replicates = replicates ) } # EXAMPLE FOR .mcool FORMAT # Resolution binSize <- 500000 # Path to each file paths <- c( "path/to/condition-1.replicate-1.mcool", "path/to/condition-1.replicate-2.mcool", "path/to/condition-1.replicate-3.mcool", "path/to/condition-2.replicate-1.mcool", "path/to/condition-2.replicate-2.mcool", "path/to/condition-2.replicate-3.mcool" ) # Condition and replicate of each file. Can be names instead of numbers. conditions <- c(1, 1, 1, 2, 2, 2) replicates <- c(1, 2, 3, 1, 2, 3) if (FALSE) { # Instantiation of data set library(rhdf5) object <- parseCool( paths, conditions = conditions, replicates = replicates, binSize = binSize ) }
Parses interactions in .hic format and returns an InteractionSet
object.
parseHiC(paths, binSize, conditions, replicates)parseHiC(paths, binSize, conditions, replicates)
paths |
A vector of paths to |
binSize |
The resolution (span of each position in number of bases) to select within
the |
conditions |
A vector of condition names repeated along the replicates. |
replicates |
A vector of replicate names repeated along the conditions. |
An InteractionSet.
# Path to each file paths <- c( "path/to/condition-1.replicate-1.hic", "path/to/condition-1.replicate-2.hic", "path/to/condition-1.replicate-3.hic", "path/to/condition-2.replicate-1.hic", "path/to/condition-2.replicate-2.hic", "path/to/condition-2.replicate-3.hic" ) # Replicate and condition of each file. Can be names instead of numbers. conditions <- c(1, 1, 1, 2, 2, 2) replicates <- c(1, 2, 3, 1, 2, 3) # Resolution to select binSize <- 500000 if (FALSE) { # Instantiation of data set hic.experiment <- parseHiC( paths, conditions = conditions, replicates = replicates, binSize = binSize ) }# Path to each file paths <- c( "path/to/condition-1.replicate-1.hic", "path/to/condition-1.replicate-2.hic", "path/to/condition-1.replicate-3.hic", "path/to/condition-2.replicate-1.hic", "path/to/condition-2.replicate-2.hic", "path/to/condition-2.replicate-3.hic" ) # Replicate and condition of each file. Can be names instead of numbers. conditions <- c(1, 1, 1, 2, 2, 2) replicates <- c(1, 2, 3, 1, 2, 3) # Resolution to select binSize <- 500000 if (FALSE) { # Instantiation of data set hic.experiment <- parseHiC( paths, conditions = conditions, replicates = replicates, binSize = binSize ) }
Parses interactions in pairs of .matrix and .bed files and
returns an InteractionSet object.
parseHiCPro(matrixPaths, bedPaths, conditions, replicates)parseHiCPro(matrixPaths, bedPaths, conditions, replicates)
matrixPaths |
A vector of paths to HiC-Pro matrix files. |
bedPaths |
A vector of paths to HiC-Pro bed files. |
conditions |
A vector of condition names repeated along the replicates. |
replicates |
A vector of replicate names repeated along the conditions. |
An InteractionSet.
# Path to each matrix file matrixPaths <- c( "path/to/condition-1.replicate-1.matrix", "path/to/condition-1.replicate-2.matrix", "path/to/condition-1.replicate-3.matrix", "path/to/condition-2.replicate-1.matrix", "path/to/condition-2.replicate-2.matrix", "path/to/condition-2.replicate-3.matrix" ) # Path to each bed file bedPaths <- c( "path/to/condition-1.replicate-1.bed", "path/to/condition-1.replicate-2.bed", "path/to/condition-1.replicate-3.bed", "path/to/condition-2.replicate-1.bed", "path/to/condition-2.replicate-2.bed", "path/to/condition-2.replicate-3.bed" ) # Condition and replicate of each file. Can be names instead of numbers. conditions <- c(1, 1, 1, 2, 2, 2) replicates <- c(1, 2, 3, 1, 2, 3) if (FALSE) { # Instantiation of data set hic.experiment <- parseHiCPro( matrixPaths = matrixPaths, bedPaths = bedPaths, conditions = conditions, replicates = replicates ) }# Path to each matrix file matrixPaths <- c( "path/to/condition-1.replicate-1.matrix", "path/to/condition-1.replicate-2.matrix", "path/to/condition-1.replicate-3.matrix", "path/to/condition-2.replicate-1.matrix", "path/to/condition-2.replicate-2.matrix", "path/to/condition-2.replicate-3.matrix" ) # Path to each bed file bedPaths <- c( "path/to/condition-1.replicate-1.bed", "path/to/condition-1.replicate-2.bed", "path/to/condition-1.replicate-3.bed", "path/to/condition-2.replicate-1.bed", "path/to/condition-2.replicate-2.bed", "path/to/condition-2.replicate-3.bed" ) # Condition and replicate of each file. Can be names instead of numbers. conditions <- c(1, 1, 1, 2, 2, 2) replicates <- c(1, 2, 3, 1, 2, 3) if (FALSE) { # Instantiation of data set hic.experiment <- parseHiCPro( matrixPaths = matrixPaths, bedPaths = bedPaths, conditions = conditions, replicates = replicates ) }
Read the file, produce an InteractionSet object.
parseTabular(path, sep = '\t')parseTabular(path, sep = '\t')
path |
A path to a tabular file. |
sep |
The separator of the tabular file. Default to tabulation. |
Accepts a tabular file with chromosome, position 1,
position 2, and multiple replicate columns listing interaction counts.
Null interactions do not have to be listed. Values must be separated by
tabulations. The header must be
chromosome position 1 position 2 x.y x.y x.y ... with x
replaced by condition names and y replaced by replicate names.
An InteractionSet object.
path <- system.file("extdata", "hicsample_21.tsv", package = "HiCParser") object <- parseTabular(path, sep = "\t")path <- system.file("extdata", "hicsample_21.tsv", package = "HiCParser") object <- parseTabular(path, sep = "\t")