[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.6, Sat Apr 9 17:21:15 2005 UTC revision 1.9, Sat Apr 9 23:42:32 2005 UTC
# Line 85  Line 85 
85  {  {
86      my($dbxref) = @_;      my($dbxref) = @_;
87    
88        # if it is not a valid xref just return it
89        return $dbxref unless (m/:/);
90    
91      my($type, $ref) = split(/:/, $dbxref, 2);      my($type, $ref) = split(/:/, $dbxref, 2);
92    
93      if ($type eq "NCBI_NP")      if ($type eq "NCBI_NP")
# Line 109  Line 112 
112          return "sp|$ref";          return "sp|$ref";
113      }      }
114    
115      return undef;      return $dbxref; # just return itself if we don't know what it is.
116  }  }
117    
118  package GFFWriter;  package GFFWriter;
# Line 693  Line 696 
696      }      }
697      elsif ($directive eq "sequence-region")      elsif ($directive eq "sequence-region")
698      {      {
699            $self->current_file->contigs($rest[0]);
700          $self->{contig_length_cache}->{$rest[0]}=$rest[2]-$rest[1];          $self->{contig_length_cache}->{$rest[0]}=$rest[2]-$rest[1];
701          $self->{contig_start_cache}->{$rest[0]}=$rest[1];          $self->{contig_start_cache}->{$rest[0]}=$rest[1];
702          $self->{contig_end_cache}->{$rest[0]}=$rest[2];          $self->{contig_end_cache}->{$rest[0]}=$rest[2];
# Line 765  Line 769 
769    
770          my @values = map { uri_unescape($_) } split(/,/, $value);          my @values = map { uri_unescape($_) } split(/,/, $value);
771    
772            # handle the aliases
773            if ($name eq "Alias") {
774             foreach my $val (@values)
775             {
776               $val = FigGFF::map_dbxref_to_seed_alias($val);
777             }
778            }
779    
780          #          #
781          # This might be a little goofy for the users, but we will use it          # This might be a little goofy for the users, but we will use it
782          # for now:          # for now:
# Line 864  Line 876 
876      my($self, $id, $data) = @_;      my($self, $id, $data) = @_;
877    
878      my $len = length($data);      my $len = length($data);
879      $self->current_file->set_fasta_data($id, $data);      $self->current_file->fasta_data($id, $data);
880  }  }
881    
882  package GFFFeature;  package GFFFeature;
# Line 1023  Line 1035 
1035      $self->{contig_checksum}->{$genome}->{$contig} = $md5sum;      $self->{contig_checksum}->{$genome}->{$contig} = $md5sum;
1036  }  }
1037    
1038    =head2 fasta_data()
1039    
1040    Get or set the fasta data. Given an id and some data will set the data for that id. Given an id will return the data for that id. Called without arguments will return a reference to a hash of sequences.
1041    
1042  sub set_fasta_data  This means that if you give it an id and sequence it will return that sequence. Hmmm.
1043    
1044    =cut
1045    
1046    sub fasta_data
1047  {  {
1048      my($self, $id, $data) = @_;      my($self, $id, $data) = @_;
1049        $id && $data && ($self->{fasta_data}->{$id} = $data);
1050      $self->{fasta_data}->{$id} = $data;      $id && return $self->{fasta_data}->{$id};
1051        return $self->{fasta_data};
1052  }  }
1053    
1054    
# Line 1041  Line 1061 
1061  sub contigs  sub contigs
1062  {  {
1063      my($self, $contig) = @_;      my($self, $contig) = @_;
1064        if ($contig && $contig =~ /\w\w\_\d+\.\d+/) {
1065          print STDERR "WARNING: $contig appears to have a version number. We should standardize on timming that somewhere\n";
1066        }
1067      $contig && (push @{$self->{contigs}}, $contig);      $contig && (push @{$self->{contigs}}, $contig);
     if (!$self->{contigs} && $self->{contig_length_cache}) {$self->{contigs} = keys %{$self->{contig_length_cache}}}  
1068      return $self->{contigs};      return $self->{contigs};
1069  }  }
1070    

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.9

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3