Beispiel #1
0
  private void unsafeSave1DTrackToWigFile(
      Chromosome chromosomeForPosition, PrintWriter printWriter, int binStartPosition)
      throws IOException {
    int resolution = getZoom().getBinSize();
    for (Chromosome chromosome : chromosomes) {
      if (chromosome.getName().equals(Globals.CHR_ALL)) continue;
      Matrix matrix = null;
      if (displayOption == MatrixType.OBSERVED) {
        matrix = dataset.getMatrix(chromosomeForPosition, chromosome);
      } else if (displayOption == MatrixType.CONTROL) {
        matrix = controlDataset.getMatrix(chromosomeForPosition, chromosome);
      }

      if (matrix == null) continue;

      MatrixZoomData zd = matrix.getZoomData(currentZoom);
      printWriter.println(
          "fixedStep chrom=chr"
              + chromosome.getName().replace("chr", "")
              + " start=1 step="
              + resolution
              + " span="
              + resolution);

      int[] regionIndices;
      if (chromosomeForPosition.getIndex() < chromosome.getIndex()) {
        regionIndices = new int[] {binStartPosition, binStartPosition, 0, chromosome.getLength()};
      } else {
        regionIndices = new int[] {0, chromosome.getLength(), binStartPosition, binStartPosition};
      }

      zd.dump1DTrackFromCrossHairAsWig(
          printWriter,
          chromosomeForPosition,
          binStartPosition,
          chromosomeForPosition.getIndex() == chromosome.getIndex(),
          regionIndices,
          normalizationType,
          displayOption,
          getExpectedValues());
    }
  }
Beispiel #2
0
  /**
   * Chromosome "0" is whole genome
   *
   * @param chromosomes list of chromosomes
   */
  void setChromosomes(List<Chromosome> chromosomes) {
    int[] chromosomeBoundaries = new int[chromosomes.size() - 1];
    long bound = 0;
    for (int i = 1; i < chromosomes.size(); i++) {
      Chromosome c = chromosomes.get(i);
      bound += (c.getLength() / 1000);
      chromosomeBoundaries[i - 1] = (int) bound;
    }
    heatmapPanel.setChromosomeBoundaries(chromosomeBoundaries);

    chrBox1.setModel(
        new DefaultComboBoxModel<Chromosome>(
            chromosomes.toArray(new Chromosome[chromosomes.size()])));
    chrBox2.setModel(
        new DefaultComboBoxModel<Chromosome>(
            chromosomes.toArray(new Chromosome[chromosomes.size()])));
  }