[Bio] / FigKernelPackages / FigGFF.pm Repository:
ViewVC logotype

Diff of /FigKernelPackages/FigGFF.pm

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

revision 1.8, Sat Apr 9 21:09:30 2005 UTC revision 1.12, Fri Apr 29 20:48:51 2005 UTC
# Line 617  Line 617 
617          }          }
618          elsif (/^\#\#FASTA/)          elsif (/^\#\#FASTA/)
619          {          {
620              print "Got fasta directive\n";              # print "Got fasta directive\n";
621              $_ = <$fh>;              $_ = <$fh>;
622              chomp;              chomp;
623              $self->parse_fasta($fh, $_);              $self->parse_fasta($fh, $_);
# Line 673  Line 673 
673      my($self, $directive, $rest) = @_;      my($self, $directive, $rest) = @_;
674    
675      $directive = lc($directive);      $directive = lc($directive);
676      my @rest=split /\t/, $rest;      # this should catch both #seed and ##seed :-)
677        if ($directive eq "seed")
     if ($directive eq "genome")  
     {  
         $self->current_file->genome_id($rest[0]);  
         $self->current_file->genome_name($rest[1]);  
     }  
     elsif ($directive eq "genome_md5")  
678      {      {
679          $self->current_file->set_genome_checksum(@rest[0,1]);        return $self->parse_seed_directive($rest);
680      }      }
681      elsif ($directive eq "origin")  
682        my @rest=split /\t/, $rest;
683    
684        # removed genome, genome_md5, origin, taxnomy as they are not real gff directives. These are in seed_directives below
685        if ($directive eq "project")
686      {      {
687          print STDERR "We have a directive called origin but this should be changed as it will conflict with NCBI's ORIGIN indicating beginning of the sequence\n";          # I am not sure if PROJECT is a seed directive or a GFF directive
         print STDERR "At the moment ORIGIN is returned by \$feat->project\n";  
688          $self->current_file->project($rest[0]);          $self->current_file->project($rest[0]);
689      }      }
     elsif ($directive eq "taxonomy")  
     {  
         $self->current_file->taxonomy($rest);  
     }  
690      elsif ($directive eq "sequence-region")      elsif ($directive eq "sequence-region")
691      {      {
692          $self->current_file->contigs($rest[0]);          $self->current_file->contigs($rest[0]);
# Line 703  Line 696 
696      }      }
697      else      else
698      {      {
699          print "Have gff3 directive '$directive' rest='$rest'\n";          print STDERR "Have gff3 directive '$directive' rest='$rest'\n";
700      }      }
701    
702  }  }
# Line 715  Line 708 
708      my($verb, @rest) = split(/\t/, $rest);      my($verb, @rest) = split(/\t/, $rest);
709    
710      # are we case sensitive? I don't think so      # are we case sensitive? I don't think so
711      $verb-lc($verb);      $verb=lc($verb);
712    
713      if ($verb eq "anno_start")      if ($verb eq "genome_id")
714        {
715            $self->current_file->genome_id($rest[0]);
716        }
717        elsif ($verb eq "name")
718        {
719            $self->current_file->genome_name($rest[0]);
720        }
721        elsif ($verb eq "genome_md5")
722        {
723            $self->current_file->set_genome_checksum($rest[0]);
724        }
725        elsif ($verb eq "project")
726        {
727            # I am not sure if PROJECT is a seed directive or a GFF directive
728            $self->current_file->project($rest[0]);
729        }
730        elsif ($verb eq "taxonomy")
731        {
732            $self->current_file->taxonomy($rest[0]);
733        }
734        elsif ($verb eq "taxon_id")
735        {
736            $self->current_file->taxon_id($rest[0]);
737        }
738        elsif ($verb eq "anno_start")
739      {      {
740          $self->current_file->anno_start($rest[0]);          $self->current_file->anno_start($rest[0]);
741      }      }
# Line 735  Line 753 
753  {  {
754      my($self, $directive, $rest) = @_;      my($self, $directive, $rest) = @_;
755    
756      print "Have local directive '$directive' rest='$rest'\n";      print STDERR "Have local directive '$directive' rest='$rest'\n";
757  }  }
758    
759  sub parse_feature  sub parse_feature
# Line 889  Line 907 
907    
908  map { $GFF_Tags{$_} = 1 } @GFF_Tags;  map { $GFF_Tags{$_} = 1 } @GFF_Tags;
909    
910  __PACKAGE__->mk_accessors(qw(fig seqid source type start end score strand phase attributes genome fig_id),  __PACKAGE__->mk_accessors(qw(fig seqid source type start end score strand phase attributes
911                                 genome fig_id),
912                            @GFF_Tags);                            @GFF_Tags);
913    
914    
# Line 968  Line 987 
987  use strict;  use strict;
988  use base qw(Class::Accessor);  use base qw(Class::Accessor);
989    
990  __PACKAGE__->mk_accessors(qw(fig filename features feature_index anno_start anno_end));  __PACKAGE__->mk_accessors(qw(fig filename features feature_index anno_start anno_end taxon_id genome_id));
991    
992  #  #
993  # Package to hold the contents of a GFF file, and to hold the code  # Package to hold the contents of a GFF file, and to hold the code
# Line 986  Line 1005 
1005          features => [],          features => [],
1006          contigs  => [],          contigs  => [],
1007          feature_index => {},          feature_index => {},
1008          genome_checksum => {},          genome_checksum => '',
1009          contig_checksum => {},          contig_checksum => {},
1010          features_by_genome => {},          features_by_genome => {},
1011      };      };
# Line 1011  Line 1030 
1030    
1031  sub genome_checksum  sub genome_checksum
1032  {  {
     my($self, $genome) = @_;  
   
     return $self->{genome_checksum}->{$genome};  
 }  
   
 sub genome_checksums  
 {  
1033      my($self) = @_;      my($self) = @_;
1034    
1035      return [map { [$_, $self->{genome_checksum}->{$_}] } keys(%{$self->{genome_checksum}})];      return $self->{genome_checksum};
1036  }  }
1037    
1038  sub set_genome_checksum  sub set_genome_checksum
1039  {  {
1040      my($self, $genome, $md5sum) = @_;      my($self, $md5sum) = @_;
1041      $self->{genome_checksum}->{$genome} = $md5sum;      $self->{genome_checksum} = $md5sum;
1042  }  }
1043    
1044  sub set_contig_checksum  sub set_contig_checksum
# Line 1061  Line 1073 
1073  sub contigs  sub contigs
1074  {  {
1075      my($self, $contig) = @_;      my($self, $contig) = @_;
1076        if ($contig && $contig =~ /\w\w\_\d+\.\d+/) {
1077          print STDERR "WARNING: $contig appears to have a version number. We should standardize on timming that somewhere\n";
1078        }
1079      $contig && (push @{$self->{contigs}}, $contig);      $contig && (push @{$self->{contigs}}, $contig);
1080      return $self->{contigs};      return $self->{contigs};
1081  }  }

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.12

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3