7.3. IO functions


Sniffer for all formats included in Bioconvert



Sniffer for all formats included in Bioconvert

class Sniffer[source]

Sniffer for formats included in Bioconvert


>>> from bioconvert import Sniffer
>>> s =  Sniffer()
>>> s.sniff("test.clustal")

TSV and CSV matchess many formats. For example a BED file is compatible with the TSV format.

If a file matches several 2 formats and includes a TSV/CSV, we ignore the TSV/CSV.

sniff(self, filename)[source]

Return first frmt found to be compatible with the input file

read_from_buffer(f_file, length, offset)[source]

Return 'length' bits of file 'f_file' starting at offset 'offset'

class MAF(filename, outfile=None)[source]

A reader for MAF format.

count_insertions(self, alnString)[source]

return length without insertion, forward and reverse shift

class MAFLine(line)[source]

A reader for MAF format.

mode refname start algsize strand refsize alignment

s ref    100 10 + 100000 ---AGC-CAT-CATT
s contig 0   10 + 10     ---AGC-CAT-CATT

s ref    100 12 + 100000 ---AGC-CAT-CATTTT
s contig 0   12 + 12     ---AGC-CAT-CATTTT

The alignments are stored by pair, one item for the reference, one for the query. The query (second line) starts at zero.