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

Diff of /Sprout/SproutLoad.pm

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

revision 1.42, Sun Jun 18 05:49:28 2006 UTC revision 1.43, Sun Jun 25 07:34:46 2006 UTC
# Line 1396  Line 1396 
1396      return $retVal;      return $retVal;
1397  }  }
1398    
1399    =head3 LoadSynonymData
1400    
1401    C<< my $stats = $spl->LoadSynonymData(); >>
1402    
1403    Load the synonym groups into Sprout.
1404    
1405    The following relations are loaded by this method.
1406    
1407        SynonymGroup
1408        IsSynonymGroupFor
1409    
1410    The source information for these relations is taken from the C<maps_to_id> method
1411    of the B<FIG> object. The process starts from the features, so it is possible
1412    that there will be duplicates in the SynonymGroup load file, since the relationship
1413    is one-to-many toward the features. The automatic sort on primary entity relations
1414    will fix this for us.
1415    
1416    =over 4
1417    
1418    =item RETURNS
1419    
1420    Returns a statistics object for the loads.
1421    
1422    =back
1423    
1424    =cut
1425    #: Return Type $%;
1426    sub LoadSynonymData {
1427        # Get this object instance.
1428        my ($self) = @_;
1429        # Get the FIG object.
1430        my $fig = $self->{fig};
1431        # Get the genome hash.
1432        my $genomeHash = $self->{genomes};
1433        # Create a load object for the table we're loading.
1434        my $loadSynonymGroup = $self->_TableLoader('SynonymGroup');
1435        my $loadIsSynonymGroupFor = $self->_TableLoader('IsSynonymGroupFor');
1436        if ($self->{options}->{loadOnly}) {
1437            Trace("Loading from existing files.") if T(2);
1438        } else {
1439            Trace("Generating synonym group data.") if T(2);
1440            # Loop through the genomes.
1441            for my $genomeID (keys %{$genomeHash}) {
1442                Trace("Processing $genomeID.") if T(3);
1443                # Get all of the features for this genome. The only method that does this is
1444                # all_features_detailed, which returns extra baggage that we discard.
1445                my @fids = map { $_->[0] } $fig->all_features_detailed($genomeID);
1446                # Loop through the feature IDs.
1447                for my $fid (@fids) {
1448                    # Get the group for this feature.
1449                    my $synonym = $fig->maps_to_id($fid);
1450                    # Only proceed if the synonym is a real group.
1451                    if ($synonym ne $fid) {
1452                        $loadSynonymGroup->Put($synonym);
1453                        $loadIsSynonymGroupFor->Put($synonym, $fid);
1454                    }
1455                }
1456            }
1457        }
1458        # Finish the load.
1459        my $retVal = $self->_FinishAll();
1460        return $retVal;
1461    }
1462    
1463    
1464  =head2 Internal Utility Methods  =head2 Internal Utility Methods
1465    
1466  =head3 TableLoader  =head3 TableLoader

Legend:
Removed from v.1.42  
changed lines
  Added in v.1.43

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3