Learn R Programming

Chicago (version 1.0.3)

overlapFragWithFeatures: Overlap Other-Ends with Features

Description

This function checks which other-ends from a chicagoData object overlap with a set of genomic features.

Usage

overlapFragWithFeatures(x = NULL, folder = NULL, list_frag, position_otherEnd = NULL, sep = "\t")

Arguments

x
a chicagoData object or a data table (data.table) containining other end IDs.
folder
the name of the folder where the files containing the features of interest are stored.
list_frag
a list where each element is the name of a file containing a feature of interest (e. g. H3K4me1, CTCF, DHS etc.). These files must have a bed format, with no header. Each element of the list must be named.
position_otherEnd
the name of the file containing the coordinates of the restriction fragments and the corresponding IDs. The coordinates should be "chromosome", "start" and "end", and the ID should be numeric. position_otherEnd only needs to be specified if x is not a chicagoData object.
sep
the field separator character. Values are separated by this character on each line of the file containing the coordinates of the restriction fragments (called by position_otherEnd).

Value

a data table (data.table) built from x, where a column was added for each genomic feature present in list_frag. The new columns contain logical values indicating whether there was an overlap or not.

Examples

Run this code
data(cdUnitTest)

##modifications to cdUnitTest, ensuring it uses correct design directory
designDir <- file.path(system.file("extdata", package="Chicago"), "unitTestDesign")
cdUnitTest <- modifySettings(cd=cdUnitTest, designDir=designDir)

##get the unit test ChIP tracks
dataPath <- system.file("extdata", package="Chicago")
ChIPdir <- file.path(dataPath, "unitTestChIP")
dir(ChIPdir)

##get a list of the unit test ChIP tracks
featuresFile <- file.path(ChIPdir, "featuresmESC.txt")
featuresTable <- read.delim(featuresFile, header=FALSE, as.is=TRUE)
featuresList <- as.list(featuresTable$V2)
names(featuresList) <- featuresTable$V1

##test for overlap
overlapFragWithFeatures(cdUnitTest, folder=ChIPdir, list_frag = featuresList)

Run the code above in your browser using DataLab