skbio.parse.sequences.parse_qual

skbio.parse.sequences.parse_qual(infile, full_header=False)[source]

yields label and qual from a qual file.

Parameters:

infile : open file object or str

An open fasta file or path to it.

full_header : bool

Return the full header or just the id

Returns:

label : str

The quality label

qual : array

The quality at each position

Examples

Assume we have a qual formatted file with the following contents:

>seq1
10 20 30 40
>seq2
1 2 3 4
>>> from StringIO import StringIO
>>> from skbio.parse.sequences import parse_qual
>>> qual_f = StringIO('>seq1\n'
...                   '10 20 30 40\n'
...                   '>seq2\n'
...                   '1 2 3 4\n')
>>> for label, qual in parse_qual(qual_f):
...     print(label)
...     print(qual)
seq1
[10 20 30 40]
seq2
[1 2 3 4]