[Biopython-dev] [Bug 2919] New: Writing SeqFeature qualifiers

bugzilla-daemon at portal.open-bio.org bugzilla-daemon at portal.open-bio.org
Mon Sep 28 17:01:08 EDT 2009


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

           Summary: Writing SeqFeature qualifiers
           Product: Biopython
           Version: 1.51
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Main Distribution
        AssignedTo: biopython-dev at biopython.org
        ReportedBy: estrain at gmail.com


When writing SeqFeature qualifiers key-value pairs, the output contains one
line for each character in the value, rather than simply printing the string.
The sample code at the bottom produces a genbank sequence file that illustrates
the problem.

If I create a qualifiers dictionary using "qualDict = dict(gene="geneA")",
the genbank output contains
     gene            1..6
                     /gene="g"
                     /gene="e"
                     /gene="n"
                     /gene="e"
                     /gene="A"


The offending code appears to be in the InsdcIO.py file, lines 482-483.
If I change

482: for value in values :
483:   self.write_feature_qualifier(key,value)

to

self.write_feature_qualifier(key,values)

then the function appears to work correctly.  

     gene            1..6
                     /gene="geneA"



###########################################################
## Sample code
###########################################################
from Bio.Seq import Seq
from Bio import SeqIO
from Bio.SeqRecord import SeqRecord
from Bio.SeqFeature import SeqFeature, FeatureLocation
from Bio.Alphabet import IUPAC

qualDict = dict(gene="geneA")

my_seq = SeqRecord(Seq("ATGATC",IUPAC.ambiguous_dna),id="seq1")
my_seq.features.append((SeqFeature(FeatureLocation(0,6),type="gene",qualifiers=qualDict)))

out_handle = open("test.gbk","w")

SeqIO.write([my_seq],out_handle,"genbank")


-- 
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