You were missing a few things. Here's the code as I think it should be:
#!/usr/bin/perl use strict; use warnings; use Bio::SeqIO; my $in = Bio::SeqIO->new( -file => "/root/Desktop/seqIOnew.fasta", -format => 'FASTA'); my $out = Bio::SeqIO->new( -file => ">/root/Desktop/new_out.log", -format => "EMBL" ); while ( my $seq = $in->next_seq() ) { print $out->write_seq($seq), "\n"; }
For the input, I took your sequence and put it in a file called seqIOnew.fasta. I tried to get the accession number, but it returned "unknown". Printing out the $seq, you'll see that there is no accession number, so that's why it came back unknown.

For the output, I used new_out.log on my desktop.

Here's the corrected sequence:

>gi|1786958|gb|AAC73831.1| membrane spanning protein in TolA-TolQ-TolR + complex [Escherichia coli str. K-12 substr. MG1655] MTDMNILDLFLKASLL +VKLIMLILIGFSIASWAIIIQRTRILNAAAREAEAFEDKFWSGIELSRLYQESQ GKRDNLTGSEQIFY +SGFKEFVRLHRANSHAPEAVVEGASRAMRISMNRELENLETHIPFLGTVGSISPYI GLFGTVWGIMHA +FIALGAVKQATLQMVAPGIAEALIATAIGLFAAIPAVMAYNRLNQRVNKLELNYDNFM EEFTAILHRQ +AFTVSESNKG
And here's the output:
ID unknown; SV 1; linear; ; STD; UNC; 0 BP. XX AC unknown; XX DE membrane spanning protein in TolA-TolQ-TolR complex [Escherichia +coli str. DE K-12 substr. MG1655] DE MTDMNILDLFLKASLLVKLIMLILIGFSIASWAIIIQRTRILNAAAREAEAFEDKFWSGIELSRL +YQESQ DE GKRDNLTGSEQIFYSGFKEFVRLHRANSHAPEAVVEGASRAMRISMNRELENLETHIPFLGTVGS +ISPYI DE GLFGTVWGIMHAFIALGAVKQATLQMVAPGIAEALIATAIGLFAAIPAVMAYNRLNQRVNKLELN +YDNFM DE EEFTAILHRQAFTVSESNKG XX FH Key Location/Qualifiers FH XX //

In reply to Re: A strange error message with Bio::SeqIO by Khen1950fx
in thread A strange error message with Bio::SeqIO by genbank

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.