public void setEntrezGeneInfo(Element node) { // check to make sure ids match NodeList idList = node.getElementsByTagName("Id"); if (!idList.item(0).getTextContent().equals(this.getAttribute("Xref", "ID"))) return; gene = new Gene(Gene.geneType.ENTREZ, this.getAttribute("Xref", "ID")); NodeList items = node.getElementsByTagName("Item"); for (int i = 0; i < items.getLength(); i++) { Node n = items.item(i); String name = ((Element) n).getAttribute("Name"); if (name.equals("GenomicInfo")) { NodeList subItems = ((Element) n).getElementsByTagName("Item"); for (int j = 0; j < subItems.getLength(); j++) { Node m = subItems.item(j); String subName = ((Element) m).getAttribute("Name"); if (subName.equals("ChrStart")) { gene.setStart(m.getTextContent()); } else if (subName.equals("ChrStop")) { gene.setEnd(m.getTextContent()); } } } else if (name.equals("Chromosome")) { gene.setChromosome(n.getTextContent()); } else if (name.equals("Name")) { gene.setName(n.getTextContent()); } else if (name.equals("Description")) { gene.setDescription(n.getTextContent()); } } geneInfoSet = true; }
public void setEnsemblGeneInfo(String id, String chrom, String start, String end) { gene = new Gene(Gene.geneType.ENSEMBL, id); gene.setChromosome(chrom); gene.setStart(start); gene.setEnd(end); geneInfoSet = true; }
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); } }