<div dir="ltr">I just wanted to note that there was a similar discussion in <a href="https://github.com/biopython/biopython/issues/747">#747</a> which I submitted about a year ago. I'm not sure if it adds anything to the discussion, but since the issue and Bastien's proposed change is similar to what I suggested I thought I'd throw it out there. <div><br></div><div>I think the behavior implemented in <a href="https://github.com/biopython/biopython/pull/802">#802</a> is a good solution, and agree additional complexity is not advisable. In the situation I linked to above, I ended up storing the longer names in a dictionary and used short keys for everything that biopython dealt with. Then when I was all done, I went back and re-wrote the locus lines using the dictionary and normal file I/O. It's a messy hack but I can go dig up the code if it would be helpful.</div><div><br></div><div>Cheers!</div><div>Kevin</div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Feb 2, 2017 at 2:11 PM Peter Cock <<a href="mailto:p.j.a.cock@googlemail.com">p.j.a.cock@googlemail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I was alluding to this paragraph in <a href="ftp://ftp.ncbi.nih.gov/genbank/gbrel.txt" rel="noreferrer" class="gmail_msg" target="_blank">ftp://ftp.ncbi.nih.gov/genbank/gbrel.txt</a><br class="gmail_msg">
<br class="gmail_msg">
  Although each of these data values can be found at column-specific<br class="gmail_msg">
positions, we encourage those who parse the contents of the LOCUS<br class="gmail_msg">
line to use a token-based approach. This will prevent the need for<br class="gmail_msg">
software changes if the spacing of the data values ever has to be<br class="gmail_msg">
modified.<br class="gmail_msg">
<br class="gmail_msg">
See also <a href="https://github.com/biopython/biopython/issues/526#issuecomment-276994748" rel="noreferrer" class="gmail_msg" target="_blank">https://github.com/biopython/biopython/issues/526#issuecomment-276994748</a><br class="gmail_msg">
<br class="gmail_msg">
Given the current Bio.SeqIO API, I take it you are suggesting a<br class="gmail_msg">
file format variant like "genbank-relaxed" or "genbank-strict"?<br class="gmail_msg">
(Precedent with the FASTQ variants, or PHYLIP in AlignIO)<br class="gmail_msg">
<br class="gmail_msg">
I would prefer just to have one GenBank mode - it is complicated<br class="gmail_msg">
enough already.<br class="gmail_msg">
<br class="gmail_msg">
Peter<br class="gmail_msg">
<br class="gmail_msg">
On Thu, Feb 2, 2017 at 5:33 PM, Chevreux, Bastien<br class="gmail_msg">
<<a href="mailto:bastien.chevreux@dsm.com" class="gmail_msg" target="_blank">bastien.chevreux@dsm.com</a>> wrote:<br class="gmail_msg">
> I could not find any discussion about LOCUS line and separators, so I cannot comment on that.<br class="gmail_msg">
><br class="gmail_msg">
> The way I would implement output in BioPython is a mode flag. If set to strict (default) it would give exactly what we have today, if set to 'loose' it would try to wiggle name and size numbers into the available space for name and size, leaving the rest untouched. That would leave the possibility to have a "separator" mode sometime later should LOCUS lines switch to that.<br class="gmail_msg">
><br class="gmail_msg">
> B.<br class="gmail_msg">
><br class="gmail_msg">
> --<br class="gmail_msg">
> DSM Nutritional Products Microbia Inc | Bioinformatics<br class="gmail_msg">
> 60 Westview Street | Lexington, MA 02421 | United States<br class="gmail_msg">
> Phone <a href="tel:(781)%20259-7613" value="+17812597613" class="gmail_msg" target="_blank">+1 781 259 7613</a> | Fax <a href="tel:(781)%20259-0615" value="+17812590615" class="gmail_msg" target="_blank">+1 781 259 0615</a><br class="gmail_msg">
><br class="gmail_msg">
> -----Original Message-----<br class="gmail_msg">
> From: Peter Cock [mailto:<a href="mailto:p.j.a.cock@googlemail.com" class="gmail_msg" target="_blank">p.j.a.cock@googlemail.com</a>]<br class="gmail_msg">
> Sent: Thursday, February 02, 2017 10:39 AM<br class="gmail_msg">
> To: Chevreux, Bastien <<a href="mailto:bastien.chevreux@dsm.com" class="gmail_msg" target="_blank">bastien.chevreux@dsm.com</a>><br class="gmail_msg">
> Cc: <a href="mailto:biopython@biopython.org" class="gmail_msg" target="_blank">biopython@biopython.org</a><br class="gmail_msg">
> Subject: Re: [Biopython] LOCUS name length on GenBank output: option to adjust?<br class="gmail_msg">
><br class="gmail_msg">
> --- This mail has been sent from an external source ---<br class="gmail_msg">
><br class="gmail_msg">
><br class="gmail_msg">
> I've not checked lately but has there been any progress on the NCBI moving GenBank format away from a strict positional interpretation of the LOCUS line to being separator based? The issue and discussion you referenced was back in 2015...<br class="gmail_msg">
><br class="gmail_msg">
> Practically speaking perhaps we could write a spec-breaking minimal LOCUS line (leaving out things like the date and division which make parsing a problem once the column positions are lost) with a warning?<br class="gmail_msg">
><br class="gmail_msg">
> Peter<br class="gmail_msg">
><br class="gmail_msg">
><br class="gmail_msg">
> On Thu, Feb 2, 2017 at 3:16 PM, Chevreux, Bastien <<a href="mailto:bastien.chevreux@dsm.com" class="gmail_msg" target="_blank">bastien.chevreux@dsm.com</a>> wrote:<br class="gmail_msg">
>> Dear list,<br class="gmail_msg">
>><br class="gmail_msg">
>><br class="gmail_msg">
>><br class="gmail_msg">
>> could BioPython implement an option to adjust the strictness of name<br class="gmail_msg">
>> length checking of a sequence when writing GenBank output?<br class="gmail_msg">
>><br class="gmail_msg">
>><br class="gmail_msg">
>><br class="gmail_msg">
>> I am aware of the short discussion in<br class="gmail_msg">
>><br class="gmail_msg">
>>   <a href="https://github.com/biopython/biopython/issues/526" rel="noreferrer" class="gmail_msg" target="_blank">https://github.com/biopython/biopython/issues/526</a><br class="gmail_msg">
>><br class="gmail_msg">
>><br class="gmail_msg">
>><br class="gmail_msg">
>> and that BioPython wants to be strict on writing GenBank. However, I<br class="gmail_msg">
>> beg to reconsider this decision and allow for a user override.<br class="gmail_msg">
>><br class="gmail_msg">
>><br class="gmail_msg">
>><br class="gmail_msg">
>> Background: annotation of metagenomics / metatranscriptomic datasets<br class="gmail_msg">
>> where one can easily have a million contigs or more. Projects were<br class="gmail_msg">
>> named accordingly short so that names of DNA sequences fit into 16 characters.<br class="gmail_msg">
>> However, what was not considered was GenBank output of peptides, where<br class="gmail_msg">
>> the locus names are<br class="gmail_msg">
>> <name_of_contig>+<underscore>+<CDScounter_in_contig> … and that may go up to 20.<br class="gmail_msg">
>><br class="gmail_msg">
>><br class="gmail_msg">
>><br class="gmail_msg">
>> As we are talking protein sequences here and there is no known protein<br class="gmail_msg">
>>>99999 amino acids, there would be a lot of wiggle room to allow the<br class="gmail_msg">
>>>user to<br class="gmail_msg">
>> set a 20 char limit (or more) during GB output.<br class="gmail_msg">
>><br class="gmail_msg">
>><br class="gmail_msg">
>><br class="gmail_msg">
>> Best,<br class="gmail_msg">
>><br class="gmail_msg">
>>   Bastien<br class="gmail_msg">
>><br class="gmail_msg">
>><br class="gmail_msg">
>><br class="gmail_msg">
>> --<br class="gmail_msg">
>> DSM Nutritional Products Microbia Inc | Bioinformatics<br class="gmail_msg">
>> 60 Westview Street | Lexington, MA 02421 | United States Phone +1 781<br class="gmail_msg">
>> 259 7613 | Fax <a href="tel:(781)%20259-0615" value="+17812590615" class="gmail_msg" target="_blank">+1 781 259 0615</a><br class="gmail_msg">
>><br class="gmail_msg">
>><br class="gmail_msg">
>><br class="gmail_msg">
>><br class="gmail_msg">
>> ________________________________<br class="gmail_msg">
>><br class="gmail_msg">
>> DISCLAIMER:<br class="gmail_msg">
>> This e-mail is for the intended recipient only.<br class="gmail_msg">
>> If you have received it by mistake please let us know by reply and<br class="gmail_msg">
>> then delete it from your system; access, disclosure, copying,<br class="gmail_msg">
>> distribution or reliance on any of it by anyone else is prohibited.<br class="gmail_msg">
>> If you as intended recipient have received this e-mail incorrectly,<br class="gmail_msg">
>> please notify the sender (via e-mail) immediately.<br class="gmail_msg">
>><br class="gmail_msg">
>> _______________________________________________<br class="gmail_msg">
>> Biopython mailing list  -  <a href="mailto:Biopython@mailman.open-bio.org" class="gmail_msg" target="_blank">Biopython@mailman.open-bio.org</a><br class="gmail_msg">
>> <a href="http://mailman.open-bio.org/mailman/listinfo/biopython" rel="noreferrer" class="gmail_msg" target="_blank">http://mailman.open-bio.org/mailman/listinfo/biopython</a><br class="gmail_msg">
<br class="gmail_msg">
_______________________________________________<br class="gmail_msg">
Biopython mailing list  -  <a href="mailto:Biopython@mailman.open-bio.org" class="gmail_msg" target="_blank">Biopython@mailman.open-bio.org</a><br class="gmail_msg">
<a href="http://mailman.open-bio.org/mailman/listinfo/biopython" rel="noreferrer" class="gmail_msg" target="_blank">http://mailman.open-bio.org/mailman/listinfo/biopython</a></blockquote></div><div dir="ltr">-- <br></div><div data-smartmail="gmail_signature"><div dir="ltr"><div>Lecturer, Harvard Medical School</div><div>617-432-2210</div></div></div>