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

Wraps bedtools complement. Example usage:

>>> a = pybedtools.example_bedtool('a.bed')
>>> a.complement(genome='hg19').head(5) 
chr1    0       1
chr1    500     900
chr1    950     249250621
chr10   0       135534747
chr11   0       135006516

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

There are two alternatives for supplying a genome. Use g="genome.filename" if you have a genome’s chrom sizes saved as a file. This is the what BEDTools expects when using it from the command line. Alternatively, use the genome="" (for example, genome="hg19") to use chrom sizes for that assembly without having to manage a separate file. The genome argument triggers a call pybedtools.chromsizes, so see that method for more details.

Original BEDTools help::

Tool:    bedtools complement (aka complementBed)
Version: v2.30.0
Summary: Returns the base pair complement of a feature file.

Usage:   bedtools complement [OPTIONS] -i <bed/gff/vcf> -g <genome>

        -L      Limit output to solely the chromosomes with records in the input file.

        (1)  The genome file should tab delimited and structured as follows:

        For example, Human (hg19):
        chr1    249250621
        chr2    243199373
        chr18**gl000207**random 4262

        One can use the UCSC Genome Browser's MySQL database to extract
        chromosome sizes. For example, H. sapiens:

        mysql --user=genome -A -e \
        "select chrom, size from hg19.chromInfo"  > hg19.genome