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

Diff of /Sprout/FeatureSproutLoader.pm

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

revision 1.5, Fri Oct 17 16:48:32 2008 UTC revision 1.6, Mon Jan 19 21:46:21 2009 UTC
# Line 24  Line 24 
24      use ERDB;      use ERDB;
25      use BioWords;      use BioWords;
26      use AliasAnalysis;      use AliasAnalysis;
27        use DBMaster;
28        use HyperLink;
29        use FFs;
30      use base 'BaseSproutLoader';      use base 'BaseSproutLoader';
31    
32  =head1 Sprout Feature Load Group Class  =head1 Sprout Feature Load Group Class
# Line 44  Line 47 
47    
48  [[SproutPm]] object for the database being loaded.  [[SproutPm]] object for the database being loaded.
49    
 =item source  
   
 [[FigPm]] object used to access the source data. If this parameter is undefined,  
 it will be created the first time the L</source> method is called.  
   
50  =item options  =item options
51    
52  Reference to a hash of command-line options.  Reference to a hash of command-line options.
# Line 63  Line 61 
61    
62  sub new {  sub new {
63      # Get the parameters.      # Get the parameters.
64      my ($class, $erdb, $source, $options) = @_;      my ($class, $erdb, $options) = @_;
65      # Create the table list.      # Create the table list.
66      my @tables = sort qw(Feature IsLocatedIn FeatureAlias IsAliasOf FeatureLink      my @tables = sort qw(Feature IsLocatedIn FeatureAlias IsAliasOf FeatureLink
67                           FeatureTranslation FeatureUpstream HasFeature HasRoleInSubsystem                           FeatureTranslation FeatureUpstream HasFeature HasRoleInSubsystem
68                           FeatureEssential FeatureVirulent FeatureIEDB CDD IsPresentOnProteinOf                           FeatureEssential FeatureVirulent FeatureIEDB CDD IsPresentOnProteinOf
69                           CellLocation IsPossiblePlaceFor IsAlsoFoundIn ExternalDatabase Keyword);                           CellLocation IsPossiblePlaceFor IsAlsoFoundIn ExternalDatabase Keyword
70                             ProteinFamily IsFamilyForFeature ProteinFamilyName FeatureEC);
71      # Create the BaseSproutLoader object.      # Create the BaseSproutLoader object.
72      my $retVal = BaseSproutLoader::new($class, $erdb, $source, $options, @tables);      my $retVal = BaseSproutLoader::new($class, $erdb, $options, @tables);
73      # Get the list of relevant attributes.      # Get the list of relevant attributes.
74      # Bless and return it.      # Bless and return it.
75      bless $retVal, $class;      bless $retVal, $class;
# Line 98  Line 97 
97      my $subHash = $self->GetSubsystems();      my $subHash = $self->GetSubsystems();
98      # Get the word stemmer.      # Get the word stemmer.
99      my $stemmer = $sprout->GetStemmer();      my $stemmer = $sprout->GetStemmer();
100        # Get access to FIGfams.
101        my $figfam_data = &FIG::get_figfams_data();
102        my $ffs = new FFs($figfam_data);
103      # Only proceed if this is not the global section.      # Only proceed if this is not the global section.
104      if (! $self->global()) {      if (! $self->global()) {
105          # Get the section ID.          # Get the section ID.
106          my $genomeID = $self->section();          my $genomeID = $self->section();
107            # Connect to the ontology database.
108            my $sqlite_db = "/home/mkubal/Temp/Ontology/ontology.sqlite";
109            my $ontology_dbmaster = DBMaster->new(-database => $sqlite_db, -backend => 'SQLite');
110          # Get the maximum sequence size. We need this later for splitting up the          # Get the maximum sequence size. We need this later for splitting up the
111          # locations.          # locations.
112          my $chunkSize = $sprout->MaxSegment();          my $chunkSize = $sprout->MaxSegment();
# Line 113  Line 118 
118          my $count = scalar @featureTuples;          my $count = scalar @featureTuples;
119          Trace("$count features found for genome $genomeID.") if T(ERDBLoadGroup => 3);          Trace("$count features found for genome $genomeID.") if T(ERDBLoadGroup => 3);
120          # Get the attributes for this genome and put them in a hash by feature ID.          # Get the attributes for this genome and put them in a hash by feature ID.
121          my $attributes = $self->GetGenomeAttributes($genomeID);          my $attributes = $self->GetGenomeAttributes($genomeID, \@featureTuples);
122          Trace("Looping through features for $genomeID.") if T(ERDBLoadGroup => 3);          Trace("Looping through features for $genomeID.") if T(ERDBLoadGroup => 3);
123          # Loop through the features.          # Loop through the features.
124          for my $featureTuple (@featureTuples) {          for my $featureTuple (@featureTuples) {
# Line 136  Line 141 
141                  if (! defined($quality) || $quality eq "") {                  if (! defined($quality) || $quality eq "") {
142                      $quality = " ";                      $quality = " ";
143                  }                  }
144                    # Get the coupling count. The coupled features are returned as a list,
145                    # and we store it as a scalar to get the count.
146                    my $couplingCount = $fig->coupled_to($featureID);
147                  # Begin building the keywords. We start with the genome ID, the                  # Begin building the keywords. We start with the genome ID, the
148                  # feature ID, the taxonomy, and the organism name.                  # feature ID, the taxonomy, and the organism name.
149                  my @keywords = ($genomeID, $featureID, $fig->genus_species($genomeID),                  my @keywords = ($genomeID, $featureID, $fig->genus_species($genomeID),
# Line 143  Line 151 
151                  # Create the aliases.                  # Create the aliases.
152                  for my $alias (split /,/, $aliases) {                  for my $alias (split /,/, $aliases) {
153                      # Connect this alias to this feature and make an Alias record for it.                      # Connect this alias to this feature and make an Alias record for it.
154                      $self->Put('IsAliasOf', 'from-link' => $alias, 'to-link' => $featureID);                      $self->PutR(IsAliasOf => $alias, $featureID);
155                      $self->Put('FeatureAlias', id => $alias);                      $self->PutE(FeatureAlias => $alias);
156                      # Add it to the keyword list.                      # Add it to the keyword list.
157                      push @keywords, $alias;                      push @keywords, $alias;
158                      # If this is a locus tag, also add its natural form as a keyword.                      # If this is a locus tag, also add its natural form as a keyword.
# Line 157  Line 165 
165                  my @corresponders = $fig->get_corresponding_ids($featureID, 1);                  my @corresponders = $fig->get_corresponding_ids($featureID, 1);
166                  for my $tuple (@corresponders) {                  for my $tuple (@corresponders) {
167                      my ($id, $xdb) = @{$tuple};                      my ($id, $xdb) = @{$tuple};
168                      # Ignore SEED: that's us.                      # Ignore SEED: that's us. Also ignore contig IDs. Those are due to a bug.
169                      if ($xdb ne 'SEED') {                      if ($xdb ne 'SEED' && ! ($xdb eq 'RefSeq' && $id =~ /^[A-Z][A-Z]_\d+$/)) {
170                          # Connect this ID to the feature and mark its database.                          # Connect this ID to the feature and mark its database.
171                          $self->Put('IsAlsoFoundIn', 'from-link' => $featureID, 'to-link' => $xdb,                          $self->PutR(IsAlsoFoundIn => $featureID, $xdb,
172                                     alias => $id);                                     alias => $id);
173                          $self->Put('ExternalDatabase', id => $xdb);                          $self->PutE(ExternalDatabase => $xdb);
174                          # Add it as a keyword.                          # Add it as a keyword and an alias.
175                          push @keywords, $id;                          push @keywords, $id;
176                            $self->PutR(IsAliasOf => $id, $featureID);
177                            $self->PutE(FeatureAlias => $id);
178                      }                      }
179                  }                  }
180                  Trace("Assignment for $featureID is: $assignment") if T(ERDBLoadGroup => 4);                  Trace("Assignment for $featureID is: $assignment") if T(ERDBLoadGroup => 4);
# Line 172  Line 182 
182                  # keyword list.                  # keyword list.
183                  push @keywords, split(/\s+/, $assignment);                  push @keywords, split(/\s+/, $assignment);
184                  # Add any EC numbers.                  # Add any EC numbers.
185                  push @keywords, BioWords::ExtractECs($assignment);                  my @ecs = BioWords::ExtractECs($assignment);
186                    for my $ec (@ecs) {
187                        push @keywords, $ec;
188                        $self->PutE(FeatureEC => $featureID, ec => $ec);
189                    }
190                  # Link this feature to the parent genome.                  # Link this feature to the parent genome.
191                  $self->Put('HasFeature', 'from-link' => $genomeID, 'to-link' => $featureID,                  $self->PutR(HasFeature => $genomeID, $featureID,
192                             type => $type);                             type => $type);
193                  # Get the links.                  # Get the links.
194                  my @links = $fig->fid_links($featureID);                  my @links = $fig->fid_links($featureID);
195                  for my $link (@links) {                  for my $link (@links) {
196                      $self->Put('FeatureLink', id => $featureID, link => $link);                      $self->PutE(FeatureLink => $featureID, link => $link);
197                  }                  }
198                  # If this is a peg, generate the translation and the upstream.                  # If this is a peg, generate the translation and the upstream.
199                  if ($type eq 'peg') {                  if ($type eq 'peg') {
200                      $self->Add(pegIn => 1);                      $self->Add(pegIn => 1);
201                      my $translation = $fig->get_translation($featureID);                      my $translation = $fig->get_translation($featureID);
202                      if ($translation) {                      if ($translation) {
203                          $self->Put('FeatureTranslation', id => $featureID,                          $self->PutE(FeatureTranslation => $featureID,
204                                     translation => $translation);                                     translation => $translation);
205                      }                      }
206                      # We use the default upstream values of u=200 and c=100.                      # We use the default upstream values of u=200 and c=100.
207                      my $upstream = $fig->upstream_of($featureID, 200, 100);                      my $upstream = $fig->upstream_of($featureID, 200, 100);
208                      if ($upstream) {                      if ($upstream) {
209                          $self->Put('FeatureUpstream', id => $featureID,                          $self->PutE(FeatureUpstream => $featureID,
210                                     'upstream-sequence' => $upstream);                                     'upstream-sequence' => $upstream);
211                      }                      }
212                  }                  }
# Line 208  Line 222 
222                          # If this is the first time we've seen this subsystem for                          # If this is the first time we've seen this subsystem for
223                          # this peg, store the has-role link.                          # this peg, store the has-role link.
224                          if (! $seen{$subsystem}) {                          if (! $seen{$subsystem}) {
225                              $self->Put('HasRoleInSubsystem', 'from-link' => $featureID,                              $self->PutR(HasRoleInSubsystem => $featureID, $subsystem,
226                                         'to-link' => $subsystem, genome => $genomeID,                                          genome => $genomeID, type => $type);
                                        type => $type);  
227                              # Save the subsystem's keywords.                              # Save the subsystem's keywords.
228                              push @keywords, split /[\s_]+/, $subsystem;                              push @keywords, split /[\s_]+/, $subsystem;
229                          }                          }
# Line 230  Line 243 
243                  # data that we build next. If the special attribute is non-empty,                  # data that we build next. If the special attribute is non-empty,
244                  # its name will be added to the keyword list. First, we get all                  # its name will be added to the keyword list. First, we get all
245                  # the attributes for this feature. They will come back as                  # the attributes for this feature. They will come back as
246                  # 4-tuples: [peg, name, value, URL]. We use a 3-tuple instead:                  # 4-tuples: [peg, name, value, URL].
247                  # [name, value, value with URL]. (We don't need the PEG, since                  my @attributes = @{$attributes->{$featureID}};
                 # we already know it.)  
                 my @attributes = map { [$_->[1], $_->[2], Tracer::CombineURL($_->[2], $_->[3])] }  
                                      @{$attributes->{$featureID}};  
248                  # Now we process each of the special attributes.                  # Now we process each of the special attributes.
249                  if ($self->SpecialAttribute($featureID, \@attributes,                  if ($self->SpecialAttribute($featureID, \@attributes,
250                                       1, [0,2], '^(essential|potential_essential)$',                                       2, [1,3], '^(essential|potential_essential)$',
251                                       qw(FeatureEssential essential))) {                                       qw(FeatureEssential essential))) {
252                      push @keywords, 'essential';                      push @keywords, 'essential';
253                      $self->Add(essential => 1);                      $self->Add(essential => 1);
254                  }                  }
255                  if ($self->SpecialAttribute($featureID, \@attributes,                  if ($self->SpecialAttribute($featureID, \@attributes,
256                                       0, [2], '^virulen',                                       1, [2,3], '^virulen',
257                                       qw(FeatureVirulent virulent))) {                                       qw(FeatureVirulent virulent))) {
258                      push @keywords, 'virulent';                      push @keywords, 'virulent';
259                      $self->Add(virulent => 1);                      $self->Add(virulent => 1);
260                  }                  }
261                  if ($self->SpecialAttribute($featureID, \@attributes,                  if ($self->SpecialAttribute($featureID, \@attributes,
262                                       0, [0,2], '^iedb_',                                       1, [2,3], '^iedb_',
263                                       qw(FeatureIEDB iedb))) {                                       qw(FeatureIEDB iedb))) {
264                      push @keywords, 'iedb';                      push @keywords, 'iedb';
265                      $self->Add(iedb => 1);                      $self->Add(iedb => 1);
# Line 272  Line 282 
282                          $attributeHash{$realKey} = {$subKey => \@values};                          $attributeHash{$realKey} = {$subKey => \@values};
283                      }                      }
284                  }                  }
285                    TraceDump(AttributeHash => \%attributeHash) if T(FeatureLoadGroup => 4);
286                  # First we handle CDD. This is a bit complicated, because                  # First we handle CDD. This is a bit complicated, because
287                  # there are multiple CDDs per protein.                  # there are multiple CDDs per protein.
288                  if (exists $attributeHash{CDD}) {                  if (exists $attributeHash{CDD}) {
289                      # Get the hash of CDD IDs to scores for this feature. We                      # Get the hash of CDD IDs to scores for this feature. We
290                      # already know it exists because of the above IF.                      # already know it exists because of the above IF.
291                      my $cddHash = $attributeHash{CDD};                      my $cddHash = $attributeHash{CDD};
292                      my @cddData = sort keys %{$cddHash};                      my @cddData = sort keys %$cddHash;
293                      for my $cdd (@cddData) {                      for my $cdd (@cddData) {
294                          # Extract the score for this CDD and decode it.                          # Extract the score for this CDD and decode it.
295                          my ($codeScore) = split(/\s*[,;]\s*/, $cddHash->{$cdd}->[0]);                          my ($codeScore) = split(/\s*[,;]\s*/, $cddHash->{$cdd}->[0]);
# Line 291  Line 302 
302                              Trace("CDD score \"$codeScore\" for feature $featureID invalid.") if T(ERDBLoadGroup => 3);                              Trace("CDD score \"$codeScore\" for feature $featureID invalid.") if T(ERDBLoadGroup => 3);
303                          } else {                          } else {
304                              # Create the connection and a CDD record.                              # Create the connection and a CDD record.
305                              $self->Put('IsPresentOnProteinOf', 'from-link' => $cdd,                              $self->PutR(IsPresentOnProteinOf => $cdd, $featureID,
306                                         'to-link' => $featureID, score => $realScore);                                          score => $realScore);
307                              $self->Put('CDD', id => $cdd);                              $self->PutE(CDD => $cdd);
308                            }
309                        }
310                    }
311                    # A similar situation exists for protein families.
312                    if (exists $attributeHash{PFAM}) {
313                        # Get the hash of PFAMs to scores for this feature.
314                        my $pfamHash = $attributeHash{PFAM};
315                        for my $pfam (sort keys %$pfamHash) {
316                            # Extract the range.
317                            my $codeScore = $pfamHash->{$pfam}->[0];
318                            $codeScore =~ /;(.+)/;
319                            my $range = $1;
320                            # Strip off the PFAM id from the source.
321                            my ($pfamID) = split /_/, $pfam, 2;
322                            # Emit the ProteinFamily record.
323                            $self->PutE(ProteinFamily => $pfamID);
324                            # Connect it to the feature.
325                            $self->PutR(IsFamilyForFeature => $pfamID, $featureID,
326                                        range => $range);
327                            # Get its name from the ontology database. There can
328                            # be at most one.
329                            my $dt_objs =
330                                $ontology_dbmaster->pfam->get_objects({id => $pfamID});
331                            if (defined $dt_objs->[0]) {
332                                $self->PutE(ProteinFamilyName => $pfamID,
333                                            common_name => $dt_objs->[0]->term());
334                          }                          }
335                      }                      }
336                  }                  }
# Line 305  Line 342 
342                      my $psortHash = $attributeHash{PSORT};                      my $psortHash = $attributeHash{PSORT};
343                      for my $psort (keys %{$psortHash}) {                      for my $psort (keys %{$psortHash}) {
344                          # Get the confidence, and convert it to a number if necessary.                          # Get the confidence, and convert it to a number if necessary.
345                          my $confidence = $psortHash->{$psort};                          my $confidence = $psortHash->{$psort}->[0];
346                          if ($confidence eq 'unknown') {                          if ($confidence eq 'unknown') {
347                              $confidence = -1;                              $confidence = -1;
348                          }                          }
349                          $self->Put('IsPossiblePlaceFor', 'from-link' => $psort,                          $self->PutR(IsPossiblePlaceFor => $psort, $featureID,
350                                     'to-link' => $featureID, confidence => $confidence);                                      confidence => $confidence);
351                          $self->Put('CellLocation', id => $psort);                          $self->PutE(CellLocation => $psort);
352                          # If this is a significant location, add it as a keyword.                          # If this is a significant location, add it as a keyword.
353                          if ($confidence > 2.5) {                          if ($confidence > 2.5) {
354                                # Before we add it as a keyword, we convert it from
355                                # capital-case to hyphenated by inserting hyphens at
356                                # case transition points.
357                                $psort =~ s/([a-z])([A-Z])/$1-$2/g;
358                              push @keywords, $psort;                              push @keywords, $psort;
359                          }                          }
360                      }                      }
# Line 322  Line 363 
363                  # the transmembrane locations.                  # the transmembrane locations.
364                  my $signalList = "";                  my $signalList = "";
365                  my $transList = "";                  my $transList = "";
366                    my $transCount = 0;
367                  if (exists $attributeHash{Phobius}) {                  if (exists $attributeHash{Phobius}) {
368                      # This will be a hash of two keys (transmembrane and signal) to                      # This will be a hash of two keys (transmembrane and signal) to
369                      # location strings. If there's no value, we stuff in an empty string.                      # location lists. GetCommaList converts them into comma-separated
370                        # location strings. If there's no value, it returns an empty string.
371                      $signalList = $self->GetCommaList($attributeHash{Phobius}->{signal});                      $signalList = $self->GetCommaList($attributeHash{Phobius}->{signal});
372                      $transList = $self->GetCommaList($attributeHash{Phobius}->{transmembrane});                      my $transList = $attributeHash{Phobius}->{transmembrane};
373                        my @transMap = split /\s*,\s*/, $transList;
374                        $transCount = (defined $transList ? scalar(@transMap) : 0);
375                  }                  }
376                  # Here are some more numbers: isoelectric point, molecular weight, and                  # Here are some more numbers: isoelectric point, molecular weight, and
377                  # the similar-to-human flag.                  # the similar-to-human flag.
378                  my $isoelectric = 0;                  my $isoelectric = 0;
379                  if (exists $attributeHash{isoelectric_point}) {                  if (exists $attributeHash{isoelectric_point}) {
380                      $isoelectric = $attributeHash{isoelectric_point}->{""};                      $isoelectric = $attributeHash{isoelectric_point}->{""}->[0];
381                  }                  }
382                  my $similarToHuman = 0;                  my $similarToHuman = 0;
383                  if (exists $attributeHash{similar_to_human} && $attributeHash{similar_to_human}->{""} eq 'yes') {                  if (exists $attributeHash{similar_to_human} && $attributeHash{similar_to_human}->{""}->[0] eq 'yes') {
384                      $similarToHuman = 1;                      $similarToHuman = 1;
385                  }                  }
386                  my $molecularWeight = 0;                  my $molecularWeight = 0;
387                  if (exists $attributeHash{molecular_weight}) {                  if (exists $attributeHash{molecular_weight}) {
388                      $molecularWeight = $attributeHash{molecular_weight}->{""};                      $molecularWeight = $attributeHash{molecular_weight}->{""}->[0];
389                  }                  }
390                  # Join the keyword string.                  # Join the keyword string.
391                  my $keywordString = join(" ", @keywords);                  my $keywordString = join(" ", @keywords);
392                  # Get rid of annoying punctuation.                  # Get rid of annoying punctuation.
393                  $keywordString =~ s/[();@#\/,]/ /g;                  $keywordString =~ s/[();@#\/,]/ /g;
394                  # Get the list of keywords in the keyword string.                  # Get the list of keywords in the keyword string, minus the delimiters.
395                  my @realKeywords = $stemmer->Split($keywordString);                  my @realKeywords = grep { $stemmer->IsWord($_) }
396                        $stemmer->Split($keywordString);
397                  # We need to do two things here: create the keyword string for the feature table                  # We need to do two things here: create the keyword string for the feature table
398                  # and write records to the keyword table for the keywords.                  # and write records to the keyword table for the keywords.
399                  my (%keys, %stems, @realStems);                  my (%keys, %stems, @realStems);
# Line 368  Line 414 
414                  # Create keyword table entries for the keywords found.                  # Create keyword table entries for the keywords found.
415                  for my $key (keys %keys) {                  for my $key (keys %keys) {
416                      my $stem = $keys{$key};                      my $stem = $keys{$key};
417                      $self->Put('Keyword', id => $key, stem => $stem, phonex => $stems{$stem});                      $self->PutE(Keyword => $key, stem => $stem, phonex => $stems{$stem});
418                  }                  }
419                  # Now we need to process the feature's locations. First, we split them up.                  # Now we need to process the feature's locations. First, we split them up.
420                  my @locationList = split /\s*,\s*/, $locations;                  my @locationList = split /\s*,\s*/, $locations;
# Line 397  Line 443 
443                      # Loop through the chunks, creating IsLocatedIn records. The variable                      # Loop through the chunks, creating IsLocatedIn records. The variable
444                      # "$i" will be used to keep the location index.                      # "$i" will be used to keep the location index.
445                      for my $locChunk (@locOList) {                      for my $locChunk (@locOList) {
446                          $self->Put('IsLocatedIn', 'from-link' => $featureID,                          $self->PutR(IsLocatedIn => $featureID, $locChunk->Contig,
447                                     'to-link' => $locChunk->Contig, beg => $locChunk->Left,                                      beg => $locChunk->Left, dir => $locChunk->Dir,
448                                      dir => $locChunk->Dir, len => $locChunk->Length,                                      len => $locChunk->Length, locN => $i);
                                     locN => $i);  
449                          $i++;                          $i++;
450                      }                      }
451                  }                  }
452                    # Check for figfams. In case we find any, we need the range.
453                    # It's the whole sequence.
454                    my $range = "1-$sequenceLength";
455                    # Ask for the figfams.
456                    my @fams = $ffs->families_containing_peg($featureID);
457                    # Connect them to the feature (if any).
458                    for my $fam (@fams) {
459                        $self->PutE(ProteinFamily => $fam);
460                        $self->PutR(IsFamilyForFeature => $fam, $featureID,
461                                    range => $range);
462                    }
463                  # Now we get some ancillary flags.                  # Now we get some ancillary flags.
464                  my $locked = $fig->is_locked_fid($featureID);                  my $locked = $fig->is_locked_fid($featureID);
465                  my $in_genbank = $fig->peg_in_gendb($featureID);                  my $in_genbank = $fig->peg_in_gendb($featureID);
466                  # Create the feature record.                  # Create the feature record.
467                  $self->Put('Feature', id => $featureID, 'assignment-maker' => $user,                  $self->PutE(Feature => $featureID, 'assignment-maker' => $user,
468                             'assignment-quality' => $quality, 'feature-type' => $type,                             'assignment-quality' => $quality, 'feature-type' => $type,
469                             'in-genbank' => $in_genbank, 'isoelectric-point' => $isoelectric,                             'in-genbank' => $in_genbank, 'isoelectric-point' => $isoelectric,
470                             locked => $locked, 'molecular-weight' => $molecularWeight,                             locked => $locked, 'molecular-weight' => $molecularWeight,
# Line 416  Line 472 
472                             'signal-peptide' => $signalList, 'similar-to-human' => $similarToHuman,                             'signal-peptide' => $signalList, 'similar-to-human' => $similarToHuman,
473                             assignment => $assignment, keywords => $cleanWords,                             assignment => $assignment, keywords => $cleanWords,
474                             'location-string' => $locationString,                             'location-string' => $locationString,
475                             'transmembrane-map' => $transList);                             'transmembrane-map' => $transList,
476                               'conserved-neighbors' => $couplingCount,
477                               'transmembrane-domain-count' => $transCount);
478              }              }
479          }          }
480      }      }
# Line 458  Line 516 
516    
517  =item idxValues  =item idxValues
518    
519  Reference to a list containing the indexes in each tuple of the columns to be put as  Reference to a list containing the indexes of the value and URL to put in the
520  the second column of the output.  second column of the output.
521    
522  =item pattern  =item pattern
523    
# Line 492  Line 550 
550      for my $row (@{$attributes}) {      for my $row (@{$attributes}) {
551          # Check for a match.          # Check for a match.
552          if ($row->[$idxMatch] =~ m/$pattern/i) {          if ($row->[$idxMatch] =~ m/$pattern/i) {
553              # We have a match, so output a row. This is a bit tricky, since we may              # We have a match, so output a row.
554              # be putting out multiple columns of data from the input. We join              my $value = HyperLink->new(map { $row->[$_] } @$idxValues);
555              # the columns together into a single space-delimited string.              $self->PutE($tableName => $id, $fieldName => $value);
             my $value = join(" ", map { $row->[$_] } @{$idxValues});  
             $self->Put($tableName, id => $id, $fieldName => $value);  
556              $retVal++;              $retVal++;
557          }          }
558      }      }

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3