Ejemplo n.º 1
0
 /* .......................................... DNAData .................................................. */
 public long getTaxonNumberInTree(Taxa taxa, int it) {
   Associable tInfo = getTaxaInfo(data, true);
   if (tInfo != null) {
     return (int) tInfo.getAssociatedLong(TNTtoAnalyze, it);
   }
   return -1;
 }
Ejemplo n.º 2
0
  /**
   * Gets background color for cell for row ic. Override it if you want to change the color from the
   * default.
   */
  public Color getBackgroundColorOfCell(int it, boolean selected) {
    if (observedStates == null) {
      doCalcs();
      if (observedStates == null) return null;
    }
    if (observedStates.getParentData() != null) {
      captureCharacterDataFromObservedStates();

      Associable tInfo = data.getTaxaInfo(false);
      NameReference genBankColor = NameReference.getNameReference("genbankcolor");
      Object obj = tInfo.getAssociatedObject(genBankColor, it); // not saved to file
      if (obj instanceof Color) return (Color) obj;
    }
    if (bits == null || it < 0 || it > bits.getSize()) return null;
    String note = getNote(it);
    if (selected) {
      if (bits.isBitOn(it)) return ColorDistribution.darkGreen;
      else return ColorDistribution.darkRed;
    } else if (bits.isBitOn(it)) {
      if (StringUtil.blank(note)) return ColorDistribution.veryLightGreen;
      if (!(note.equalsIgnoreCase("x"))) return ColorDistribution.lightGreenYellowish;
      return ColorDistribution.lightGreenYellow;
    } else {
      if (StringUtil.blank(note)) return ColorDistribution.brown;
      if (!(note.equalsIgnoreCase("x"))) {
        return Color.red;
      }
      return ColorDistribution.lightRed;
    }
  }
Ejemplo n.º 3
0
  public String getExplanationForRow(int ic) {
    if (observedStates != null && observedStates.getParentData() != null) {
      captureCharacterDataFromObservedStates();

      Associable tInfo = data.getTaxaInfo(false);
      if (tInfo == null) return null;
      return "Notes: " + tInfo.toString(ic);
    }
    return null;
  }
Ejemplo n.º 4
0
  /*.................................................................................................................*/
  void zapData(CharacterData data, int it) {
    Taxa taxa = data.getTaxa();
    if (it < 0 || it >= taxa.getNumTaxa()) return;
    Associable tInfo = data.getTaxaInfo(false);
    int myColumn = -1;
    if (getEmployer() instanceof ListModule) {

      myColumn = ((ListModule) getEmployer()).getMyColumn(this);
    }
    if (tInfo != null) tInfo.deassignAssociated(it);
    for (int ic = 0; ic < data.getNumChars(); ic++) data.deassign(ic, it);

    data.notifyListeners(this, new Notification(MesquiteListener.DATA_CHANGED));
    outputInvalid();
    parametersChanged();
  }
Ejemplo n.º 5
0
  /*.................................................................................................................*/
  private void recordSourceProject() {
    MesquiteString s = new MesquiteString();
    s.setValue(getProject().getHomeFileName());
    if (!QueryDialogs.queryString(
        containerOfModule(),
        "Name to Stamp",
        "Indicate source file name to stamp on matrix rows",
        s)) return;

    int numMatrices = getProject().getNumberCharMatrices();
    NameReference sourceRef = NameReference.getNameReference("SourceFile");

    for (int im = 0; im < numMatrices; im++) {
      CharacterData data = getProject().getCharacterMatrix(im);
      Taxa taxa = data.getTaxa();
      Associable tInfo = data.getTaxaInfo(true);
      boolean anySelected = taxa.anySelected();
      for (int it = 0; it < taxa.getNumTaxa(); it++) {
        if (data.hasDataForTaxon(it) && (!anySelected || taxa.getSelected(it)))
          tInfo.setAssociatedObject(sourceRef, it, s.getValue());
      }
    }
  }
Ejemplo n.º 6
0
 String getNote(int row) {
   if (tInfo == null) return null;
   Object obj = tInfo.getAssociatedObject(MolecularData.genBankNumberRef, row);
   if (obj == null || !(obj instanceof String)) return null;
   return (String) obj;
 }
Ejemplo n.º 7
0
 void setNote(int row, String s) {
   if (tInfo == null) return;
   tInfo.setAssociatedObject(MolecularData.genBankNumberRef, row, s);
 }
Ejemplo n.º 8
0
 /* .......................................... MolecularData .................................................. */
 public void setTaxonNumberInTree(Taxa taxa, int it, int value) {
   Associable tInfo = getTaxaInfo(data, true);
   if (tInfo != null) {
     tInfo.setAssociatedLong(TNTtoAnalyze, it, value);
   }
 }