[Bioperl-guts-l] [14514] bioperl-live/trunk/Bio/SeqIO/embl.pm: Reindenting the code.

Heikki Lehvaslaiho heikki at dev.open-bio.org
Tue Feb 19 01:57:11 EST 2008


Revision: 14514
Author:   heikki
Date:     2008-02-19 01:57:11 -0500 (Tue, 19 Feb 2008)

Log Message:
-----------
Reindenting the code. Too many lines were slightly off making reading difficult. No code changes.

Modified Paths:
--------------
    bioperl-live/trunk/Bio/SeqIO/embl.pm

Modified: bioperl-live/trunk/Bio/SeqIO/embl.pm
===================================================================
--- bioperl-live/trunk/Bio/SeqIO/embl.pm	2008-02-19 02:31:23 UTC (rev 14513)
+++ bioperl-live/trunk/Bio/SeqIO/embl.pm	2008-02-19 06:57:11 UTC (rev 14514)
@@ -120,35 +120,36 @@
 use base qw(Bio::SeqIO);
 
 %FTQUAL_NO_QUOTE=(
-  'anticodon'=>1,
-  'citation'=>1,
-  'codon'=>1,
-  'codon_start'=>1,
-  'cons_splice'=>1,
-  'direction'=>1,
-  'evidence'=>1,
-  'label'=>1,
-  'mod_base'=> 1,
-  'number'=> 1,
-  'rpt_type'=> 1,
-  'rpt_unit'=> 1,
-  'transl_except'=> 1,
-  'transl_table'=> 1,
-  'usedin'=> 1,
-);
+                  'anticodon'=>1,
+                  'citation'=>1,
+                  'codon'=>1,
+                  'codon_start'=>1,
+                  'cons_splice'=>1,
+                  'direction'=>1,
+                  'evidence'=>1,
+                  'label'=>1,
+                  'mod_base'=> 1,
+                  'number'=> 1,
+                  'rpt_type'=> 1,
+                  'rpt_unit'=> 1,
+                  'transl_except'=> 1,
+                  'transl_table'=> 1,
+                  'usedin'=> 1,
+                 );
 
 sub _initialize {
-  my($self, at args) = @_;
+    my($self, at args) = @_;
 
-  $self->SUPER::_initialize(@args);
-  # hash for functions for decoding keys.
-  $self->{'_func_ftunit_hash'} = {};
-  $self->_show_dna(1); # sets this to one by default. People can change it
-  if( ! defined $self->sequence_factory ) {
-      $self->sequence_factory(Bio::Seq::SeqFactory->new
-			      (-verbose => $self->verbose(),
-			       -type => 'Bio::Seq::RichSeq'));
-  }
+    $self->SUPER::_initialize(@args);
+    # hash for functions for decoding keys.
+    $self->{'_func_ftunit_hash'} = {};
+    # sets this to one by default. People can change it
+    $self->_show_dna(1);
+    if ( ! defined $self->sequence_factory ) {
+        $self->sequence_factory(Bio::Seq::SeqFactory->new
+                                (-verbose => $self->verbose(),
+                                 -type => 'Bio::Seq::RichSeq'));
+    }
 }
 
 =head2 next_seq
@@ -167,17 +168,17 @@
         $date, $comment, @date_arr);
 
     my ($annotation, %params, @features) =
-       Bio::Annotation::Collection->new();
+        Bio::Annotation::Collection->new();
 
     $line = $self->_readline;
     # This needs to be before the first eof() test
 
-    if( !defined $line ) {
-        return; # no throws - end of file
+    if ( !defined $line ) {
+        return;                 # no throws - end of file
     }
 
-    if( $line =~ /^\s+$/ ) {
-        while( defined ($line = $self->_readline) ) {
+    if ( $line =~ /^\s+$/ ) {
+        while ( defined ($line = $self->_readline) ) {
             $line =~/^\S/ && last;
         }
         # return without error if the whole next sequence was just a single
@@ -187,18 +188,18 @@
 
     # no ID as 1st non-blank line, need short circuit and exit routine
     $self->throw("EMBL stream with no ID. Not embl in my book")
-       unless $line =~ /^ID\s+\S+/;
+        unless $line =~ /^ID\s+\S+/;
 
-	# At this point we are sure that $line contains an ID header line
-	my $alphabet;
-    if ( $line =~ tr/;/;/ == 6) {   # New style headers contain exactly six semicolons.
+    # At this point we are sure that $line contains an ID header line
+    my $alphabet;
+    if ( $line =~ tr/;/;/ == 6) { # New style headers contain exactly six semicolons.
 
     	# New style header (EMBL Release >= 87, after June 2006)
     	my $topology;
     	my $sv;
 
     	# ID   DQ299383; SV 1; linear; mRNA; STD; MAM; 431 BP.
-		# This regexp comes from the new2old.pl conversion script, from EBI
+        # This regexp comes from the new2old.pl conversion script, from EBI
     	$line =~ m/^ID   (\w+);\s+SV (\d+); (\w+); ([^;]+); (\w{3}); (\w{3}); (\d+) BP./;
     	($name, $sv, $topology, $mol, $div) = ($1, $2, $3, $4, $6);
 
@@ -214,21 +215,18 @@
 	if (defined $mol ) {
 	    if ($mol =~ /DNA/) {
 		$alphabet='dna';
-	    }
-	    elsif ($mol =~ /RNA/) {
+	    } elsif ($mol =~ /RNA/) {
 		$alphabet='rna';
-	    }
-	    elsif ($mol =~ /AA/) {
+	    } elsif ($mol =~ /AA/) {
 		$alphabet='protein';
 	    }
 	}
-    }
-    else {
+    } else {
 	
     	# Old style header (EMBL Release < 87, before June 2006)
     	($name, $mol, $div) = ($line =~ /^ID\s+(\S+)[^;]*;\s+(\S+)[^;]*;\s+(\S+)[^;]*;/);
 	
-	if($mol) {
+	if ($mol) {
 	    if ( $mol =~ /circular/ ) {
 		$params{'-is_circular'} = 1;
 		$mol =~  s|circular ||;
@@ -236,11 +234,9 @@
 	    if (defined $mol ) {
 		if ($mol =~ /DNA/) {
 		    $alphabet='dna';
-		}
-		elsif ($mol =~ /RNA/) {
+		} elsif ($mol =~ /RNA/) {
 		    $alphabet='rna';
-		}
-		elsif ($mol =~ /AA/) {
+		} elsif ($mol =~ /AA/) {
 		    $alphabet='protein';
 		}
 	    }
@@ -251,194 +247,193 @@
 	$name = "unknown_id";
     }
 
-	# $self->warn("not parsing upper annotation in EMBL file yet!");
-   my $buffer = $line;
+    # $self->warn("not parsing upper annotation in EMBL file yet!");
+    my $buffer = $line;
     local $_;
     BEFORE_FEATURE_TABLE :
-	until( !defined $buffer ) {
-	    $_ = $buffer;
-	    # Exit at start of Feature table
-	    if( /^(F[HT]|SQ)/ ) {
-		$self->_pushback($_) if( $1 eq 'SQ' || $1 eq 'FT');
-		last;
-	    }
-	    # Description line(s)
-	    if (/^DE\s+(\S.*\S)/) {
-		$desc .= $desc ? " $1" : $1;
-	    }
+          until ( !defined $buffer ) {
+              $_ = $buffer;
+              # Exit at start of Feature table
+              if ( /^(F[HT]|SQ)/ ) {
+                  $self->_pushback($_) if( $1 eq 'SQ' || $1 eq 'FT');
+                  last;
+              }
+              # Description line(s)
+              if (/^DE\s+(\S.*\S)/) {
+                  $desc .= $desc ? " $1" : $1;
+              }
 
-	    #accession number
-	    if( /^AC\s+(.*)?/ ) {
-		my @accs = split(/[; ]+/, $1); # allow space in addition
-		$params{'-accession_number'} = shift @accs
-		    unless defined $params{'-accession_number'};
-		push @{$params{'-secondary_accessions'}}, @accs;
-	    }
+              #accession number
+              if ( /^AC\s+(.*)?/ ) {
+                  my @accs = split(/[; ]+/, $1); # allow space in addition
+                  $params{'-accession_number'} = shift @accs
+                      unless defined $params{'-accession_number'};
+                  push @{$params{'-secondary_accessions'}}, @accs;
+              }
 
-	    #version number
-	    if( /^SV\s+\S+\.(\d+);?/ ) {
-		my $sv = $1;
-		#$sv =~ s/\;//;
-		$params{'-seq_version'} = $sv;
-		$params{'-version'} = $sv;
-	    }
+              #version number
+              if ( /^SV\s+\S+\.(\d+);?/ ) {
+                  my $sv = $1;
+                  #$sv =~ s/\;//;
+                  $params{'-seq_version'} = $sv;
+                  $params{'-version'} = $sv;
+              }
 
-	    #date (NOTE: takes last date line)
-	    if( /^DT\s+(.+)$/ ) {
-		my $line = $1;
-		my ($date, $version) = split(' ', $line, 2);
-		$date =~ tr/,//d; # remove comma if new version
-		if ($version =~ /\(Rel\. (\d+), Created\)/xms ) {
-                    my $release = Bio::Annotation::SimpleValue->new(
-								    -tagname    => 'creation_release',
-								    -value      => $1
-								    );
-                    $annotation->add_Annotation($release);
-		} elsif ($version =~ /\(Rel\. (\d+), Last updated, Version (\d+)\)/xms ) {
-                    my $release = Bio::Annotation::SimpleValue->new(
-								    -tagname    => 'update_release',
-								    -value      => $1
-								    );
-                    $annotation->add_Annotation($release);
+              #date (NOTE: takes last date line)
+              if ( /^DT\s+(.+)$/ ) {
+                  my $line = $1;
+                  my ($date, $version) = split(' ', $line, 2);
+                  $date =~ tr/,//d; # remove comma if new version
+                  if ($version =~ /\(Rel\. (\d+), Created\)/xms ) {
+                      my $release = Bio::Annotation::SimpleValue->new(
+                                                                      -tagname    => 'creation_release',
+                                                                      -value      => $1
+                                                                     );
+                      $annotation->add_Annotation($release);
+                  } elsif ($version =~ /\(Rel\. (\d+), Last updated, Version (\d+)\)/xms ) {
+                      my $release = Bio::Annotation::SimpleValue->new(
+                                                                      -tagname    => 'update_release',
+                                                                      -value      => $1
+                                                                     );
+                      $annotation->add_Annotation($release);
 
-                    my $update = Bio::Annotation::SimpleValue->new(
-								   -tagname    => 'update_version',
-								   -value      => $2
-								   );
-                    $annotation->add_Annotation($update);
-		}
-		push @{$params{'-dates'}}, $date;
-	    }
+                      my $update = Bio::Annotation::SimpleValue->new(
+                                                                     -tagname    => 'update_version',
+                                                                     -value      => $2
+                                                                    );
+                      $annotation->add_Annotation($update);
+                  }
+                  push @{$params{'-dates'}}, $date;
+              }
 
-	    #keywords
-	    if( /^KW   (.*)\S*$/ ) {
-		my @kw = split(/\s*\;\s*/,$1);
-		push @{$params{'-keywords'}}, @kw;
-	    }
+              #keywords
+              if ( /^KW   (.*)\S*$/ ) {
+                  my @kw = split(/\s*\;\s*/,$1);
+                  push @{$params{'-keywords'}}, @kw;
+              }
 
-	    # Organism name and phylogenetic information
-	    elsif (/^O[SC]/) {
-		# pass the accession number so we can give an informative throw message if necessary
-		my $species = $self->_read_EMBL_Species(\$buffer, $params{'-accession_number'});
-		$params{'-species'}= $species;
-	    }
+              # Organism name and phylogenetic information
+              elsif (/^O[SC]/) {

@@ Diff output truncated at 10000 characters. @@



More information about the Bioperl-guts-l mailing list