Skip to content

Commit

Permalink
Merge pull request #27 from wmaddisn/master
Browse files Browse the repository at this point in the history
Pender Harbour Mesquite hackathon Saturday
  • Loading branch information
wmaddisn committed Aug 23, 2014
2 parents 8b37c8d + b0a7433 commit f6d8f61
Show file tree
Hide file tree
Showing 49 changed files with 644 additions and 239 deletions.
20 changes: 18 additions & 2 deletions Source/mesquite/Mesquite.java
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ else if (prefsFile.exists() || prefsFileXML.exists()) {
try {
equiv = ImageIO.read(new File(MesquiteModule.getRootPath() + "images/equivocal.gif"));
} catch (IOException e) {
Debugg.println(" IOException trying to read equivocal texture ");
MesquiteMessage.println(" IOException trying to read equivocal texture ");
}
GraphicsUtil.missingDataTexture = new TexturePaint(equiv, new Rectangle(0, 0, 16, 16));

Expand Down Expand Up @@ -748,7 +748,7 @@ private void findMesquiteDirectory(){
String manualString = mesquiteDirectory + sep + "docs/mesquite" + sep + "manual.html";
File manual = new File(manualString);
storedManualString = manualString; //Debugg.println get rid of this stuff!
storedManualString = manualString;
}
setMesquiteDirectoryPath();
Expand Down Expand Up @@ -1479,6 +1479,18 @@ public void searchData(String s, MesquiteWindow window){
if (helpSearchManager != null)
helpSearchManager.searchData(s, window);
}

public String getNumModuleStarts() {
StringBuffer sb=new StringBuffer();
for (int i= 0; i<mesquiteModulesInfoVector.size(); i++){
MesquiteModuleInfo mmi = (MesquiteModuleInfo)mesquiteModulesInfoVector.elementAt(i);
int starts = mmi.getNumStarts();
if (starts>0)
sb.append(mmi.getClassName() + "\t" + starts+StringUtil.lineEnding());
}
return sb.toString();
}

/*.................................................................................................................*/
MesquiteInteger pos = new MesquiteInteger();
String noticeLocation = "http://"; //before release, change URL to "http://"
Expand Down Expand Up @@ -1820,7 +1832,11 @@ else if (checker.compare(this.getClass(), "Quits Mesquite", null, commandName, "
reportMemory();
logln("==^^^^^^^^^^^^^^^^^^^^==");
}

}
logln("\n");
logln("All modules that have been started at least once, and the number of times they have been started:");
logln(getNumModuleStarts());
/*
if (Listened.listenersRemaining>0) {
for (int i = 0; i<Listened.allListeners.size(); i++){
Expand Down
2 changes: 1 addition & 1 deletion Source/mesquite/align/MAFFTAlign/MAFFTAlign.java
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ public void appendDefaultOptions(StringBuffer shellScript, String inFilePath, St
if (!MesquiteTrunk.isWindows())
shellScript.append(" " + StringUtil.protectForUnix(inFilePath) + " > " + StringUtil.protectForUnix(outFilePath));
else
shellScript.append(" --out " + StringUtil.protectForUnix(outFilePath) + " " + StringUtil.protectForUnix(inFilePath)); //Debugg.println need to check MAFFT windows format
shellScript.append(" --out " + StringUtil.protectForUnix(outFilePath) + " " + StringUtil.protectForUnix(inFilePath));
}


Expand Down
2 changes: 1 addition & 1 deletion Source/mesquite/align/lib/ExternalSequenceAligner.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public String getQueryProgramOptions() {
}
/*.................................................................................................................*/
public boolean queryOptions() {
if (!okToInteractWithUser(CAN_PROCEED_ANYWAY, "Querying Options")) //Debugg.println needs to check that options set well enough to proceed anyway
if (!okToInteractWithUser(CAN_PROCEED_ANYWAY, "Querying Options"))
return true;
MesquiteInteger buttonPressed = new MesquiteInteger(1);
ExtensibleDialog dialog = new ExtensibleDialog(containerOfModule(), getProgramName() + " Locations & Options",buttonPressed); //MesquiteTrunk.mesquiteTrunk.containerOfModule()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public boolean startJob(String arguments, Object condition, boolean hiredByName)
}
/** returns true if the options are set and accepted.*/
public boolean queryOptions(){
if (!okToInteractWithUser(CAN_PROCEED_ANYWAY, "Querying Options")) //Debugg.println needs to check that options set well enough to proceed anyway
if (!okToInteractWithUser(CAN_PROCEED_ANYWAY, "Querying Options"))
return true;

MesquiteInteger buttonPressed = new MesquiteInteger(1);
Expand Down Expand Up @@ -64,7 +64,6 @@ public boolean stringsMatch(String s1, String s2) {
catch (Exception e) {
return false;
}
//Debugg.println("nextChars1: " + nextChars1 + ", nextChars2: " + nextChars2 + " " + nextChars1.equalsIgnoreCase(nextChars2));
if (StringUtil.blank(nextChars1) || StringUtil.blank(nextChars2))
return false;
return nextChars1.equalsIgnoreCase(nextChars2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ public CharacterData processFormat(MesquiteFile file, Taxa taxa, String dataType
data.setName(title); //because otherwise titles are not set for fused matrices within ManageCharacters, since on the outside they don't know if it's new
}
else {
if (fuse)
data.setSuppressSpecssetReading(true);
if (taxa == null)
taxa = data.getTaxa();
data.suppressChecksum = true;
Expand Down
44 changes: 25 additions & 19 deletions Source/mesquite/categ/ManageDNARNAChars/ManageDNARNAChars.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
This source code and its compiled class files are free and modifiable under the terms of
GNU Lesser General Public License. (http://www.gnu.org/copyleft/lesser.html)
*/
*/
package mesquite.categ.ManageDNARNAChars;

import java.util.*;
Expand All @@ -24,11 +24,11 @@
/* ========================================================================
Manages DNA and RNA data matrices */
public class ManageDNARNAChars extends CategMatrixManager {

/*.................................................................................................................*/
public boolean startJob(String arguments, Object condition, boolean hiredByName) {
return true;
}
}
public Class getDataClass(){
return DNAData.class;
}
Expand Down Expand Up @@ -64,7 +64,7 @@ public CharacterData processFormat(MesquiteFile file, Taxa taxa, String dataType
else
proj = getProject();
CategoricalData data= null;

//@@@@@@@@@@@@@@@@@@@@
boolean fuse = parser.hasFileReadingArgument(fileReadingArguments, "fuseTaxaCharBlocks");

Expand All @@ -82,8 +82,11 @@ public CharacterData processFormat(MesquiteFile file, Taxa taxa, String dataType
if (fuse)
data.setName(title); //because otherwise titles are not set for fused matrices within ManageCharacters, since on the outside they don't know if it's new
}
else
else {
if (fuse)
data.setSuppressSpecssetReading(true);
data.suppressChecksum = true;
}
((DNAData)data).setDisplayAsRNA(true);
}
else {
Expand All @@ -100,8 +103,11 @@ public CharacterData processFormat(MesquiteFile file, Taxa taxa, String dataType
if (fuse)
data.setName(title); //because otherwise titles are not set for fused matrices within ManageCharacters, since on the outside they don't know if it's new
}
else
data.suppressChecksum = true;
else{
if (fuse)
data.setSuppressSpecssetReading(true);
data.suppressChecksum = true;
}
}
data.interleaved = false; //reset default in case this is fused
//@@@@@@@@@@@@@@@@@@@@
Expand All @@ -117,7 +123,7 @@ else if (tok.equalsIgnoreCase("interleave")) {
if ("=".equals(e)){
String y = ParseUtil.getToken(formatCommand, stringPos); //yes or no ?
data.interleaved = ("yes".equalsIgnoreCase(y));

}
else {
stringPos.setValue(sp);
Expand Down Expand Up @@ -301,7 +307,7 @@ else if (file.writeOnlySelectedTaxa)
blocks.append(getCharStateLabels(data));

writeNexusMatrix(data, cB, blocks, file, progIndicator);

blocks.append( StringUtil.lineEnding());
if (!file.useSimplifiedNexus){
String idsCommand = null;
Expand All @@ -313,23 +319,23 @@ else if (file.writeOnlySelectedTaxa)
if (cB !=null)
blocks.append(cB.getUnrecognizedCommands() + StringUtil.lineEnding());
blocks.append("END;" + StringUtil.lineEnding());
// MesquiteModule.mesquiteTrunk.mesquiteMessage("DNA matrix composed", 1, 0);
// MesquiteModule.mesquiteTrunk.mesquiteMessage("DNA matrix composed", 1, 0);

file.writeLine( blocks.toString());
}


/*.................................................................................................................*/
public String getName() {
public String getName() {
return "Manage DNA/RNA matrices";
}
}

/*.................................................................................................................*/
/** returns an explanation of what the module does.*/
public String getExplanation() {
return "Manages DNA/RNA data matrices (including read/write in NEXUS file)." ;
}
/** returns an explanation of what the module does.*/
public String getExplanation() {
return "Manages DNA/RNA data matrices (including read/write in NEXUS file)." ;
}
}



Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,11 @@ public CharacterData processFormat(MesquiteFile file, Taxa taxa, String dataType
if (fuse)
data.setName(title); //because otherwise titles are not set for fused matrices within ManageCharacters, since on the outside they don't know if it's new
}
else
else {
if (fuse)
data.setSuppressSpecssetReading(true);
data.suppressChecksum = true;
}
//@@@@@@@@@@@@@@@@@@@@
String tok = ParseUtil.getToken(formatCommand, stringPos);
while (!tok.equals(";")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,11 @@ public boolean processFile(MesquiteFile file){
if (proj == null)
return false;
boolean success = true;
CompatibilityTest test = alterTask.getCompatibilityTest();
for (int im = 0; im < proj.getNumberCharMatrices(file); im++){
CharacterData data = proj.getCharacterMatrix(file, im);
//Debugg.println checkCompatibility

Debugg.println("Altering matrix " + im + " (" + data.getName() + ", id = " + data.getID() + ")");
success = success && alterTask.alterData(data, null, null);
if (test.isCompatible(data.getStateClass(), getProject(), this))
success = success && alterTask.alterData(data, null, null);
}

return success;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2246,7 +2246,7 @@ public boolean requestCellColorer(MesquiteModule mb, int ic, int it, String mess
if (ic >= 0 && it >= 0) { // matrix cells
if (table.cellColorer == mb)
return true;
if ((table.cellColorer == null || table.cellColorer instanceof mesquite.charMatrices.NoColor.NoColor) || (message != null && AlertDialog.query(this, "Cell colors", message, "Yes", "No"))) {
if ((table.cellColorer == null || table.cellColorer instanceof mesquite.charMatrices.NoColor.NoColor) && (message != null && AlertDialog.query(this, "Cell colors", message, "Yes", "No"))) {
setCellColorer(mb);
table.repaintAll();
return true;
Expand All @@ -2255,7 +2255,7 @@ public boolean requestCellColorer(MesquiteModule mb, int ic, int it, String mess
else if (ic < 0 && it >= 0) { // row names
if (table.rowNamesColorer == mb)
return true;
if ((table.rowNamesColorer == null || table.rowNamesColorer instanceof mesquite.charMatrices.NoColor.NoColor) || (message != null && AlertDialog.query(this, "Row name colors", message, "Yes", "No"))) {
if ((table.rowNamesColorer == null || table.rowNamesColorer instanceof mesquite.charMatrices.NoColor.NoColor) && (message != null && AlertDialog.query(this, "Row name colors", message, "Yes", "No"))) {
setRowNamesColorer(mb);
table.repaintAll();
return true;
Expand All @@ -2264,7 +2264,7 @@ else if (ic < 0 && it >= 0) { // row names
else if (ic >= 0 && it < 0) { // column names
if (table.columnNamesColorer == mb)
return true;
if ((table.columnNamesColorer == null || table.columnNamesColorer instanceof mesquite.charMatrices.NoColor.NoColor) || (message != null && AlertDialog.query(this, "Column name colors", message, "Yes", "No"))) {
if ((table.columnNamesColorer == null || table.columnNamesColorer instanceof mesquite.charMatrices.NoColor.NoColor) && (message != null && AlertDialog.query(this, "Column name colors", message, "Yes", "No"))) {
setColumnNamesColorer(mb);
table.repaintAll();
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,20 +157,20 @@ public void disposing(Object obj){

if (taxa !=null && taxa.isDoomed()) {
taxa = null;
if (!okToInteractWithUser(CAN_PROCEED_ANYWAY, "Taxa block that is in use has been deleted")) //Debugg.println needs to check that options set well enough to proceed anyway
if (!okToInteractWithUser(CAN_PROCEED_ANYWAY, "Taxa block that is in use has been deleted"))
return;

logln("Taxa null or being disposed; StoredMatrices will quit.");//Debugg.println
logln("Taxa null or being disposed; StoredMatrices will quit.");
iQuit();
return;

}
data = null;
dataName.setValue("No matrix is currently in use");
if (!okToInteractWithUser(CAN_PROCEED_ANYWAY, "Character matrix that is in use has been deleted")) //Debugg.println needs to check that options set well enough to proceed anyway
if (!okToInteractWithUser(CAN_PROCEED_ANYWAY, "Character matrix that is in use has been deleted"))
return;

discreetAlert("A character data matrix in use (for " + getEmployer().getName() + ") has been deleted. Another matrix will be sought."); //Debugg.println
discreetAlert("A character data matrix in use (for " + getEmployer().getName() + ") has been deleted. Another matrix will be sought.");
if (dataClass!=null) {
if (getProject().getNumberCharMatricesVisible(taxa, dataClass)<=0) {
alert("No compatible character matrices were found, and so Stored Matrices cannot be used.");
Expand Down
5 changes: 4 additions & 1 deletion Source/mesquite/cont/lib/ManageContCharsA.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,11 @@ public CharacterData processFormat(MesquiteFile file, Taxa taxa, String dataType
if (fuse)
data.setName(title); //because otherwise titles are not set for fused matrices within ManageCharacters, since on the outside they don't know if it's new
}
else
else {
if (fuse)
data.setSuppressSpecssetReading(true);
data.suppressChecksum = true;
}
data.interleaved = false; //reset default in case this is fused

//@@@@@@@@@@@@@@@@@@@@
Expand Down
2 changes: 1 addition & 1 deletion Source/mesquite/correl/lib/PagelMatrixModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ private double[] prepareQList(double[] values){

for (int i=0;i<qMapping.length;i++) {
if (qMapping[i]>= values.length)
Debugg.println("values length " + values.length + " [qMapping[i] " + qMapping[i]);
MesquiteMessage.println("values length " + values.length + " [qMapping[i] " + qMapping[i]);
qList[i] = values[qMapping[i]];
}
return qList;
Expand Down
4 changes: 4 additions & 0 deletions Source/mesquite/lib/EmployerEmployee.java
Original file line number Diff line number Diff line change
Expand Up @@ -1040,11 +1040,15 @@ private boolean startupEmployee(MesquiteModule mb, Class dutyClass, Object condi
started = mb.superStartJob(null, null, false);
if (started)
started = mb.startJob(null, null, false);
if (started)
mb.incrementNumStarts();
}
else {
started = mb.superStartJob(arguments, condition, false);
if (started)
started = mb.startJob(arguments, condition, false);
if (started)
mb.incrementNumStarts();
}
}
catch (Exception e) {
Expand Down
Loading

0 comments on commit f6d8f61

Please sign in to comment.