bedder

1from .bedder import *
2
3__doc__ = bedder.__doc__
4if hasattr(bedder, "__all__"):
5    __all__ = bedder.__all__
class PyBedRecord:

A Python wrapper for a BED record.

Attributes: chrom (str): The chromosome name start (int): The start position (0-based) stop (int): The end position (exclusive) name (str, optional): The name field if present score (float, optional): The score field if present

Example

bed_record = position.bed()
if bed_record is not None:
    print(bed_record.chrom, bed_record.start, bed_record.stop)
    bed_record.set_name("example")
def other_fields(self, /):

Get any additional fields beyond the standard BED fields.

Example

extra = bed_record.other_fields()
for value in extra:
    print(value)
chrom

Get the chromosome name.

Example

chrom = bed_record.chrom
score

Get the score field if present.

Example

score = bed_record.score
start

Get the start position (0-based).

Example

start = bed_record.start
stop

Get the end position (exclusive).

Example

stop = bed_record.stop
name

Get the name field if present.

Example

label = bed_record.name
class PyVcfRecord:

A Python wrapper for a VCF record.

Attributes: chrom (str): The chromosome name pos (int): The position (0-based)

Example

vcf_record = position.vcf()
if vcf_record is not None:
    print(vcf_record.chrom, vcf_record.pos)
    dp = vcf_record.info("DP")
    if dp is not None:
        print("depth:", dp)
def info(self, /, key):

Get an INFO field by key, returning the best Python representation.

Example

mq = vcf_record.info("MQ")
def format(self, /, key):

Get a FORMAT field by key, returning per-sample values.

Example

gq = vcf_record.format("GQ")
def set_info(self, /, key, value):

Set an INFO field, converting Python values into typed VCF entries.

Example

vcf_record.set_info("DP", 35)
id

Get the record identifier.

Example

identifier = vcf_record.id
filter

Set a single FILTER value.

Example

vcf_record.set_filter("LowQual")
filters

Get currently set FILTER values.

Example

filters = vcf_record.filters
chrom

Get the chromosome name.

Example

chrom = vcf_record.chrom
ALT

Get all alternate alleles.

Example

alts = vcf_record.ALT
pos

Get the position (0-based).

Example

pos = vcf_record.pos
qual

Get the QUAL value if present.

Example

qual = vcf_record.qual
REF

Get the reference allele.

Example

ref_allele = vcf_record.REF
class PyReportFragment:

A fragment of a report containing intersection results.

Attributes: a (Position, optional): The query interval b (list[Position]): List of intervals that intersect with the query id (int): Unique identifier for this fragment

Example

for fragment in report:
    anchor = fragment.a
    for overlap in fragment:
        print(overlap.chrom, overlap.start, overlap.stop)
b

Get the list of intersecting intervals.

Example

overlaps = fragment.b
for position in overlaps:
    print(position.chrom)
id

Get the unique identifier for this fragment.

Example

fragment_id = fragment.id
a

Get the query interval if present.

Example

anchor = fragment.a
if anchor is not None:
    print(anchor.chrom)
class PyReport:

A collection of intersection results.

Methods: add_fragment(fragment): Add a report fragment to the collection count_overlaps_by_id(): Get count of overlaps for each query ID count_bases_by_id(): Get count of overlapping bases for each query ID

def add_fragment(self, /, frag):

Add a report fragment to the collection.

Example

report.add_fragment(fragment)
def count_overlaps_by_id(self, /):

Get count of overlaps for each query ID.

Example

overlap_counts = report.count_overlaps_by_id()
def count_bases_by_id(self, /):

Get count of overlapping bases for each query ID.

Example

base_counts = report.count_bases_by_id()
class PyPosition:

A genomic interval that can represent BED or other formats.

Attributes: chrom (str): The chromosome name start (int): The start position (0-based) stop (int): The end position (exclusive)

Example

fragment = report[0]
position = fragment.b[0] # or fragment.a
print(position.chrom, position.start, position.stop)
vcf_record = position.vcf()
print(vcf_record.REF)
def bed(self, /):

Get the BED record if this position represents a BED interval

Example

bed = position.bed()
def vcf(self, /):

get the vcf record if this position represents a vcf record

Example

vcf = position.vcf()
stop

Get the end position (exclusive)

Example

stop = position.stop
start

Get the start position (0-based)

Example

start = position.start
chrom

Get the chromosome name

Example

chrom = position.chrom
class PyIntersections:

A Python wrapper for Intersections

def a(self, /):

Get the base interval

Example

anchor = intersections.a
def report(self, /):

Report intersections based on specified modes and requirements

Example

report = intersections.report()
overlapping

Get the list of overlapping intervals

Example

for hit in intersections.overlapping:
    print(hit.chrom)
base_interval

Get the base interval

Example

anchor = intersections.base_interval
class PyIntersectionMode:

Python wrapper for IntersectionMode

def default():
class PyIntersectionPart:

Python wrapper for IntersectionPart

def none():
def part():
def whole():
def whole_wide():
def whole_long():
def inverse():
class PyOverlapAmount:

Python wrapper for OverlapAmount

def bases(bases):
def fraction(fraction):
class PyReportFragmentIter:
class PyReportIter: