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

Diff of /Sprout/GenomeSproutLoader.pm

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

revision 1.3, Mon Mar 2 22:24:42 2009 UTC revision 1.4, Mon Mar 16 00:15:39 2009 UTC
# Line 58  Line 58 
58      # Get the parameters.      # Get the parameters.
59      my ($class, $erdb, $options) = @_;      my ($class, $erdb, $options) = @_;
60      # Create the table list.      # Create the table list.
61      my @tables = sort qw(Genome HasContig Contig IsMadeUpOf Sequence Host IsPathogenicIn);      my @tables = sort qw(Genome HasContig Contig IsMadeUpOf Sequence Host IsPathogenicIn
62                             IsRepresentativeOf);
63      # Create the BaseSproutLoader object.      # Create the BaseSproutLoader object.
64      my $retVal = BaseSproutLoader::new($class, $erdb, $options, @tables);      my $retVal = BaseSproutLoader::new($class, $erdb, $options, @tables);
65      # Return it.      # Return it.
# Line 96  Line 97 
97          if (! defined($version)) {          if (! defined($version)) {
98              $version = $genomeID;              $version = $genomeID;
99          }          }
100          # Open the NMPDR group file for this genome.          # Get the group hash and compute our group name.
101          my $group;          my $group;
102          if (open(TMP, "<$FIG_Config::organisms/$genomeID/NMPDR") &&          my $superGroup = $sprout->SuperGroup("$genus $species");
103              defined($group = <TMP>)) {          if (! $superGroup) {
104              # Clean the line ending.              # Here we have a supporting genome.
             chomp $group;  
         } else {  
             # No group, so use the default.  
105              $group = $FIG_Config::otherGroup;              $group = $FIG_Config::otherGroup;
106            } else {
107                # Now we have an NMPDR genome. Compute the group name. The group name
108                # is either "other XXXX" or "XXXX YYYY" where XXXX is the genus and
109                # YYYY is the species. The species is used if it's in the special-species
110                # list.
111                my %groupHash = $sprout->CheckGroupFile();
112                if (exists $groupHash{$superGroup}->{specials}->{$species}){
113                    $group = "$genus $species";
114                } else {
115                    $group = "other $genus";
116                }
117          }          }
         close TMP;  
118          # Get the version-numbered ID. If there is none, we just use the genome.          # Get the version-numbered ID. If there is none, we just use the genome.
119          my $genomeVersion = $fig->genome_version($genomeID) || $genomeID;          my $genomeVersion = $fig->genome_version($genomeID) || $genomeID;
120          # Get the contigs.          # Get the contigs.
# Line 151  Line 159 
159          my $pathogenic = ERDBTypeSemiBoolean::ComputeFromString($attributes{Pathogenic});          my $pathogenic = ERDBTypeSemiBoolean::ComputeFromString($attributes{Pathogenic});
160          my $salinity = $attributes{Salinity} || "unknown";          my $salinity = $attributes{Salinity} || "unknown";
161          my $habitat = $attributes{Habitat} || "unknown";          my $habitat = $attributes{Habitat} || "unknown";
162            # We need to find the representative genome. That's not simple, because the
163            # representative has to be one of ours, and the SEED rep may not be.
164            # To solve this problem, we read in the entire genome set file. For each
165            # set, we stash the first eligible genome in a hash, and when we find
166            # our genome, we'll get the saved representative.
167            my (%repHash, $repGenome);
168            my %eligibleGenomes = map { $_ => 1 } BaseSproutLoader::GetSectionList($sprout, $fig);
169            my $ih = Open(undef, "<$FIG_Config::data/Global/genome.sets");
170            while (! eof $ih && ! defined $repGenome) {
171                my ($set, $member) = Tracer::GetLine($ih);
172                # Only process our genomes.
173                if ($eligibleGenomes{$member}) {
174                    # If this is the first eligible genome for the set, remember it.
175                    if (! exists $repHash{$set}) {
176                        $repHash{$set} = $member;
177                    }
178                    # If this is our genome, we're done.
179                    if ($member eq $genomeID) {
180                        $repGenome = $repHash{$set};
181                    }
182                }
183            }
184            close $ih;
185            # If we found a representative, save it.
186            if (defined $repGenome) {
187                $self->PutR(IsRepresentativeOf => $repGenome, $genomeID);
188            }
189          # Now we loop through each of the genome's contigs. While doing so, we'll          # Now we loop through each of the genome's contigs. While doing so, we'll
190          # track the GC content and DNA size.          # track the GC content and DNA size.
191          my $gc_content = 0;          my $gc_content = 0;

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3