in.region {bedr}R Documentation

checks if regions in object a are found in object b

Description

checks if regions in object a are found in object b

Usage

in.region(
	x,
	y,
	proportion.overlap = 1e-09,
	reciprocal.overlap = FALSE,
	check.zero.based = TRUE,
	check.chr = TRUE,
	check.valid = TRUE,
	check.sort = TRUE,
	check.merge = TRUE,
	verbose = FALSE
	)

Arguments

x

first region index in the form chr:start-stop. regions in this index will be checked for intersection in the values of the second index.

y

second region index.

proportion.overlap

Defaults 1e-9 which is 1 bp. See details below for the different interpretation between 0 and 1 based overlap

reciprocal.overlap

Should the proportion.overlap be reciprocal

check.zero.based

should 0 based coordinates be checked

check.chr

should chr prefix be checked

check.valid

check if region is valid

check.sort

check if region is sorted

check.merge

check if overlapping regions are merged

verbose

prints some debugging information. currently it just checks if the input regions are overlapping

Details

The function can also be called using syntax similar to the %in% operator, for example "region1 %in.region% region2"

The default is to report TRUE if there is 1bp overlap in zero based bed format. That means that region chr1:10-20 and chr1:20-30 would not overlap. To switch to one based intuitive interpretation set proportion.overlap = 0.

Value

Returns a logical vector the length of x.

Author(s)

Daryl Waggott

References

http://bedtools.readthedocs.org/en/latest/content/tools/intersect.html

Examples

if (check.binary("bedtools")) {

index <- get.example.regions();

a <- index[[1]];
b <- index[[2]];
a <- bedr(engine = "bedtools", input = list(i = a), method = "sort", params = "");
b <- bedr(engine = "bedtools", input = list(i = b), method = "sort", params = "");

d <- in.region(a,b);

# alternative calling
d <- a %in.region% b

}

[Package bedr version 1.0.7 Index]