コード例 #1
0
ファイル: HiC.java プロジェクト: RaquelFigueroa/juicebox
  /**
   * Called from alt-drag zoom
   *
   * @param xBP0
   * @param yBP0
   * @param targetBinSize
   */
  public void zoomToDrawnBox(final int xBP0, final int yBP0, final double targetBinSize) {

    HiCZoom newZoom = currentZoom;
    if (!isResolutionLocked()) {
      List<HiCZoom> zoomList =
          currentZoom.getUnit() == HiC.Unit.BP ? dataset.getBpZooms() : dataset.getFragZooms();
      for (int i = zoomList.size() - 1; i >= 0; i--) {
        if (zoomList.get(i).getBinSize() >= targetBinSize) {
          newZoom = zoomList.get(i);
          break;
        }
      }

      // this addresses draw box to zoom when down from low res pearsons
      // it can't zoom all the way in, but can zoom in a little more up to 500K
      if (isInPearsonsMode() && newZoom.getBinSize() < HiCGlobals.MAX_PEARSON_ZOOM) {
        for (int i = zoomList.size() - 1; i >= 0; i--) {
          if (zoomList.get(i).getBinSize() >= HiCGlobals.MAX_PEARSON_ZOOM) {
            newZoom = zoomList.get(i);
            break;
          }
        }
      }
    }

    safeActuallySetZoomAndLocation(
        newZoom,
        xBP0,
        yBP0,
        newZoom.getBinSize() / targetBinSize,
        false,
        ZoomCallType.DRAG,
        "DragZoom",
        true);
  }
コード例 #2
0
ファイル: HiC.java プロジェクト: RaquelFigueroa/juicebox
  public String getDefaultLocationDescription() {

    String xChr = xContext.getChromosome().getName();
    String yChr = yContext.getChromosome().getName();

    if (!(xChr.toLowerCase().contains("chr"))) xChr = "chr" + xChr;
    if (!(yChr.toLowerCase().contains("chr"))) yChr = "chr" + yChr;

    return xChr
        + "@"
        + (long) (xContext.getBinOrigin() * currentZoom.getBinSize())
        + "_"
        + yChr
        + "@"
        + (long) (yContext.getBinOrigin() * currentZoom.getBinSize());
  }
コード例 #3
0
ファイル: HiC.java プロジェクト: RaquelFigueroa/juicebox
  public void unsafeSetLocation(
      String chrXName,
      String chrYName,
      String unitName,
      int binSize,
      double xOrigin,
      double yOrigin,
      double scaleFactor,
      ZoomCallType zoomCallType,
      boolean allowLocationBroadcast) {

    HiCZoom newZoom = currentZoom;
    if (currentZoom.getBinSize() != binSize) {
      newZoom = new HiCZoom(HiC.valueOfUnit(unitName), binSize);
    }
    unsafeActuallySetZoomAndLocation(
        chrXName,
        chrYName,
        newZoom,
        (int) xOrigin,
        (int) yOrigin,
        scaleFactor,
        true,
        zoomCallType,
        allowLocationBroadcast);
  }
コード例 #4
0
ファイル: HiC.java プロジェクト: RaquelFigueroa/juicebox
  public void generateTrackFromLocation(int mousePos, boolean isHorizontal) {

    if (!MatrixType.isObservedOrControl(displayOption)) {
      MessageUtils.showMessage("This feature is only available for Observed or Control views");
      return;
    }

    // extract the starting position
    int binStartPosition = (int) (getXContext().getBinOrigin() + mousePos / getScaleFactor());
    if (isHorizontal)
      binStartPosition = (int) (getYContext().getBinOrigin() + mousePos / getScaleFactor());

    // Initialize default file name
    String filename = displayOption == MatrixType.OBSERVED ? "obs" : "ctrl";
    filename += isHorizontal ? "_horz" : "_vert";
    filename += "_bin" + binStartPosition + "_res" + currentZoom.getBinSize();
    filename = cleanUpNumbersInName(filename);

    // allow user to customize or change the name
    filename = MessageUtils.showInputDialog("Enter a name for the resulting .wig file", filename);
    if (filename == null || filename.equalsIgnoreCase("null")) return;

    File outputWigFile = new File(DirectoryManager.getHiCDirectory(), filename + ".wig");
    MessageUtils.showMessage("Data will be saved to " + outputWigFile.getAbsolutePath());

    Chromosome chromosomeForPosition = getXContext().getChromosome();
    if (isHorizontal) chromosomeForPosition = getYContext().getChromosome();

    safeSave1DTrackToWigFile(chromosomeForPosition, outputWigFile, binStartPosition);
  }
コード例 #5
0
ファイル: HiC.java プロジェクト: RaquelFigueroa/juicebox
  public String getLocationDescription() {
    String xChr = xContext.getChromosome().getName();
    String yChr = yContext.getChromosome().getName();

    if (!(xChr.toLowerCase().contains("chr"))) xChr = "chr" + xChr;
    if (!(yChr.toLowerCase().contains("chr"))) yChr = "chr" + yChr;

    return "setlocation "
        + xChr
        + " "
        + yChr
        + " "
        + currentZoom.getUnit().toString()
        + " "
        + currentZoom.getBinSize()
        + " "
        + xContext.getBinOrigin()
        + " "
        + yContext.getBinOrigin()
        + " "
        + getScaleFactor();
  }
コード例 #6
0
ファイル: HiC.java プロジェクト: RaquelFigueroa/juicebox
 public boolean isResolutionLocked() {
   return superAdapter.isResolutionLocked()
       ||
       // pearson can't zoom in
       (isInPearsonsMode() && currentZoom.getBinSize() == HiCGlobals.MAX_PEARSON_ZOOM);
 }
コード例 #7
0
ファイル: HiC.java プロジェクト: RaquelFigueroa/juicebox
 public boolean isPearsonEdgeCaseEncountered(HiCZoom zoom) {
   return isInPearsonsMode() && zoom.getBinSize() < HiCGlobals.MAX_PEARSON_ZOOM;
 }