Example #1
0
  /** Create interval trees (forest) */
  public void buildForest() {
    intervalForest = new IntervalForest();

    // Add all chromosomes to forest
    if (useChromosomes) {
      for (Chromosome chr : genome) intervalForest.add(chr);
    }

    // Add all genes to forest
    for (Gene gene : genome.getGenes()) intervalForest.add(gene);

    // ---
    // Create (and add) up-down stream, splice sites, intergenic, etc
    // ---
    markers.add(createGenomicRegions());

    // Add all 'markers' to forest (includes custom intervals)
    intervalForest.add(markers);

    // Build interval forest
    intervalForest.build();
  }
Example #2
0
  /**
   * Is the chromosome missing in this marker?
   *
   * @param marker
   * @return
   */
  boolean isChromosomeMissing(Marker marker) {
    // Missing chromosome in marker?
    if (marker.getChromosome() == null) return true;

    // Missing chromosome in genome?
    String chrName = marker.getChromosomeName();
    Chromosome chr = genome.getChromosome(chrName);
    if (chr == null) return true;

    // Chromosome length is 1 or less?
    if (chr.size() < 1) return true;

    // Tree not found in interval forest?
    if (!intervalForest.hasTree(chrName)) return true;

    // OK, we have the chromosome
    return false;
  }
Example #3
0
 public int size() {
   if (intervalForest == null) return 0;
   return intervalForest.size();
 }
Example #4
0
 /** Return a collection of intervals that intersect 'marker' */
 public Markers query(Marker marker) {
   return intervalForest.query(marker);
 }