コード例 #1
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);
  }
コード例 #2
0
 public void setSelectedDisplayOption(MatrixType[] options, boolean control) {
   if (control) {
     MatrixType originalMatrixType = (MatrixType) displayOptionComboBox.getSelectedItem();
     displayOptionComboBox.setModel(new DefaultComboBoxModel<MatrixType>(options));
     int indx = 0;
     for (int i = 0; i < displayOptionComboBox.getItemCount(); i++) {
       if (originalMatrixType.equals(displayOptionComboBox.getItemAt(i))) {
         indx = i;
         break;
       }
     }
     displayOptionComboBox.setSelectedIndex(indx);
   } else {
     displayOptionComboBox.setModel(new DefaultComboBoxModel<MatrixType>(options));
     displayOptionComboBox.setSelectedIndex(0);
   }
 }