Ejemplo n.º 1
0
  public void analyze(String name, Object data) {
    if (!(data instanceof SequenceGroup)) {
      ErrorWindow.showErrorWindow(
          new Exception("Got a non-sequencegroup object for a dot plot analysis"));
    }

    SequenceGroup sg = (SequenceGroup) data;
    currentSG = sg;

    titleLabel.setText(name);

    DefaultComboBoxModel cModel1 = new DefaultComboBoxModel();
    DefaultComboBoxModel cModel2 = new DefaultComboBoxModel();

    for (int j = 0; j < sg.size(); j++) {
      cModel1.addElement(sg.get(j).getName());
      cModel2.addElement(sg.get(j).getName());
    }
    seq1Box.setModel(cModel1);

    seq2Box.setModel(cModel2);

    seq1Box.setSelectedIndex(0);
    seq2Box.setSelectedIndex(1);

    dotPlot.setBlockWidth((Integer) blockWidthSpinner.getValue());
    changeSequences();
  }
Ejemplo n.º 2
0
  /**
   * Returns true if there is more than one base in this column Gap characters (as defined by
   * Sequence.GAP) don't count one way or the other. All gaps in this colum return false
   */
  public boolean isPolymorphic(int site) {
    if (sg.size() == 0) return false;

    char base = sg.get(0).at(site);
    int seqNum = 0;
    while (seqNum < sg.size() && charIsGap(base)) {
      base = sg.get(seqNum).at(site);
      seqNum++;
    }

    // Every base is a gap in this column, I guess we return false here
    if (seqNum == sg.size()) {
      return false;
    }

    boolean same = true;
    for (int i = seqNum; i < sg.size() && same; i++) {
      char compBase = sg.get(i).at(site);
      if ((!charIsGap(compBase)) && compBase != base) same = false;
    }
    return !same;
  }
Ejemplo n.º 3
0
  /** Returns true if any sequence has a gap at this site */
  public boolean hasGap(int site) {
    for (int i = 0; i < sg.size(); i++) if (sg.get(i).isGap(site)) return true;

    return false;
  }