[Bioperl-l] Genbank LOCUS entry

Jason Stajich jason.stajich at duke.edu
Wed Feb 2 17:11:33 EST 2005


...Except Matthias is retrieving  sequences via Bio::DB, could also 
pipe the output from SeqIO to grep to get what you want but that seems 
silly.

More correctly one can understand how we re-contruct a genbank file 
from the Seq objects by looking at the write_seq method in 
Bio::SeqIO::genbank.

For this particular example we do:
            $temp_line = sprintf ("%-12s%-15s%13s %s%4s%-8s%-8s %3s %-s",
                                   'LOCUS', $seq->id(),$len,
                                   (lc($alpha) eq 'protein') ? ('aa','', 
'') :
                                   ('bp', '',$mol),$circular,
                                   $div,$date);

If you look at the code before this line you can see how we set the 
$alpha, $mol, $circular, $div, and $date variables.

% perldoc -m Bio::SeqIO::genbank  | less
will give you the code if you don't know where the module is located.

-jason
--
Jason Stajich
jason.stajich at duke.edu
http://www.duke.edu/~jes12/
On Feb 2, 2005, at 4:52 PM, Hilmar Lapp wrote:

> You do get the LOCUS name - what you are asking for is the entire 
> LOCUS line. There no method for the entire line; but if that's all you 
> need then I'd just do
>
> 	$ grep "^LOCUS" < my-genbank-file
>
> on the command line.
>
> 	-hilmar
>
> On Wednesday, February 2, 2005, at 01:38  PM, Matthias Adams wrote:
>
>> Hello!
>>
>> I have a problem concerning the genbank LOCUS entry:
>> As described in the BioPerl documentation
>> (http://search.cpan.org/~birney/bioperl-1.4/Bio/Seq.pm):
>> "The display_id() method returns the LOCUS name of a Genbank entry"
>> (also described somewhere else)
>>
>> I can not reproduce this behavior, some test code:
>> #!/usr/bin/perl -w
>> use Bio::DB::GenBank;
>> use Bio::Perl;
>>
>> use strict;
>> use Error qw(:try);
>>
>> my $seqio;
>>
>>         my $gb = new Bio::DB::GenBank();
>>         my $q;
>>         my $qstring="BV421351";
>>         $q =Bio::DB::Query::GenBank->new
>>                 (-query   =>$qstring,
>>                 -db      => 'nucleotide',
>>                 -verbose => 0);
>>         $seqio = $gb->get_Stream_by_query($q);
>>         while( my $seq =  $seqio->next_seq ) {
>>         #       print $seq->desc(), "\n";
>>                 print "LOCUS: \"", $seq->display_id(), "\"\n";
>>         }
>>
>> The only output is:
>> LOCUS: "BV421351"
>>
>> It's just the accession number.
>> But I need the LOCUS line as in genbank:
>> BV421351                 590 bp    DNA     linear   STS 01-FEB-2005
>>
>> So whats my problem? Do I have to call another sub?
>>
>> Thanks for your help, Matze.
>> _______________________________________________
>> Bioperl-l mailing list
>> Bioperl-l at portal.open-bio.org
>> http://portal.open-bio.org/mailman/listinfo/bioperl-l
>>
>>
> -- 
> -------------------------------------------------------------
> Hilmar Lapp                            email: lapp at gnf.org
> GNF, San Diego, Ca. 92121              phone: +1-858-812-1757
> -------------------------------------------------------------
>
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at portal.open-bio.org
> http://portal.open-bio.org/mailman/listinfo/bioperl-l
>



More information about the Bioperl-l mailing list