Ejemplo n.º 1
0
 public IdTouple getIdTouple(String symbol) {
   BiologicalEntity entity = guessEntity(symbol);
   IdTouple touple = new IdTouple();
   if (entity != null) {
     touple.gid = entity.getId();
     touple.pname = entity.getName();
   }
   //        if (entity != null) {
   //            touple.pname = guessProtein(entity.getName());
   //        } else {
   //            touple.pname = guessProtein(symbol);
   //        }
   return touple;
 }
Ejemplo n.º 2
0
 private BiologicalEntity guessEntity(String key) {
   String sql;
   if (key.endsWith("_HUMAN")) {
     sql = "SELECT * FROM proteinGene WHERE pname='" + key + "'";
     HashMap<String, String> line = DBUtil.fillFirstRow(sql);
     if (line != null) {
       BiologicalEntity be = new BiologicalEntity();
       be.setId(line.get("geneid"));
       be.setId_src(BiologicalEntity.ENTREZ);
       be.setType(BiologicalEntity.GENE);
       be.setName(key); // line.get("pname"));
       return be;
     }
   }
   sql = "SELECT geneid FROM gene WHERE symbol='" + key + "' AND taxid=9606";
   String s = DBUtil.querySingle(sql);
   if (s != null) {
     BiologicalEntity be = new BiologicalEntity();
     be.setId(s);
     be.setName(key);
     be.setId_src(BiologicalEntity.ENTREZ);
     be.setType(BiologicalEntity.GENE);
     return be;
   }
   sql =
       "SELECT geneid FROM geneAlias, gene WHERE gene.taxid=9606 AND geneAlias.alias='"
           + key
           + "' AND geneAlias.id_list=geneid";
   s = DBUtil.querySingle(sql);
   if (s != null) {
     BiologicalEntity be = new BiologicalEntity();
     be.setId(s);
     be.setName(key);
     be.setId_src(BiologicalEntity.ENTREZ);
     be.setType(BiologicalEntity.GENE);
     return be;
   }
   System.err.println("Cannot find an entry for " + key);
   return null;
 }