pybedtools.bedtool.BedTool.annotate

BedTool.annotate(*args, **kwargs)[source]

Wraps bedtools annotate.

Annotate this BedTool with a list of other files. Example usage:

>>> a = pybedtools.example_bedtool('a.bed')
>>> b_fn = pybedtools.example_filename('b.bed')
>>> print(a.annotate(files=b_fn)) 
chr1    1       100     feature1        0       +       0.000000
chr1    100     200     feature2        0       +       0.450000
chr1    150     500     feature3        0       -       0.128571
chr1    900     950     feature4        0       +       0.020000

For convenience, the file or stream this BedTool points to is implicitly passed as the -i argument to annotateBed

Original BEDTools help::

Tool:    bedtools annotate (aka annotateBed)
Version: v2.31.1
Summary: Annotates the depth & breadth of coverage of features from mult. files
         on the intervals in -i.

Usage:   bedtools annotate [OPTIONS] -i <bed/gff/vcf> -files FILE1 FILE2..FILEn

Options: 
        -names  A list of names (one / file) to describe each file in -i.
                These names will be printed as a header line.

        -counts Report the count of features in each file that overlap -i.
                - Default is to report the fraction of -i covered by each file.

        -both   Report the counts followed by the % coverage.
                - Default is to report the fraction of -i covered by each file.

        -s      Require same strandedness.  That is, only counts overlaps
                on the **same** strand.
                - By default, overlaps are counted without respect to strand.

        -S      Require different strandedness.  That is, only count overlaps
                on the **opposite** strand.
                - By default, overlaps are counted without respect to strand.