Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
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: }

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
Node Status?
node history
Node Type: perlcraft [id://342416]
Approved by kvale
help
Chatterbox?
holli loves lightning talks
[1nickt]: ... but not the last straw?
1nickt ducks
virtualsue will be sweeping/raking it up for days
[virtualsue]: I need to get some cat pics into my talk http://www.cat- lovers-only.com/ images/three-cat- burritos-to-go-500 .jpg

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (14)
As of 2017-11-21 12:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (300 votes). Check out past polls.

    Notices?