bx.align.epo module

Classes and utilities for mutliple alignments from the EPO pipeline

class bx.align.epo.Chain(score, tName, tSize, tStrand, tStart, tEnd, qName, qSize, qStrand, qStart, qEnd, id)

Bases: Chain

A Chain header as in http://genome.ucsc.edu/goldenPath/help/chain.html

chain coordinates are with respect to the strand, so for example tStart on the + strand is the distance from the leftmost position; tStart on the - strand is the distance from the rightmost position.

bedInterval(who)

return a BED6 entry, thus DOES coordinate conversion for minus strands

slice(who)

return the slice entry (in a bed6 format), AS IS in the chain header

class bx.align.epo.EPOitem(species, gabid, chrom, start, end, strand, cigar)

Bases: Epo_item

this format is how alignments are delivered from e!

cigar_iter(reverse)

self.cigar => [(length, type) … ] iterate the cigar

Parameters:

reverse (boolean) – whether to iterate in the reverse direction (right-to-left)

:return a list of pairs of the type [(length, M/D) ..]

cigar_pattern = re.compile('(\\d*)([MD])')
intervals(reverse, thr=0)

return a list of (0-based half-open) intervals representing the match regions of the cigar

for example 4MD4M2DM with reverse=False will produce [(0,4), (5,9), (11,12)] 4MD4M2DM with reverse=True will produce [(0,1), (3,7), (8,12)] (= 12 - previous interval)

Parameters:
  • reverse (boolean) – whether to iterate in the reverse direction (right-to-left) (this is passed as is to self.cigar_iter)

  • thr (integer) – shift all intervals by this much

Returns:

list of pairs