[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.382, Mon Oct 24 21:50:35 2005 UTC revision 1.383, Tue Oct 25 14:50:23 2005 UTC
# Line 7905  Line 7905 
7905       $select .= $col[$i] . " = \'" . $request[$i] . "\' ";       $select .= $col[$i] . " = \'" . $request[$i] . "\' ";
7906      }      }
7907      if (!$first) {$select .= " )"}      if (!$first) {$select .= " )"}
7908      if (($relational_db_response = $rdbH->SQL($select)) && (@$relational_db_response > 0))      return @{$rdbH->SQL($select)};
     {  
         return @$relational_db_response;  
     }  
     else  
     {  
         return ();  
     }  
7909  }  }
7910    
7911    
# Line 8074  Line 8067 
8067  }  }
8068    
8069    
8070    
8071  =head3 clean_attribute_key()  =head3 clean_attribute_key()
8072    
8073  use $key=$fig->clean_attribute_key($key)  use $key=$fig->clean_attribute_key($key)
8074    
8075  Keys for attributes are used as filenames in the code, and there are limitations on the characters that can be used in the key name. We provide an extended explanation of each key, so the key does not necessarily need to be person-readable.  Keys for attributes are used as filenames in the code, and there are limitations on the characters that can be used in the key name. We provide an extended explanation of each key, so the key does not necessarily need to be person-readable.
8076    
8077  Keys are not allowed to contain space, tab, newline, !@#$%^&*()`~{}[]|\:;"'<>?,./  Keys are not allowed to contain any non-word character (i.e. they must only contain [a-zA-Z0-9] and _
8078    
8079  This method will remove these.  This method will remove these.
8080    
# Line 8088  Line 8082 
8082    
8083  sub clean_attribute_key {  sub clean_attribute_key {
8084   my ($self, $key)=@_;   my ($self, $key)=@_;
8085   $key =~ s/[\s\n\t\$\@\/\\\Q!#%^&*()`~{}[]|:;"'<>?,.\E]//g; # the \Q .. \E just allows not escaping all the intermediate metacharacters   #$key =~ s/[\s\n\t\$\@\/\\\Q!#%^&*()`~{}[]|:;"'<>?,.\E]//g; # the \Q .. \E just allows not escaping all the intermediate metacharacters
8086     $key =~ s/\W//g;
8087   return $key;   return $key;
8088  }  }
8089    
8090    =head3 split_attribute_oid()
8091    
8092    use my ($genome, $type, $id)=split_attribute_feature($id);
8093    
8094    splits an id into genome, type, and id if it is a feature, or just genome and '', '' if it is a genome, and just the id and undef undef if it is not known
8095    
8096    =cut
8097    
8098    sub split_attribute_oid {
8099     my($self, $id)=@_;
8100     if ($id =~ /^\d+\.\d+$/)
8101     {
8102      # it appears to be a genome id
8103      return ($id, "", "");
8104     }
8105     elsif ($id =~ /^fig\|(\d+\.\d+)\.(\w+)\.(\d+)/)
8106     {
8107      # it appears to be a feature
8108      return ($1, $2, $3);
8109     }
8110     else
8111     {
8112      # not sure what it is
8113      return ($id, undef, undef);
8114     }
8115    }
8116    
8117    
8118  =head3 read_attribute_transaction_log  =head3 read_attribute_transaction_log
8119    
8120  use: $fig->read_attribute_transaction_log($logfile);  use: $fig->read_attribute_transaction_log($logfile);
# Line 8261  Line 8284 
8284   if ($want eq "all") {return $tags} else {return $tags->{$want}}   if ($want eq "all") {return $tags} else {return $tags->{$want}}
8285  }  }
8286    
8287    =head2 get_all_keys()
8288    
8289    Just get all the keys and return them. No processing involved.
8290    
8291    =cut
8292    
8293    sub get_all_keys {
8294     my($self)=@_;
8295     my $rdbH = $self->db_handle;
8296     return @{$rdbH->SQL("SELECT fid,tag from attribute")};
8297    }
8298    
8299  =head3 get_values  =head3 get_values
8300    
8301  Get all the values that we know about  Get all the values that we know about

Legend:
Removed from v.1.382  
changed lines
  Added in v.1.383

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3