[Bio] / Sprout / FeatureSaplingLoader.pm Repository:
ViewVC logotype

Diff of /Sprout/FeatureSaplingLoader.pm

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

revision 1.4, Tue Jun 30 19:53:01 2009 UTC revision 1.8, Wed Dec 16 01:45:19 2009 UTC
# Line 27  Line 27 
27      use HyperLink;      use HyperLink;
28      use AliasAnalysis;      use AliasAnalysis;
29      use LoaderUtils;      use LoaderUtils;
30        use Digest::MD5;
31      use base 'BaseSaplingLoader';      use base 'BaseSaplingLoader';
32    
33  =head1 Sapling Feature Load Group Class  =head1 Sapling Feature Load Group Class
# Line 138  Line 139 
139          my ($fid, $locationString, $aliases, $type, undef, undef, $assignment,          my ($fid, $locationString, $aliases, $type, undef, undef, $assignment,
140              $assignmentMaker, $quality) = @$feature;              $assignmentMaker, $quality) = @$feature;
141          $self->Track(Features => $fid, 1000);          $self->Track(Features => $fid, 1000);
142          # Fix the assignment for non-PEG features.          # Fix missing assignments. For RNAs, the assignment may be in the alias list.
143          if (! defined $assignment) {          if (! defined $assignment) {
144                if ($type eq 'rna') {
145              $assignment = $aliases;              $assignment = $aliases;
146              $assignmentMaker ||= 'master';              $assignmentMaker ||= 'master';
147                } else {
148                    $assignment = '';
149                }
150          }          }
151          # Convert the location string to a list of location objects.          # Convert the location string to a list of location objects.
152          my @locs = map { BasicLocation->new($_) } split /\s*,\s*/, $locationString;          my @locs = map { BasicLocation->new($_) } split /\s*,\s*/, $locationString;
# Line 214  Line 219 
219          my @essentials = $fig->get_attributes($fid, undef, ['essential', 'potential-essential']);          my @essentials = $fig->get_attributes($fid, undef, ['essential', 'potential-essential']);
220          for my $essentialTuple (@essentials) {          for my $essentialTuple (@essentials) {
221              my (undef, undef, $essentialityType, $url) = @$essentialTuple;              my (undef, undef, $essentialityType, $url) = @$essentialTuple;
222                # Only keep this datum if it has a URL. The ones without URLs are
223                # all duplicates.
224                if ($url) {
225              # Form a hyperlink from this essentiality tuple.              # Form a hyperlink from this essentiality tuple.
226              my $link = HyperLink->new($essentialityType, $url);              my $link = HyperLink->new($essentialityType, $url);
227              # Store it as essentiality data for this feature.              # Store it as essentiality data for this feature.
228              $self->PutE(FeatureEssential => $fid, essential => $link);              $self->PutE(FeatureEssential => $fid, essential => $link);
229          }          }
230            }
231          # If this is a PEG, we have a protein sequence.          # If this is a PEG, we have a protein sequence.
232          my $proteinID;          my $proteinID;
233          if ($type eq 'peg') {          if ($type eq 'peg') {
234              # Get the translation.              # Get the translation.
235              my $proteinSequence = $fig->get_translation($fid);              my $proteinSequence = $fig->get_translation($fid);
236                if (! $proteinSequence) {
237                    Trace("No protein sequence found for $fid.") if T(2);
238                    $self->Add(missingProtein => 1);
239                    # Here there was some sort of error and the protein sequence did
240                    # not come back. Ask for the DNA and translate it instead.
241                    my $dna = $fig->get_dna_seq($fid);
242                    $proteinSequence = FIG::translate($dna, undef, 1);
243                }
244              # Compute the ID.              # Compute the ID.
245              $proteinID = ERDB::DigestKey($proteinSequence);              $proteinID = $sapling->ProteinID($proteinSequence);
246              # Create the protein record.              # Create the protein record.
247              $self->PutE(ProteinSequence => $proteinID, sequence => $proteinSequence);              $self->PutE(ProteinSequence => $proteinID, sequence => $proteinSequence);
248              $self->PutR(IsProteinFor => $proteinID, $fid);              $self->PutR(IsProteinFor => $proteinID, $fid);
# Line 257  Line 274 
274              my $natural = AliasAnalysis::Type($aliasType => $aliasID) || $aliasID;              my $natural = AliasAnalysis::Type($aliasType => $aliasID) || $aliasID;
275              # Create the identifier record.              # Create the identifier record.
276              $self->PutE(Identifier => $aliasID, natural_form => $natural,              $self->PutE(Identifier => $aliasID, natural_form => $natural,
277                          source => $type);                          source => $aliasType);
278              # Is this a protein alias?              # Is this a protein alias?
279              if ($aliasConf eq 'C' && $proteinID) {              if ($aliasConf eq 'C' && $proteinID) {
280                  # Yes. Connect it using IsNamedBy.                  # Yes. Connect it using IsNamedBy.
# Line 271  Line 288 
288          $self->PutE(Identifier => $fid, natural_form => $fid,          $self->PutE(Identifier => $fid, natural_form => $fid,
289                      source => 'SEED');                      source => 'SEED');
290          $self->PutR(Identifies => $fid, $fid, conf => 'A');          $self->PutR(Identifies => $fid, $fid, conf => 'A');
         if ($proteinID) {  
             $self->PutR(IsNamedBy => $proteinID, $fid);  
         }  
291      }      }
292  }  }
293    

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3