ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/msatfinder/gbsplitter
Revision: 1.1.1.1 (vendor branch)
Committed: Mon Mar 7 15:34:43 2005 UTC (11 years, 6 months ago) by knirirr
Branch: MAIN
CVS Tags: HEAD, HEAD
Changes since 1.1: +0 -0 lines
Log Message:
First import

Line File contents
1 #!/usr/bin/perl
2
3 # a script to copy a large concatenated genbank file
4 # to several seperate files, e.g. for use with msatminer
5
6 use strict;
7
8 # $infile is a single large genbank file containing multiple sequences
9 unless (@ARGV == 1)
10 {
11 die <<EOF;
12 Command Line Usage:
13
14 gbsplitter.pl "filename"
15
16 Where "filename" is the name of a single file containing multiple
17 sequences in Genbank format.
18 Please try again.
19 EOF
20 }
21
22 my $infile = $ARGV[0];
23
24 open(IN, "<$infile") or die "Can't open $infile: $!";
25 my @file=();
26 my $filename;
27
28 while (my $line = <IN>)
29 {
30 push (@file, $line);
31 if ($line =~ /^LOCUS/)
32 {
33 $line =~ /^LOCUS\s+(\S+)/;
34 $filename = $1;
35 $filename = $filename . ".gbk";
36 }
37 if ($line =~ /^\/\/$/)
38 {
39 print "Opening output file: $filename\n";
40 open (OUT, ">$filename") or die "Can't open $filename";
41 print OUT @file;
42 close OUT;
43 @file=();
44 }
45 }