[Biopython] when is a SeqRecord not a SeqRecord
Dilara Ally
dilara.ally at gmail.com
Tue Jul 17 19:11:12 UTC 2012
Hi
I'm trying to understand what is why when I print filtered_rec I get a
SeqRecord but if I try to access any particular attribute of a SeqRecord
such as letter_annotations I sometimes get an attribute error --
AttributeError: 'NoneType' object has no attribute 'letter_annotations.'
q_threshold=20
def check_meanQ(record, q_threshold):
seqlen=len(record)
quality_scores=array(record.letter_annotations["phred_quality"])
if round(quality_scores.mean()) <= q_threshold:
print "Discarded ", record.id, "because mean Q was",
round(quality_scores.mean())
elif round(quality_scores.mean()) > q_threshold:
return record
from Bio import SeqIO
for rec in SeqIO.parse("test.fastq", "fastq"):
print rec.id
filtered_rec= check_meanQ(rec, q_threshold)
#print filtered_rec
print filtered_rec.letter_annotations
I've attached two fastq files that I've used with this code one is called
test.fastq and the other is hiseq_pe_test.fastq
Any help would be greatly appreciated.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.fastq
Type: application/octet-stream
Size: 39217 bytes
Desc: not available
URL: <http://lists.open-bio.org/pipermail/biopython/attachments/20120717/365cf2a5/attachment-0004.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hiseq_pe_test.fastq
Type: application/octet-stream
Size: 1541 bytes
Desc: not available
URL: <http://lists.open-bio.org/pipermail/biopython/attachments/20120717/365cf2a5/attachment-0005.obj>
More information about the Biopython
mailing list