util Module

Fluke, Anchor and AnchorList classes providing useful attributes and methods

class anchorna.util.Anchor(data=None, **kw)[source]

Bases: UserList

A single Anchor is a list of Flukes, one for each sequence

Some properties: data (list of flukes), id, gseqid, guide, minscore (aka score), maxscore, medscore.

_abc_impl = <_abc._abc_data object>
_calculate_fluke_scores(scoring)[source]
_convert_nt()[source]
contradicts(a2, aggressive=True)[source]
property good_flukes
property guide
property id
join_with(a2, scoring=None)[source]
property maxscore
property medscore
property minscore
nicely_overlaps_with(a2)[source]
property poor_flukes
property seqids
property sid
sort(key=None, **kw)[source]
property strand
todict_seqid()[source]
tostr(i='', verbose=False, mode='aa')[source]
class anchorna.util.AnchorList(data=None, no_cds=False)[source]

Bases: UserList

Collection of Anchors with useful methods

_abc_impl = <_abc._abc_data object>
_convert_nt()[source]
_repr_pretty_(p, cycle)[source]
convert2fts(**kw)[source]

Convert anchors to FeatureList object, see anchors2fts()

copy()[source]
merge_overlapping_anchors(scoring=None)[source]

Remove overlapping anchors, step B of anchorna go

property no_cds
remove_contradicting_anchors(aggressive=True)[source]

Remove contradicting anchors, step C of anchorna go

sort(key=<function AnchorList.<lambda>>, **kw)[source]
tostr(verbose=False, mode='aa')[source]
write(fname, **kw)[source]

Write anchors to GFF file, see write_anchors()

class anchorna.util.Fluke(*args: Any, **kwargs: Any)[source]

Bases: Attr

A fluke is a word position on a single sequence and part of an Anchor

Properties: id, seqid, score, median_score, start, stop, offset, word, poor.

_apply_mode(mode)[source]

Transform index, allowed modes are 'aa', 'cds', 'nt'

property len
property strand
anchorna.util.anchors2fts(anchors, mode=None)[source]

Convert anchors to FeatureList object

Write some important attributes to Feature.meta._gff metadata.

Parameters:

mode – Optionally convert anchors to 'nt' or 'cds' indices

anchorna.util.corrscore(seq1, seq2, gap='-', sm=None)[source]

Similarity score between two words

anchorna.util.fts2anchors(fts, no_cds=False)[source]

Convert FeatureList object to anchors

Read some important attributes from Feature.meta._gff metadata.