[Bio] / FigMetagenomeTools / separategenbank.pl Repository:
ViewVC logotype

Annotation of /FigMetagenomeTools/separategenbank.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (view) (download) (as text)

1 : olson 1.1 #!/usr/bin/perl -w
2 :    
3 :     use strict;
4 :     use Bio::SeqIO;
5 :    
6 :     my $file=shift;
7 :     my $dir=shift;
8 :     unless ($file && $dir) {die "$0 <genbank file> <dir to put separate files>"}
9 :    
10 :     $dir =~ s/\/$//;
11 :     if (-e $dir) {die "$dir already exists"}
12 :     else {mkdir $dir, 0755}
13 :    
14 :     my $si=Bio::SeqIO->new(-file=>$file, -format=>"genbank");
15 :     while (my $seq=$si->next_seq) {
16 :     my $id=$seq->display_name;
17 :     $id =~ s/\s+//g;
18 :     my $so=Bio::SeqIO->new(-file=>">$dir/$id", -format=>"genbank");
19 :     $so->write_seq($seq);
20 :     $so->close;
21 :     }
22 :    
23 :    

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3