<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">All,<div class=""><br class=""></div><div class="">Code done, tests pass. I didn’t hear back about the dict of dict approach but it currently works as in this example:</div><div class=""><br class=""></div><div class=""><div class=""> record = SeqIO.read(path.join('GenBank', 'KF527485.gbk'),'genbank')</div><div class=""> self.assertEqual(record.annotations['structured_comment']['Assembly-Data']['Assembly Method'], 'Lasergene v. 10')</div></div><div class=""><br class=""></div><div class="">However, I have a question. Will code using format() like this work, as versions of Python less than 2.6 might be used?</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>re.search(r"([^#]+){}$".format(STRUCTURED_COMMENT_START), data)</div><div class=""><br class=""></div><div class="">Thanks again,</div><div class=""><br class=""></div><div class="">Brian O.</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Sep 10, 2015, at 3:52 PM, Brian Osborne <<a href="mailto:bosborne11@verizon.net" class="">bosborne11@verizon.net</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Chris,<div class=""><br class=""></div><div class="">BioPerl does what you might call a compromise (in bioperl-live, not in any CPAN release). If a structured comment appears in COMMENT it’s still part of the comment (a string) but no returns are removed, it stays tabular. Thus it’s easy to detect and parse.</div><div class=""><br class=""></div><div class="">Yes, if there is a ‘structured_comment’ dict it could have a primary key and secondary keys. This was my first thought. So something like:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 14px; font-family: Courier; background-color: rgb(179, 187, 255);" class="">defaultdict(<class 'dict'>, {'Assembly-Data': {'a': 1, 'b': 2, 'c': 3}})</div></div><div class=""><br class=""></div><div class="">Brian O.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div class=""><blockquote type="cite" class=""><div class="">On Sep 10, 2015, at 10:06 AM, Fields, Christopher J <<a href="mailto:cjfields@illinois.edu" class="">cjfields@illinois.edu</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">This is very similar to the issue bioperl had with nested annotations; namely that some annotation data from SwissProt (GENE NAME I believe) had a hierarchal structure. Seems a bit thornier in this case as the annotation would have a both a standard comment field and a named collection of meta-data tied together. <br class=""><br class="">Brian, how is this implemented in BioPerl? <br class=""><br class="">chris<br class=""><br class=""><blockquote type="cite" class="">On Sep 10, 2015, at 10:47 AM, Peter Cock <<a href="mailto:p.j.a.cock@googlemail.com" class="">p.j.a.cock@googlemail.com</a>> wrote:<br class=""><br class="">Good question...<br class=""><br class="">e.g. <a href="http://www.ncbi.nlm.nih.gov/nuccore/291609868" class="">http://www.ncbi.nlm.nih.gov/nuccore/291609868</a><br class="">and <a href="http://www.ncbi.nlm.nih.gov/nuccore/FJ966082" class="">http://www.ncbi.nlm.nih.gov/nuccore/FJ966082</a><br class=""><br class="">It almost makes me wonder if that should have top level<br class="">keys of MIENS-Data and FluData - or is that too nested?<br class=""><br class="">Peter<br class=""><br class="">On Thu, Sep 10, 2015 at 4:37 PM, Brian Osborne <<a href="mailto:bosborne11@verizon.net" class="">bosborne11@verizon.net</a>> wrote:<br class=""><blockquote type="cite" class="">Peter,<br class=""><br class="">Another question, maybe the last one: what do we do what the “header” and “footer” strings, things like “FluData”, "GISAID_EpiFlu(TM)Data”, and “Assembly-Data”?<br class=""><br class="">They could also be keys in the dict, of course. Values are ‘’?<br class=""><br class="">Thanks again,<br class=""><br class="">Brian O.<br class=""><br class=""><br class=""><blockquote type="cite" class="">On Sep 10, 2015, at 1:25 AM, Peter Cock <<a href="mailto:p.j.a.cock@googlemail.com" class="">p.j.a.cock@googlemail.com</a>> wrote:<br class=""><br class="">On Wed, Sep 9, 2015 at 11:37 PM, Brian Osborne <<a href="mailto:bosborne11@verizon.net" class="">bosborne11@verizon.net</a>> wrote:<br class=""><blockquote type="cite" class="">Chris,<br class=""><br class="">This is the documentation I’m familiar with, but there may be more:<br class=""><br class=""><a href="http://www.ncbi.nlm.nih.gov/genbank/structuredcomment" class="">http://www.ncbi.nlm.nih.gov/genbank/structuredcomment</a><br class=""><br class="">Peter, I can definitely separate these using ‘comment’ and<br class="">‘structured_comment’ keys in the record.annotations dict.<br class=""><br class="">If there’s no structured comment in the Genbank file, would<br class="">there simply be an empty dict in the SeqRecord?<br class=""><br class="">E.g.<br class=""><br class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class="">record.annotations[‘structured_comment']<br class=""></blockquote></blockquote></blockquote>{}<br class=""></blockquote><br class="">That makes sense - equally no entry in the annotation dictionary<br class="">would be reasonable.<br class=""><br class="">Peter<br class=""></blockquote><br class=""></blockquote></blockquote><br class=""></div></blockquote></div><br class=""></div></div>_______________________________________________<br class="">Biopython-dev mailing list<br class=""><a href="mailto:Biopython-dev@mailman.open-bio.org" class="">Biopython-dev@mailman.open-bio.org</a><br class="">http://mailman.open-bio.org/mailman/listinfo/biopython-dev<br class=""></div></blockquote></div><br class=""></div></body></html>