<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p>OK, I've had a play. The return type needs to be gbwithparts</p>
<p><br>
</p>
<p>Perhaps the tutorial could be updated to reflect this?</p>
<p><br>
</p>
<p></p>
<div><span style="font-family: Consolas, Courier, monospace;">from Bio import Entrez</span></div>
<div><span style="font-family: Consolas, Courier, monospace;">from Bio import SeqIO</span></div>
<div><br>
</div>
<div><span style="font-family: Consolas, Courier, monospace;">Entrez.email = "A.N.Other@example.com"</span></div>
<div><br>
</div>
<div><span style="font-family: Consolas, Courier, monospace;">with Entrez.efetch(db="nucleotide", rettype="</span><span style="background-color: rgb(255, 255, 0); font-family: Consolas, Courier, monospace;">gbwithparts</span><span style="font-family: Consolas, Courier, monospace;">",
retmode="text", id="nc_003197") as handle:</span></div>
<div><br>
</div>
<div><span style="font-family: Consolas, Courier, monospace;"> seq_record = SeqIO.read(handle, "gb") #using "gb" as an alias for "genbank"</span></div>
<div><br>
</div>
<div><span style="font-family: Consolas, Courier, monospace;">print("%s with %i features" % (seq_record.id, len(seq_record.features)))</span></div>
<div><br>
</div>
<div><br>
</div>
<br>
<p></p>
<p><br>
</p>
<p><br>
</p>
<div id="Signature">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;">
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">Dr David Martin<br>
Senior Lecturer in Bioinformatics<br>
College of Life Sciences<br>
University of Dundee<br>
<br>
</div>
</div>
</div>
</div>
</div>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<hr style="display:inline-block; width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Jocelyne <jocelyne@gmail.com><br>
<b>Sent:</b> 03 October 2017 21:33<br>
<b>To:</b> David Martin (Staff)<br>
<b>Cc:</b> biopython@lists.open-bio.org<br>
<b>Subject:</b> Re: [Biopython] Issues parsing genbank files</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div>
<div>Hi David:<br>
<br>
</div>
All biopython does is call the EUtilities interface. The links I gave you earlier should be a good starting point on how to use eUtilities to create the correct query.<br>
<br>
</div>
Jocelyne<br>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Tue, Oct 3, 2017 at 1:27 PM, David Martin (Staff) <span dir="ltr">
<<a href="mailto:d.m.a.martin@dundee.ac.uk" target="_blank">d.m.a.martin@dundee.ac.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div dir="ltr">
<div id="m_-1161625660400852083divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif">
<p>If you put the accession into the NCBI website then the standard Genbank file is the one you receive as with the query you used. However, the full record is in the Genbank (full) view.</p>
<p><br>
</p>
<p>The question then is what is the correct syntax to use with the Entrez.fetch( ) command to retrieve the full record, and the note that the example given in the tutorial will not retrieve the full record.</p>
<span class="">
<p><br>
</p>
<p>..d</p>
<p><br>
</p>
<div id="m_-1161625660400852083Signature">
<div id="m_-1161625660400852083divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Arial,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div name="divtagdefaultwrapper">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">Dr David Martin<br>
Senior Lecturer in Bioinformatics<br>
College of Life Sciences<br>
University of Dundee<br>
<br>
</div>
</div>
</div>
</div>
</div>
<br>
<br>
</span>
<div style="color:rgb(0,0,0)">
<hr style="display:inline-block; width:98%">
<div id="m_-1161625660400852083divRplyFwdMsg" dir="ltr"><font color="#000000" face="Calibri, sans-serif" style="font-size:11pt"><b>From:</b> Jocelyne <<a href="mailto:jocelyne@gmail.com" target="_blank">jocelyne@gmail.com</a>><br>
<b>Sent:</b> 03 October 2017 21:23
<div>
<div class="h5"><br>
<b>To:</b> David Martin (Staff)<br>
<b>Cc:</b> <a href="mailto:biopython@lists.open-bio.org" target="_blank">biopython@lists.open-bio.org</a><br>
<b>Subject:</b> Re: [Biopython] Issues parsing genbank files</div>
</div>
</font>
<div> </div>
</div>
<div>
<div class="h5">
<div>
<div dir="ltr">
<div>Hi David:</div>
<div>If you are sure it's an issue, you should file an issue on the github project so that a contributor can take a look. Peter Cock is usually very responsive.<br>
</div>
<div><br>
</div>
<div></div>
<div>However, I submitted your query to entrez:</div>
<div><a href="https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=nucleotide&id=nc_003197&rettype=gb&retmode=text" id="m_-1161625660400852083LPlnk972572" target="_blank">https://eutils.ncbi.nlm.nih.<wbr>gov/entrez/eutils/efetch.fcgi?<wbr>db=nucleotide&id=nc_003197&<wbr>rettype=gb&retmode=text</a></div>
<div>and attached the file I got.<br>
</div>
<div>I only got 1 feature.</div>
<div><br>
</div>
<div>I believe genes are in a different database (the 'gene' database) and you'll have to do the proper querying through eutils.
<br>
</div>
<div><br>
</div>
<div>I'm not a developer on Biopython, and I didn't look into your issue closely so I could be wrong. Just trying to give you pointers.<br>
</div>
<div><br>
</div>
Jocelyne<br>
<div>
<div><br>
</div>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Tue, Oct 3, 2017 at 12:12 PM, David Martin (Staff) <span dir="ltr">
<<a href="mailto:d.m.a.martin@dundee.ac.uk" target="_blank">d.m.a.martin@dundee.ac.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div dir="ltr">
<div id="m_-1161625660400852083m_5877694653212212156divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif">
<p>Hi Jocelyne,</p>
<p><br>
</p>
<p>Firstly apologies for missing the 'e' in your name before.</p>
<p><br>
</p>
<p>The record being retrieved is a single sequence record - it is a bacterial chromosome. It should have many features, most corresponding to genes encoded within the chromosome. </p>
<span>
<p><br>
</p>
<p>..d</p>
<p><br>
</p>
<div id="m_-1161625660400852083m_5877694653212212156Signature">
<div id="m_-1161625660400852083m_5877694653212212156divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Arial,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div name="divtagdefaultwrapper">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">Dr David Martin<br>
Senior Lecturer in Bioinformatics<br>
College of Life Sciences<br>
University of Dundee<br>
<br>
</div>
</div>
</div>
</div>
</div>
<br>
<br>
</span>
<div style="color:rgb(0,0,0)"><span>
<hr style="display:inline-block; width:98%">
<div id="m_-1161625660400852083m_5877694653212212156divRplyFwdMsg" dir="ltr"><font color="#000000" face="Calibri, sans-serif" style="font-size:11pt"><b>From:</b> Jocelyne <<a href="mailto:jocelyne@gmail.com" target="_blank">jocelyne@gmail.com</a>><br>
<b>Sent:</b> 03 October 2017 19:57<br>
<b>To:</b> David Martin (Staff)<br>
<b>Cc:</b> <a href="mailto:biopython@lists.open-bio.org" target="_blank">biopython@lists.open-bio.org</a><br>
<b>Subject:</b> Re: [Biopython] Issues parsing genbank files</font>
<div> </div>
</div>
</span>
<div>
<div dir="ltr">
<div><span>
<div>
<div>Hi David:<br>
</div>
I think if you are searching by id, you should only get 1 record. <br>
</div>
The questions you are asking sound to me like Entrez / NCBI databases questions, not necessarily Biopython questions. Unless someone else has time to dive into your specific example, I suggest you look at this documentation:<br>
<a href="https://www.ncbi.nlm.nih.gov/Class/MLACourse/Original8Hour/Entrez/" id="m_-1161625660400852083m_5877694653212212156LPlnk289032" target="_blank">https://www.ncbi.nlm.nih.gov/C<wbr>lass/MLACourse/Original8Hour/E<wbr>ntrez/</a>
</span><span>
<div id="m_-1161625660400852083m_5877694653212212156LPBorder_GT_15070578530400.6585899649075668" style="margin-bottom:20px; overflow:auto; width:100%; text-indent:0px">
<table id="m_-1161625660400852083m_5877694653212212156LPContainer_15070578530320.37270568043257524" cellspacing="0" style="width:90%; background-color:rgb(255,255,255); overflow:auto; padding-top:20px; padding-bottom:20px; margin-top:20px; border-top:1px dotted rgb(200,200,200); border-bottom:1px dotted rgb(200,200,200)">
<tbody>
<tr valign="top" style="border-spacing:0px">
<td id="m_-1161625660400852083m_5877694653212212156TextCell_15070578530340.6213871535175017" colspan="2" style="vertical-align:top; padding:0px; display:table-cell">
<div id="m_-1161625660400852083m_5877694653212212156LPRemovePreviewContainer_15070578530350.24206507103057295">
</div>
<div id="m_-1161625660400852083m_5877694653212212156LPTitle_15070578530350.39796956705483066" style="color:rgb(0,120,215); font-weight:normal; font-size:21px; font-family:wf_segoe-ui_light,"Segoe UI Light","Segoe WP Light","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; line-height:21px">
<a id="m_-1161625660400852083m_5877694653212212156LPUrlAnchor_15070578530370.5661820631142123" href="https://www.ncbi.nlm.nih.gov/Class/MLACourse/Original8Hour/Entrez/" target="_blank" style="text-decoration:none">MLA CE Course Manual: Molecular Biology Information
...</a></div>
<div id="m_-1161625660400852083m_5877694653212212156LPMetadata_15070578530370.1967457617256929" style="margin:10px 0px 16px; color:rgb(102,102,102); font-weight:normal; font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; font-size:14px; line-height:14px">
<a href="http://www.ncbi.nlm.nih.gov" target="_blank">www.ncbi.nlm.nih.gov</a></div>
<div id="m_-1161625660400852083m_5877694653212212156LPDescription_15070578530380.7769491901733283" style="display:block; color:rgb(102,102,102); font-weight:normal; font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; font-size:14px; line-height:20px; max-height:100px; overflow:hidden">
insert the description to be displayed by the search engine. Also searched by the search engine.</div>
</td>
</tr>
</tbody>
</table>
</div>
<br>
<br>
</span><a href="https://www.ncbi.nlm.nih.gov/books/NBK25501/" id="m_-1161625660400852083m_5877694653212212156LPlnk495247" target="_blank">https://www.ncbi.nlm.nih.gov/b<wbr>ooks/NBK25501/</a><br>
</div>
Jocelyne<br>
<div>
<div>
<div> <br>
<br>
<br>
<br>
</div>
</div>
</div>
</div>
<div>
<div class="m_-1161625660400852083h5">
<div class="gmail_extra"><br>
<div class="gmail_quote">On Tue, Oct 3, 2017 at 2:39 AM, David Martin (Staff) <span dir="ltr">
<<a href="mailto:d.m.a.martin@dundee.ac.uk" target="_blank">d.m.a.martin@dundee.ac.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div lang="EN-GB">
<div class="m_-1161625660400852083m_5877694653212212156m_3041449790183323555WordSection1">
<p class="MsoNormal">Hi folks,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I’m trying to parse some bacterial genomes. I’ve lifted the following code from the biopython tutorial but it seems to be giving issues.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><span style="font-family:Consolas">from Bio import Entrez<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:Consolas">from Bio import SeqIO<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:Consolas">Entrez.email = "<a href="mailto:A.N.Other@example.com" target="_blank">A.N.Other@example.com</a>"<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:Consolas">with Entrez.efetch(db="nucleotide", rettype="gb", retmode="text", id="nc_003197") as handle:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:Consolas"> seq_record = SeqIO.read(handle, "gb") #using "gb" as an alias for "genbank"<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:Consolas">print("%s with %i features" % (<a href="http://seq_record.id" target="_blank">seq_record.id</a>, len(seq_record.features)))<u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I get one feature instead of the thousands expected.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Trying to extract a single gene I get a run of NN instead of sequence.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Thoughts: This is initially retrieved as a set of annotations but no sequence. Is there a way to ensure entrez retrieves the full data?<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">..d<u></u><u></u></p>
<p class="MsoNormal"><a href="//sig/" target="_blank"><span style="font-size:12.0pt; font-family:"Times New Roman",serif; color:blue; text-decoration:none"><img id="m_-1161625660400852083m_5877694653212212156m_3041449790183323555_x0000_i1032" alt="Email signature" width="1" height="2" border="0" style="user-select: none;" src="https://www.dundee.ac.uk/media/dundeewebsite/emailsignature/tiny.png"></span></a><span style="font-size:12.0pt; font-family:"Times New Roman",serif"><u></u><u></u></span></p>
<table class="m_-1161625660400852083m_5877694653212212156m_3041449790183323555MsoNormalTable" cellspacing="0" cellpadding="0" border="0" style="border-collapse:collapse">
<tbody>
<tr style="height:7.5pt">
<td colspan="4" style="padding:0cm 0cm 0cm 0cm; height:7.5pt">
<p class="MsoNormal"><span style="font-size:12.0pt; font-family:"Times New Roman",serif"> <u></u><u></u></span></p>
</td>
</tr>
<tr>
<td style="padding:0cm 0cm 0cm 0cm">
<p class="MsoNormal"><a href="http://uod.ac.uk/sig-home" target="_blank"><span style="font-size:7.5pt; font-family:"Times New Roman",serif; color:blue; text-decoration:none"><img id="m_-1161625660400852083m_5877694653212212156m_3041449790183323555_x0000_i1031" alt="University of Dundee shield logo" width="73" height="73" border="0" style="user-select: none;" src="https://www.dundee.ac.uk/media/dundeewebsite/themes/brandnewhope/img/university-of-dundee-email-favicon.png"></span></a><span style="font-size:7.5pt; font-family:"Times New Roman",serif"><u></u><u></u></span></p>
</td>
<td width="12" style="width:9.0pt; padding:0cm 0cm 0cm 0cm">
<p class="MsoNormal"><span style="font-size:12.0pt; font-family:"Times New Roman",serif"> <u></u><u></u></span></p>
</td>
<td width="11" style="width:8.25pt; border:none; border-left:solid #4365e2 1.0pt; padding:0cm 0cm 0cm 0cm">
<p class="MsoNormal"><span style="font-size:12.0pt; font-family:"Times New Roman",serif"> <u></u><u></u></span></p>
</td>
<td width="430" style="width:322.5pt; padding:0cm 0cm 0cm 0cm">
<p class="MsoNormal" style="line-height:15.0pt"><b><span style="font-size:10.5pt; color:#4365e2; letter-spacing:.9pt">Dr David M A Martin PhD FRSB</span></b><span style="font-size:10.0pt; color:#4365e2"><br>
Senior Lecturer in Bioinformatics<br>
School of Life Sciences, University of Dundee<br>
<a href="tel:+44%201382%20388704" value="+441382388704" target="_blank">+44(0)1382 388704</a> |
<a href="mailto:d.m.a.martin@dundee.ac.uk@dundee.ac.uk" target="_blank"><span style="color:#4365e2; text-decoration:none">d.m.a.martin@dundee.ac.uk</span></a><u></u><u></u></span></p>
</td>
</tr>
<tr style="height:7.5pt">
<td colspan="4" style="padding:0cm 0cm 0cm 0cm; height:7.5pt"></td>
</tr>
<tr>
<td colspan="4" style="padding:0cm 0cm 0cm 0cm">
<p class="MsoNormal"><a href="http://uod.ac.uk/sig-fb" target="_blank"><span style="font-size:9.0pt; color:blue; text-decoration:none"><img id="m_-1161625660400852083m_5877694653212212156m_3041449790183323555_x0000_i1030" alt="University of Dundee Facebook" width="32" height="32" border="0" style="user-select: none;" src="https://www.dundee.ac.uk/media/dundeewebsite/themes/brandnewhope/img/baxter-blue-facebook.png"></span></a><a href="http://uod.ac.uk/sig-tw" target="_blank"><span style="font-size:9.0pt; color:blue; text-decoration:none"><img id="m_-1161625660400852083m_5877694653212212156m_3041449790183323555_x0000_i1029" alt="University of Dundee Twitter" width="32" height="32" border="0" style="user-select: none;" src="https://www.dundee.ac.uk/media/dundeewebsite/themes/brandnewhope/img/baxter-blue-twitter.png"></span></a><a href="http://uod.ac.uk/sig-li" target="_blank"><span style="font-size:9.0pt; color:blue; text-decoration:none"><img id="m_-1161625660400852083m_5877694653212212156m_3041449790183323555_x0000_i1028" alt="University of Dundee LinkedIn" width="32" height="32" border="0" style="user-select: none;" src="https://www.dundee.ac.uk/media/dundeewebsite/themes/brandnewhope/img/baxter-blue-linkedin.png"></span></a><a href="http://uod.ac.uk/sig-yt" target="_blank"><span style="font-size:9.0pt; color:blue; text-decoration:none"><img id="m_-1161625660400852083m_5877694653212212156m_3041449790183323555_x0000_i1027" alt="University of Dundee YouTube" width="32" height="32" border="0" style="user-select: none;" src="https://www.dundee.ac.uk/media/dundeewebsite/themes/brandnewhope/img/baxter-blue-youtube.png"></span></a><a href="http://uod.ac.uk/sig-ig" target="_blank"><span style="font-size:9.0pt; color:blue; text-decoration:none"><img id="m_-1161625660400852083m_5877694653212212156m_3041449790183323555_x0000_i1026" alt="University of Dundee Instagram" width="32" height="32" border="0" style="user-select: none;" src="https://www.dundee.ac.uk/media/dundeewebsite/themes/brandnewhope/img/baxter-blue-instagram.png"></span></a><a href="http://uod.ac.uk/sig-sc" target="_blank"><span style="font-size:9.0pt; color:blue; text-decoration:none"><img id="m_-1161625660400852083m_5877694653212212156m_3041449790183323555_x0000_i1025" alt="University of Dundee Snapchat" width="32" height="32" border="0" style="user-select: none;" src="https://www.dundee.ac.uk/media/dundeewebsite/themes/brandnewhope/img/baxter-blue-snapchat.png"></span></a><span style="font-size:9.0pt; color:#4365e2"> </span><span style="font-size:12.0pt; font-family:"Times New Roman",serif"><u></u><u></u></span></p>
</td>
</tr>
<tr>
<td colspan="4" style="padding:0cm 0cm 0cm 0cm">
<p class="MsoNormal"><span style="font-size:8.5pt; color:#888888"><a href="http://uod.ac.uk/sig-strapline" target="_blank"><b><span style="color:#4365e2; text-decoration:none">We're Scottish University of the Year again!</span></b></a><br>
The Times / Sunday Times Good University Guide 2016 and 2017</span><span style="font-size:12.0pt; font-family:"Times New Roman",serif"><u></u><u></u></span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<br>
<span style="font-size:10pt">The University of Dundee is a registered Scottish Charity, No: SC015096</span>
</div>
<br>
______________________________<wbr>_________________<br>
Biopython mailing list - <a href="mailto:Biopython@mailman.open-bio.org" target="_blank">
Biopython@mailman.open-bio.org</a><br>
<a href="http://mailman.open-bio.org/mailman/listinfo/biopython" rel="noreferrer" target="_blank">http://mailman.open-bio.org/ma<wbr>ilman/listinfo/biopython</a><br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div class="m_-1161625660400852083h5"><br>
<span style="font-size:10pt">The University of Dundee is a registered Scottish Charity, No: SC015096</span>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div class="h5"><br>
<span style="font-size:10pt">The University of Dundee is a registered Scottish Charity, No: SC015096</span>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
<br>
<span style="font-size:10pt;">The University of Dundee is a registered Scottish Charity, No: SC015096</span>
</body>
</html>