bx.align.score module

Support for scoring alignments using arbitrary scoring matrices, arbitrary alphabets, and affine gap penalties.

class bx.align.score.ScoringScheme(gap_open, gap_extend, default=-100, alphabet1='ACGT', alphabet2=None, gap1='-', gap2=None, text1_range=128, text2_range=None, typecode=<class 'numpy.int32'>)

Bases: object

score_alignment(a)
score_texts(text1, text2)
set_score(a, b, val, foldcase1=False, foldcase2=False)
bx.align.score.accumulate_scores(scoring_scheme, text1, text2, skip_ref_gaps=False)

Return cumulative scores for each position in alignment as a 1d array.

If skip_ref_gaps is False positions in returned array correspond to each column in alignment, if True they correspond to each non-gap position (each base) in text1.

bx.align.score.build_scoring_scheme(s, gap_open, gap_extend, gap1='-', gap2=None, **kwargs)

Initialize scoring scheme from a blastz style text blob, first line specifies the bases for each row/col, subsequent lines contain the corresponding scores. Slaw extensions allow for unusual and/or asymmetric alphabets. Symbols can be two digit hex, and each row begins with symbol. Note that a row corresponds to a symbol in text1 and a column to a symbol in text2.

examples:

blastz slaw

A C G T 01 02 A C G T

91 -114 -31 -123 01 200 -200 -50 100 -50 100

-114 100 -125 -31 02 -200 200 100 -50 100 -50

-31 -125 100 -114

-123 -31 -114 91

bx.align.score.int_or_float(s)
bx.align.score.read_scoring_scheme(f, gap_open, gap_extend, gap1='-', gap2=None, **kwargs)

Initialize scoring scheme from a file containint a blastz style text blob. f can be either a file or the name of a file.

bx.align.score.score_alignment(scoring_scheme, a)
bx.align.score.score_texts(scoring_scheme, text1, text2)
bx.align.score.sym_to_char(sym)