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

View of /FigMetagenomeTools/separategenbank.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (download) (as text) (annotate)
Mon Feb 19 17:15:26 2007 UTC (13 years, 3 months ago) by olson
Branch point for: x, MAIN
Initial revision

#!/usr/bin/perl -w

use strict;
use Bio::SeqIO;

my $file=shift;
my $dir=shift;
unless ($file && $dir) {die "$0 <genbank file> <dir to put separate files>"}

$dir =~ s/\/$//;
if (-e $dir) {die "$dir already exists"}
else {mkdir $dir, 0755}

my $si=Bio::SeqIO->new(-file=>$file, -format=>"genbank");
while (my $seq=$si->next_seq) {
 my $id=$seq->display_name;
 $id =~ s/\s+//g;
 my $so=Bio::SeqIO->new(-file=>">$dir/$id", -format=>"genbank");
 $so->write_seq($seq);
 $so->close;
}



MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3