Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Fetching Biological Sequences from the NCBI

by biosysadmin (Deacon)
on Apr 04, 2004 at 05:50 UTC ( [id://342416]=perlcraft: print w/replies, xml ) Need Help??

   1: #!/usr/bin/perl -w
   2: 
   3: use strict;
   4: use Bio::DB::GenBank;
   5: use Bio::SeqIO;
   6: use File::Basename;
   7: 
   8: # configuration information
   9: my $outfile  = 'outfile';
  10: my $progname = basename $0;
  11: 
  12: # usage information
  13: my $usage = "usage:  $0 accession1 [accession2 ...]\n";
  14: die $usage unless @ARGV;
  15: 
  16: # start program flow
  17: my $gb = new Bio::DB::GenBank( 
  18:    -retrievaltype => 'tempfile', 
  19:    -format => 'Fasta'
  20: );
  21: 
  22: my $seqout = Bio::SeqIO->new( -file => ">$outfile", -format => 'FASTA' );
  23: 
  24: my $seqio = $gb->get_Stream_by_acc( @ARGV );
  25: while( my $sequence =  $seqio->next_seq ) {
  26:    $seqout->write_seq($sequence);
  27: }

Replies are listed 'Best First'.
Re: Fetching Biological Sequences from the NCBI
by Sameet (Beadle) on Apr 23, 2004 at 18:25 UTC
    Is it possible to download a part of the sequence using this code, with some modifications. I mean I have 3 nested loops. One selects a chromosome randomly, one selects a contig randomly and third selects a number from 2000 to the length of the contig. Can anybody tell me a way to do it. All help is highly solicitated and will be highly appreciated. regards sameet

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2024-04-19 12:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found