Class QualPhredWriter
source code
object --+
|
Interfaces.SequenceWriter --+
|
Interfaces.SequentialSequenceWriter --+
|
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(open("Quality/example.fastq"), "fastq")
>>> out_handle = open("Quality/temp.qual", "w")
>>> SeqIO.write(record_iterator, out_handle, "qual")
3
>>> out_handle.close()
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")
|
|
|
|
Inherited from Interfaces.SequentialSequenceWriter :
write_file ,
write_footer ,
write_header ,
write_records
Inherited from Interfaces.SequenceWriter :
clean
Inherited from object :
__delattr__ ,
__format__ ,
__getattribute__ ,
__hash__ ,
__new__ ,
__reduce__ ,
__reduce_ex__ ,
__repr__ ,
__setattr__ ,
__sizeof__ ,
__str__ ,
__subclasshook__
|
Inherited from object :
__class__
|
__init__(self,
handle,
wrap=60,
record2title=None)
(Constructor)
| source code
|
Create a QUAL writer.
Arguments:
-
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.
- Overrides:
object.__init__
|