[Bio] / FigKernelScripts / parse_genbank.pl Repository:
ViewVC logotype

Diff of /FigKernelScripts/parse_genbank.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2, Wed Dec 3 19:39:29 2003 UTC revision 1.3, Fri Jan 9 19:18:21 2004 UTC
# Line 2  Line 2 
2    
3  $usage = "usage: parse_genbank Genome Dir < genbank.entry";  $usage = "usage: parse_genbank Genome Dir < genbank.entry";
4  (  (
5   $genome = shift @ARGV &&   ($genome = shift(@ARGV)) &&
6   $dir    = shift @ARGV   ($dir    = shift(@ARGV))
7  )  )
8      || die $usage;      || die $usage;
9    
10  $prefixP = "fig|$genome.peg.";  $prefixP = "fig|$genome.peg.";
11  $prefixR = "fig|$genome.rna.";  $prefixR = "fig|$genome.rna.";
12    
13  &verify_dir("$dir/Features/peg");  &FIG::verify_dir("$dir/Features/peg");
14  &verify_dir("$dir/Features/rna");  &FIG::verify_dir("$dir/Features/rna");
15  open(CONTIGS,">$dir/contigs") "" die "could not open $dir/contigs";  open(CONTIGS,">$dir/contigs") || die "could not open $dir/contigs";
16  open(TBLPEG,">$dir/Features/peg/tbl") || die "could not open $dir/Features/peg/tbl";  open(TBLPEG,">$dir/Features/peg/tbl") || die "could not open $dir/Features/peg/tbl";
17  open(FASTAPEG,">$dir/Features/peg/fasta") || die "could not open $dir/Features/peg/fasta";  open(FASTAPEG,">$dir/Features/peg/fasta") || die "could not open $dir/Features/peg/fasta";
18  open(ASSIGNMENTS,">$dir/assigned_functions") "" die "could not open $dir/assigned_functions";  open(ASSIGNMENTS,">$dir/assigned_functions") || die "could not open $dir/assigned_functions";
19  open(TBLRNA,">$dir/Features/rna/tbl") || die "could not open $dir/Features/rna/tbl";  open(TBLRNA,">$dir/Features/rna/tbl") || die "could not open $dir/Features/rna/tbl";
20  open(FASTARNA,">$dir/Features/rna/fasta") || die "could not open $dir/Features/rna/fasta";  open(FASTARNA,">$dir/Features/rna/fasta") || die "could not open $dir/Features/rna/fasta";
21    
# Line 25  Line 25 
25      if ($contig =~ /\nACCESSION\s+(\S+)/s)      if ($contig =~ /\nACCESSION\s+(\S+)/s)
26      {      {
27          $id = $1;          $id = $1;
28            $idN = 1;
29            $idNr = 1;
30          if ($contig =~ /ORIGIN(.*)(\/\/|LOCUS)/s)          if ($contig =~ /ORIGIN(.*)(\/\/|LOCUS)/s)
31          {          {
32              $seq = $1;              $seq = $1;
# Line 43  Line 45 
45          while ($contig =~ /\n\s{4,6}CDS\s+([^\n]+(\n\s{20,22}\S[^\n]*)+)/gs)          while ($contig =~ /\n\s{4,6}CDS\s+([^\n]+(\n\s{20,22}\S[^\n]*)+)/gs)
46          {          {
47              $cds = $1;              $cds = $1;
48              &process_cds($id,\$cds,$prefix,\$idN,$contigs,\*TBLPEG,\*FASTAPEG,\*ASSIGNMENTS);              &process_cds($id,\$cds,$prefixP,\$idN,$contigs,\*TBLPEG,\*FASTAPEG,\*ASSIGNMENTS);
49          }          }
50    
51          while ($contig =~ /\n\s{3,6}[tr]RNA\s+([^\n]+(\n\s{20,22}\S[^\n]*)+)/gs)          while ($contig =~ /\n\s{3,6}[tr]RNA\s+([^\n]+(\n\s{20,22}\S[^\n]*)+)/gs)
# Line 61  Line 63 
63  close(FASTARNA);  close(FASTARNA);
64    
65  if (! -s "$dir/contigs")            { unlink("$dir/contigs"); print STDERR "no contigs in $dir\n"; }  if (! -s "$dir/contigs")            { unlink("$dir/contigs"); print STDERR "no contigs in $dir\n"; }
66  if (! -s "$dir/assigned_functions") { unlink("$dir/assigned_functions"); print STDERR "no assigned_functions in $dir }  if (! -s "$dir/assigned_functions") { unlink("$dir/assigned_functions"); print STDERR "no assigned_functions in $dir\n"; }
67  if (! -s "$dir/Features/peg/tbl")   { system "rm -rf $dir/Features/peg"; print STDERR "no PEGs in $dir }  if (! -s "$dir/Features/peg/tbl")   { system "rm -rf $dir/Features/peg"; print STDERR "no PEGs in $dir\n"; }
68  if (! -s "$dir/Features/rna/tbl")   { system "rm -rf $dir/Features/rna"; print STDERR "no RNAs in $dir }  if (! -s "$dir/Features/rna/tbl")   { system "rm -rf $dir/Features/rna"; print STDERR "no RNAs in $dir\n"; }
69    
70    
71  sub process_cds {  sub process_cds {

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3