bedtools_intersect | R Documentation |
Finds and/or counts the intersections between two ranged datasets.
bedtools_intersect(cmd = "--help")
R_bedtools_intersect(a, b, ubam = FALSE, bed = FALSE, wa = FALSE, wb = FALSE,
loj = FALSE, wo = FALSE, wao = FALSE, u = FALSE,
c = FALSE, v = FALSE, f = 1e-09, F = 1e-09,
r = FALSE, e = FALSE, s = FALSE, S = FALSE,
split = FALSE, g = NA_character_, header = FALSE,
names = NULL, filenames = FALSE, sortout = FALSE)
do_bedtools_intersect(a, b, ubam = FALSE, bed = FALSE, wa = FALSE, wb = FALSE,
loj = FALSE, wo = FALSE, wao = FALSE, u = FALSE,
c = FALSE, v = FALSE, f = 1e-09, F = 1e-09,
r = FALSE, e = FALSE, s = FALSE, S = FALSE,
split = FALSE, g = NA_character_, header = FALSE,
names = NULL, filenames = FALSE, sortout = FALSE)
cmd |
String of bedtools command line arguments, as they would be entered at the shell. There are a few incompatibilities between the docopt parser and the bedtools style. See argument parsing. |
a |
Path to a BAM/BED/GFF/VCF/etc file, a BED stream, a file object, or
a ranged data structure, such as a GRanges. Each feature in |
b |
Like |
ubam |
Not supported yet. Write uncompressed BAM output. The default is write compressed BAM output. |
bed |
When using BAM input, return a GRanges (with a “blocks” column) instead of a GAlignments. For VCF input, return a VRanges instead of a VCF object. |
wa |
Return the original entry in |
wb |
Return the original entry in |
loj |
Perform a ‘left outer join’. That is, for each feature in
|
wo |
Return the number of base pairs of
overlap between the two features as the “overlap_width”
metadata column. Implies |
wao |
Like |
u |
Like |
c |
Like |
v |
Like |
f |
Minimum overlap required as a fraction of |
F |
Minimum overlap required as a fraction of |
r |
Require that the fraction of overlap be reciprocal for |
e |
Require that the minimum fraction be satisfied for |
s |
Require same strandedness. That is, find the intersect feature in
|
S |
Require opposite strandedness. That is, find the intersect feature in
|
split |
Treat split BAM (i.e., having an ‘N’ CIGAR operation) or BED12 entries as compound ranges with gaps, i.e., as GRangesList objects. |
g |
A genome file, identifier or Seqinfo object that defines the order and size of the sequences. |
header |
Ignored. |
names |
When using multiple databases, provide an alias for each to use instead of their integer index. If a single string, can be comma-separated. |
filenames |
When using multiple databases, use their complete filename instead of their integer index. |
sortout |
Sort the result by genomic coordinate. |
As with all commands, there are three interfaces to the
intersect
command:
bedtools_intersect
Parses the bedtools command line and compiles it to the equivalent R code.
R_bedtools_intersect
Accepts R arguments corresponding to the command line arguments and compiles the equivalent R code.
do_bedtools_intersect
Evaluates the result of
R_bedtools_intersect
. Recommended only for
demonstration and testing. It is best to integrate the compiled
code into an R script, after studying it.
This is by far the most complex bedtools
command, and it
offers a dizzying list of parameters, many of which are redundant or
mutually exclusive. The complexity of the generated code is highest
when using the fractional restriction feature, since no such support
exists in the GenomicRanges overlap routines.
A language object containing the compiled R code, evaluating to a
ranges object, the exact type of which depends on the arguments. If
both wa
and wb
are TRUE
, return a Pairs object
with the original, matched up ranges, possibly with metadata
columns. By default, the return value is a GAlignments for BAM input,
a VCF object for VCF input, or a GRanges for any other type of input.
If bed
is TRUE
, BAM input is converted to a GRanges,
containing a “blocks” column (encoding the junctions) if the
input is BAM. If the input is VCF, bed=TRUE
converts the input
to a VRanges.
Michael Lawrence
http://bedtools.readthedocs.io/en/latest/content/tools/intersect.html
setops-methods for set operations including intersect, findOverlaps-methods for different ways to detect overlaps.
## Not run:
setwd(system.file("unitTests", "data", "intersect", package="HelloRanges"))
## End(Not run)
## return intersecting ranges
bedtools_intersect("-a a.bed -b a.bed")
## add count
bedtools_intersect("-a a.bed -b b.bed -c")
## restrict by strand and fraction of overlap
bedtools_intersect("-a a.bed -b b.bed -c -s -f 0.1")
## return original 'a' ranges
bedtools_intersect("-a a.bed -b b.bed -wa")
## return both 'a' and 'b' ranges, along with overlap widths
bedtools_intersect("-a a.bed -b b.bed -wo")
## same as above, except left outer join
bedtools_intersect("-a a.bed -b b.bed -wao")
## consider read junction structure
bedtools_intersect("-a three_blocks.bam -b three_blocks_nomatch.bed -split")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.