Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
Perl: the Markov chain saw
 
PerlMonks  

Fetching Biological Sequences from the NCBI

by biosysadmin (Deacon)
on Apr 04, 2004 at 05:50 UTC ( #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: }

Comment on Fetching Biological Sequences from the NCBI
Download Code
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
Node Status?
node history
Node Type: perlcraft [id://342416]
Approved by kvale
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2014-04-21 10:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (493 votes), past polls