Ejemplo n.º 1
0
  private void addGene(
      Map<String, Gene> map, String gene, String chr, long start, long end, long len) {

    if (map.containsKey(gene)) {
      Gene geneObj = map.get(gene);
      // move start
      if (geneObj.getStart() > start) {
        geneObj.setStart(start);
      }
      // move end
      if (geneObj.getEnd() < end) {
        geneObj.setEnd(end);
      }
      // update length
      geneObj.setLen(geneObj.getLen() + len);
    } else {
      Gene geneObj = new Gene(gene, chr, start, end, len);
      map.put(gene, geneObj);
    }
  }
Ejemplo n.º 2
0
  // print formatted info in no particular order
  public String getInfoString() {
    String s = "<HTML>";

    // gene info
    if (geneInfoSet) {
      s += "<B>";
      if (gene.getGeneType().equals(Gene.geneType.ENTREZ)) {
        s += "Entrez Gene";
      } else if (gene.getGeneType().equals(Gene.geneType.ENSEMBL)) {
        s += "Ensembl Gene";
      }
      s += "</B><BR>";
      String name = gene.getName();
      if (name != null) s += "Name: " + name + "<BR>";
      String description = gene.getDescription();
      if (description != null) s += "Description: " + description + "<BR>";
      String chromosome = gene.getChromosome();
      if (chromosome != null) s += "Chromosome: " + chromosome + "<BR>";
      s += "Start: " + gene.getStart() + "<BR>";
      s += "End: " + gene.getEnd() + "<BR>";
      s += "<BR>";
    }

    Iterator it = attributes.keySet().iterator();
    while (it.hasNext()) {
      String node = (String) it.next();
      if (node.equals("Graphics")) continue;
      s += "<B>" + node + "</B><BR>";
      Iterator currentIt = attributes.get(node).keySet().iterator();
      while (currentIt.hasNext()) {
        String key = (String) currentIt.next();
        s += key + ": " + attributes.get(node).get(key) + "<BR>";
      }
      s += "<BR>";
    }
    s += "</HTML>";
    return s;
  }