Mercurial > repos > ucsb-phylogenetics > osiris_phylogenetics
comparison getdata/get_1_gb.pl @ 0:5b9a38ec4a39 draft default tip
First commit of old repositories
author | osiris_phylogenetics <ucsb_phylogenetics@lifesci.ucsb.edu> |
---|---|
date | Tue, 11 Mar 2014 12:19:13 -0700 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:5b9a38ec4a39 |
---|---|
1 #!/usr/bin/perl -w | |
2 use strict; | |
3 | |
4 #use FindBin; | |
5 #use lib "$FindBin::Bin/lib"; | |
6 use Bio::DB::GenBank; | |
7 use Bio::SeqIO; | |
8 | |
9 my $accession = $ARGV[0]; | |
10 my $datatype = $ARGV[1]; | |
11 my $outtype = $ARGV[2]; | |
12 my $outfile = $ARGV[3]; | |
13 | |
14 | |
15 my $qry_string .= $accession."[accession]"; | |
16 my $fh = Bio::SeqIO->newFh(-format=>$outtype, -file=>">$outfile"); | |
17 | |
18 my $GBseq; | |
19 my $gb = new Bio::DB::GenBank; | |
20 my $query = Bio::DB::Query::GenBank->new | |
21 (-query =>$qry_string, | |
22 -db =>$datatype); | |
23 | |
24 my $count; | |
25 my $species; | |
26 my $seqio = $gb->get_Stream_by_query($query); | |
27 while( defined ($GBseq = $seqio->next_seq )) { | |
28 my $sequence = $GBseq; # read a sequence object | |
29 print $fh $sequence; # write a sequence object | |
30 } | |
31 | |
32 exit; |