Skip to content

Commit

Permalink
Merge pull request #60 from MesquiteProject/fixingCodonPositionsWriti…
Browse files Browse the repository at this point in the history
…ng20161202

3.11 fix of bug writing codon positions
  • Loading branch information
wmaddisn authored Dec 3, 2016
2 parents cc1efa2 + e8b8c53 commit bbb7e30
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 16 deletions.
10 changes: 5 additions & 5 deletions Source/mesquite/Mesquite.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,24 @@ public class Mesquite extends MesquiteTrunk
{
/*.................................................................................................................*/
public String getCitation() {
return "Maddison, W.P. & D.R. Maddison. 2016. Mesquite: A modular system for evolutionary analysis. Version 3.1. http://mesquiteproject.org";
return "Maddison, W.P. & D.R. Maddison. 2016. Mesquite: A modular system for evolutionary analysis. Version 3.11. http://mesquiteproject.org";
}
/*.................................................................................................................*/
public String getVersion() {
return "3.1";
return "3.11";
}

/*.................................................................................................................*/
public int getVersionInt() {
return 310;
return 311;
}
/*.................................................................................................................*/
public double getMesquiteVersionNumber(){
return 3.10;
return 3.11;
}
/*.................................................................................................................*/
public String getDateReleased() {
return "June 2016"; //"April 2007";
return "December 2016"; //"April 2007";
}
/*.................................................................................................................*/
/** returns the URL of the notices file for this module so that it can phone home and check for messages */
Expand Down
7 changes: 4 additions & 3 deletions Source/mesquite/lib/MesquiteModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ public abstract class MesquiteModule extends EmployerEmployee implements Command
/*.................................................................................................................*/
/** returns build date of the Mesquite system (e.g., "22 September 2003") */
public final static String getBuildDate() {
return "27 June 2016";
return "3 Dec 2016";
}
/*.................................................................................................................*/
/** returns version of the Mesquite system */
public final static String getMesquiteVersion() {
return "3.10";
return "3.11";
}
/*.................................................................................................................*/
/*.................................................................................................................*/
Expand All @@ -90,7 +90,7 @@ public final static String getBuildLetter() {
public final static int getBuildNumber() {
//as of 26 Dec 08, build naming changed from letter + number to just number. Accordingly j105 became 473, based on
// highest build numbers of d51+e81+g97+h66+i69+j105 + 3 for a, b, c
return 765;
return 766;
}
//0.95.80 14 Mar 01 - first beta release
//0.96 2 April 01 beta - second beta release
Expand Down Expand Up @@ -134,6 +134,7 @@ public final static int getBuildNumber() {
//3.03 = 702 released 31 March 2015
//3.04 = 725 released 16 August 2015
//3.10 = 765 released 27 June 2016
//3.11 = 766 released 3 December 2016, fix of miswriting of codon positions
/*.................................................................................................................*/
/** returns a string if this is a special version of Mesquite */
public final static String getSpecialVersion() {
Expand Down
23 changes: 15 additions & 8 deletions Source/mesquite/lib/characters/CodonPositionsSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public String getListOfMatches(int targetPos, int offset, boolean[] include){
return getListOfMatches(targetPos, offset, include, false);
}
public String getListOfMatches(int targetPos, int offset, boolean[] include, boolean writeCommas){ //offset is number to add to character numbers

//this had been badly broken in 310 (commas written everywhere...
int lastWritten = -1;
int unassignedPosition=4;
String list = "";
Expand All @@ -109,17 +109,21 @@ public String getListOfMatches(int targetPos, int offset, boolean[] include, boo
int lastThird = endSequenceByThree(targetPos, getNumberOfParts(), ic, count, include, charNumberOfLastThird);
//if so, then go the series of thirds
if (lastThird != count){
if (writeSeparator)
list += ",";
if (writeSeparator) {
list += ", ";
writeSeparator=false;
}

list += " " + CharacterStates.toExternal(count+offset) + " - " + CharacterStates.toExternal(lastThird+offset) + "\\3";
ic = charNumberOfLastThird.getValue();
count = lastThird;

}
else { //otherwise write as normal*/
if (writeSeparator)
list += ",";
if (writeSeparator) {
list += ", ";
writeSeparator=false;
}
lastWritten = count;
list += " " + CharacterStates.toExternal(count+offset);
continuing = 1;
Expand All @@ -132,13 +136,16 @@ else if (continuing == 1) { // we know there are at least two in a row of the s
}
else if (continuing>0) { // we are in a contiguous stretch of the same thing
if (lastWritten != count-1){ // last one we wrote wasn't the one just before
if (writeSeparator)
list += ",";
if (writeSeparator) {
list += ", ";
writeSeparator=false;
}
list += " " + CharacterStates.toExternal(count-1+offset);
lastWritten = count-1;
}
else {
writeSeparator=true;
if (writeCommas)
writeSeparator=true;
lastWritten = -1;
}
continuing = 0;
Expand Down

0 comments on commit bbb7e30

Please sign in to comment.