Skip to content

Commit

Permalink
Bio.SeqIO.InsdcIO: Don't quote all features
Browse files Browse the repository at this point in the history
When looking at the feature table specification
(http://www.insdc.org/documents/feature_table.html) not all features
should be quoted. Add a list of features that should not be quoted.
This fixes bug biopython#3368

Signed-off-by: Kai Blin <kai.blin@biotech.uni-tuebingen.de>
  • Loading branch information
Kai Blin committed Jul 3, 2012
1 parent f8abc40 commit 4dec868
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Bio/SeqIO/InsdcIO.py
Expand Up @@ -237,6 +237,10 @@ class _InsdcWriter(SequentialSequenceWriter):
QUALIFIER_INDENT = 21
QUALIFIER_INDENT_STR = " "*QUALIFIER_INDENT
QUALIFIER_INDENT_TMP = " %s " # 21 if %s is empty
FTQUAL_NO_QUOTE = ("anticodon", "citation", "codon_start", "compare",
"direction", "estimated_length", "mod_base", "number",
"rpt_type", "rpt_unit_range", "tag_peptide",
"transl_except", "transl_table")

def _write_feature_qualifier(self, key, value=None, quote=None):
if not value:
Expand All @@ -246,7 +250,7 @@ def _write_feature_qualifier(self, key, value=None, quote=None):
#self.handle.write('%s/%s="%s"\n' % (self.QUALIFIER_INDENT_STR, key, value))
if quote is None:
#Try to mimic unwritten rules about when quotes can be left out:
if _is_int_or_long(value):
if _is_int_or_long(value) or key in self.FTQUAL_NO_QUOTE:
quote = False
else:
quote = True
Expand Down

0 comments on commit 4dec868

Please sign in to comment.