[Bio] / FigKernelPackages / FIG.pm Repository:
ViewVC logotype

Diff of /FigKernelPackages/FIG.pm

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

revision 1.385, Wed Oct 26 19:33:11 2005 UTC revision 1.386, Wed Oct 26 22:12:03 2005 UTC
# Line 7941  Line 7941 
7941    
7942  =cut  =cut
7943    
7944    
7945    
7946    sub search_index_by_attribute {
7947        # supports search_index method by finding attributes via the attribute table in
7948        # the database rather than via glimpse indexes.  This will go away with Bobs
7949        # migration to Lucene, but for now we've been asked to give immediate search
7950        # capability on attributes without rerunning index building.
7951        #
7952        # return array of (peg, org, aliasList, function) where we'll set aliasList to
7953        # the value of the alias and leave function blank.
7954    
7955        my($self,$searchTerm)=@_;
7956        return unless( $searchTerm);
7957        my $rdbH = $self->db_handle;
7958    
7959        my $relational_db_response=$rdbH->SQL("SELECT fid,tag, val from attribute WHERE tag LIKE '%$searchTerm%' OR val LIKE '%$searchTerm%'");
7960    
7961        my @results;
7962        foreach my $res (@$relational_db_response) {
7963            my ($fid, $tag, $value)=@$res;
7964            $tag =~ s/^\s+//; $tag =~ s/\s+$//;
7965            my $org = $self->genus_species( $self->genome_of($fid) );
7966            push (@results, [$fid, $org, "[attribute $tag] $value", ""] );
7967        }
7968        return @results;
7969    }
7970    
7971    
7972  sub find_by_attribute {  sub find_by_attribute {
7973      # search by substrings in attribute values or attribute tags.      # search by substrings in attribute values or attribute tags.
7974      # This might replace the present search-for-attributes that works by      # This might replace the present search-for-attributes that works by
# Line 8671  Line 8699 
8699  #   print STDERR "pattern=$pattern patternQ=$patternQ\n";  #   print STDERR "pattern=$pattern patternQ=$patternQ\n";
8700  #    warn "args: $glimpse_args\n";  #    warn "args: $glimpse_args\n";
8701      @raw = `$FIG_Config::ext_bin/glimpse $glimpse_args`;      @raw = `$FIG_Config::ext_bin/glimpse $glimpse_args`;
8702    
8703        @pegs  =  map { $_ =~ /^\S+:\s+(\S.*\S)/; [split(/\t/,$1)] }
8704                  grep { $_ =~ /^\S+peg.index/ } @raw;
8705    #             grep { $_ =~ /^\S+(peg|attribute).index/ } @raw;
8706    
8707        push(@pegs, $self->search_index_by_attribute($pattern));
8708    
8709      @pegs  = grep { ! $self->is_deleted_fid($_->[0]) }      @pegs  = grep { ! $self->is_deleted_fid($_->[0]) }
8710               sort { &FIG::by_fig_id($a->[0],$b->[0]) }               sort { &FIG::by_fig_id($a->[0],$b->[0]) } @pegs;
8711               map { $_ =~ /^\S+:\s+(\S.*\S)/; [split(/\t/,$1)] }  
              #grep { $_ =~ /^\S+peg\.index/ } @raw;  
              grep { $_ =~ /^\S+(peg|attribute).index/ } @raw;  
8712    
8713      my @rolesT = grep { $_ =~ /^\S+role.index/ } @raw;      my @rolesT = grep { $_ =~ /^\S+role.index/ } @raw;
8714      my %roles  = map { $_ =~ /^\S+:\s+(\S.*\S)/; $1 => 1;} @rolesT;      my %roles  = map { $_ =~ /^\S+:\s+(\S.*\S)/; $1 => 1;} @rolesT;

Legend:
Removed from v.1.385  
changed lines
  Added in v.1.386

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3