Package Bio :: Package SeqIO :: Module QualityIO :: Class QualPhredWriter
[hide private]
[frames] | no frames]

Class QualPhredWriter

source code

                     object --+        
      Interfaces.SequenceWriter --+    
Interfaces.SequentialSequenceWriter --+

Class to write QUAL format files (using PHRED quality scores).

Although you can use this class directly, you are strongly encouraged to use the Bio.SeqIO.write() function instead. For example, this code reads in a FASTQ file and saves the quality scores into a QUAL file:

>>> from Bio import SeqIO
>>> record_iterator = SeqIO.parse("Quality/example.fastq", "fastq")
>>> with open("Quality/temp.qual", "w") as out_handle:
...     SeqIO.write(record_iterator, out_handle, "qual")

This code is also called if you use the .format("qual") method of a SeqRecord.

P.S. Don't forget to clean up the temp file if you don't need it anymore:

>>> import os
>>> os.remove("Quality/temp.qual")
Instance Methods [hide private]
__init__(self, handle, wrap=60, record2title=None)
Create a QUAL writer.
source code
write_record(self, record)
Write a single QUAL record to the file.
source code

Inherited from Interfaces.SequentialSequenceWriter: write_file, write_footer, write_header, write_records

Inherited from Interfaces.SequenceWriter: clean

Inherited from Interfaces.SequenceWriter (private): _get_seq_string

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, handle, wrap=60, record2title=None)

source code 

Create a QUAL writer.

  • handle - Handle to an output file, e.g. as returned

    by open(filename, "w")

  • wrap - Optional line length used to wrap sequence lines.

    Defaults to wrapping the sequence at 60 characters Use zero (or None) for no wrapping, giving a single long line for the sequence.

  • record2title - Optional function to return the text to be

    used for the title line of each record. By default a combination of the and record.description is used. If the record.description starts with the, then just the record.description is used.

The record2title argument is present for consistency with the Bio.SeqIO.FastaIO writer class.

Overrides: object.__init__

write_record(self, record)

source code 
Write a single QUAL record to the file.
Overrides: Interfaces.SequentialSequenceWriter.write_record