biopython v1.71.0 Bio.SeqIO.QualityIO.QualPhredWriter
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") 3
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")
Link to this section Summary
Link to this section Functions
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 record.id and record.description is used. If the record.description starts with the record.id, then just the record.description is used.
The record2title argument is present for consistency with the Bio.SeqIO.FastaIO writer class.
Write a single QUAL record to the file.