[Biopython-dev] [Bug 2639] New: SeqRecord.init doesn't check for arguments to their types

bugzilla-daemon at portal.open-bio.org bugzilla-daemon at portal.open-bio.org
Mon Nov 3 17:16:41 UTC 2008


http://bugzilla.open-bio.org/show_bug.cgi?id=2639

           Summary: SeqRecord.init doesn't check for arguments to their
                    types
           Product: Biopython
           Version: 1.47
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P3
         Component: Main Distribution
        AssignedTo: biopython-dev at biopython.org
        ReportedBy: dalloliogm at gmail.com


SeqRecord doesn't check if description is a string when creating SeqRecord
objects.
This causes an error when later you will have to print the record in formats
like fasta.

>>> from Bio.Seq import Seq
>>> from Bio.SeqRecord import SeqRecord
>>> sr = SeqRecord(Seq('aaa'), description = [1, 2, 3]) # should give an error here!
>>> print sr.fasta
<type 'exceptions.AttributeError'>: 'list' object has no attribute 'replace'

Looking at SeqRecord.__init__ code, none of the arguments is checked for its
type. 
This is a minor bug, but if you want to solve it, you just have to add some
isinstance() check in the init function.


-- 
Configure bugmail: http://bugzilla.open-bio.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the Biopython-dev mailing list