/** Find (or create) a gene for this transcript */ Gene findOrCreateGene( String geneName, String trId, Chromosome chromo, int start, int end, boolean strandMinus, boolean isCoding) { Marker tr = new Marker(chromo, start, end, strandMinus, trId); List<Gene> genes = genesByName.get(geneName); int geneIndex = 0; if (genes != null) { for (Gene gene : genes) { if (gene.intersects(tr)) { // Do we need to update gene length? if (start < gene.getStart()) gene.setStart(start); if (gene.getEnd() < end) gene.setEnd(end); return gene; } } geneIndex = genes.size() + 1; } // Need to create a new gene String geneId = geneName + (geneIndex > 0 ? "." + geneIndex : ""); Gene gene = new Gene(chromo, start, end, strandMinus, geneId, geneName, BioType.coding(isCoding)); genesByName.add(geneName, gene); add(gene); return gene; }