/*...............................................................................................................*/ public void setTableAndTaxa(MesquiteTable table, Taxa taxa) { // if (this.data !=null) // this.data.removeListener(this); if (taxa != this.taxa) observedStates = null; this.taxa = taxa; matrixSourceTask.initialize(taxa); this.table = table; doCalcs(); }
public void doCalcs() { if (bits != null) bits.clearAllBits(); if (taxa == null) return; if (bits == null) bits = new Bits(taxa.getNumTaxa()); else bits.resetSize(taxa.getNumTaxa()); if (observedStates == null) { tInfo = null; observedStates = matrixSourceTask.getCurrentMatrix(taxa); if (observedStates != null) { captureCharacterDataFromObservedStates(); if (data != null) tInfo = data.getTaxaInfo(true); } } if (observedStates == null) return; for (int it = 0; it < taxa.getNumTaxa(); it++) { if (hasData(it)) bits.setBit(it); } }
public void calculateNumber(Taxon taxon, MesquiteNumber result, MesquiteString resultString) { if (result == null) return; clearResultAndLastResult(result); Taxa taxa = taxon.getTaxa(); int it = taxa.whichTaxonNumber(taxon); if (taxa != currentTaxa || observedStates == null) { observedStates = matrixSourceTask.getCurrentMatrix(taxa); currentTaxa = taxa; } if (observedStates == null || !(observedStates.getParentData() instanceof DNAData)) return; DNAData data = (DNAData) observedStates.getParentData(); int count = data.getAminoAcidNumbers(it, ProteinData.TER, countEvenIfOthers.getValue()); if (result != null) result.setValue(count); if (resultString != null) resultString.setValue( "Number of stop codons in taxon " + observedStates.getName() + ": " + count); saveLastResult(result); saveLastResultString(resultString); }
/** * Called to provoke any necessary initialization. This helps prevent the module's intialization * queries to the user from happening at inopportune times (e.g., while a long chart calculation * is in mid-progress) */ public void initialize(Taxa taxa) { currentTaxa = taxa; matrixSourceTask.initialize(currentTaxa); }
public String getParameters() { return "Number of stops coded by nucleotides in taxon in matrix from: " + matrixSourceTask.getParameters(); }