/** Save nextprot markers */
  void save() {
    String nextProtBinFile = config.getDirDataVersion() + "/nextProt.bin";
    if (verbose) Timer.showStdErr("Saving database to file '" + nextProtBinFile + "'");

    // Add chromosomes
    HashSet<Chromosome> chromos = new HashSet<Chromosome>();
    for (Marker m : markers) chromos.add(m.getChromosome());

    // Create a set of all markers to be saved
    Markers markersToSave = new Markers();
    markersToSave.add(genome);
    for (Chromosome chr : chromos) markersToSave.add(chr);
    for (Marker m : markers) markersToSave.add(m);

    // Save
    MarkerSerializer markerSerializer = new MarkerSerializer();
    markerSerializer.save(nextProtBinFile, markersToSave);
  }
예제 #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;
  }