Skip to content

Commit

Permalink
Cannot load Codon data type #8
Browse files Browse the repository at this point in the history
  • Loading branch information
walterxie committed Nov 11, 2022
1 parent 999c974 commit d7e0379
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 14 deletions.
6 changes: 5 additions & 1 deletion buildCodonSM.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@
BEASTV="2.7"
PKG="CodonSubstModels"
VERSION="2.0.0"
# mkdir ~/Library/Application\ Support/BEAST/$BEASTV/$PKG
if [ ! -d "~/Library/Application Support/BEAST/$BEASTV/$PKG" ]; then
mkdir ~/Library/Application\ Support/BEAST/$BEASTV/$PKG
fi
ant build
cp dist/$PKG.v$VERSION.zip ~/Library/Application\ Support/BEAST/$BEASTV/$PKG/tmp.zip
cd ~/Library/Application\ Support/BEAST/$BEASTV/$PKG/
unzip -o tmp.zip
cd ~/WorkSpace/$PKG

ls -l ~/Library/Application\ Support/BEAST/$BEASTV/$PKG

echo "----Done----"

6 changes: 3 additions & 3 deletions fxtemplates/CodonSubstModels.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
codonmodels.M0Model.rates,
codonmodels.M0Model.eigenSystem,
codonmodels.M0Model.verbose'
buttonLabelMap='beast.app.beauti.BeautiInitDlg.>> details=Edit parameters'
buttonLabelMap='beastfx.app.beauti.BeautiInitDlg.>> details=Edit parameters'
>
<!--disableMenus='Mode'-->

Expand Down Expand Up @@ -169,7 +169,7 @@
<alignmentProvider id="Codon Alignment" spec='codonmodels.app.beauti.CodonAlignmentProvider' template='@CodonPartitionTemplate'/>


<partitiontemplate id='CodonPartitionTemplate' spec='BeautiSubTemplate' class='beast.base.evolution.likelihood.ThreadedTreeLikelihood' mainid='mcmc'>
<partitiontemplate id='CodonPartitionTemplate' spec='beastfx.app.inputeditor.BeautiSubTemplate' class='beast.base.evolution.likelihood.ThreadedTreeLikelihood' mainid='mcmc'>
<![CDATA[
<!-- site model -->
<plugin spec='SiteModel' id="SiteModel.s:$(n)" gammaCategoryCount='0'>
Expand Down Expand Up @@ -247,7 +247,7 @@

<connect srcID='treelog.t:$(n)' targetID='mcmc' inputName='logger' if='inposterior(Tree.t:$(n)) and Tree.t:$(n)/estimate=true'/>
<connect srcID='RandomTree.t:$(n)' targetID='mcmc' inputName='init' if='isInitializing'/>
<connect method="beast.app.beauti.StateNodeInitialiserListInputEditor.customConnector"/>
<connect method="beastfx.app.beauti.StateNodeInitialiserListInputEditor.customConnector"/>

<connect srcID='ClockPrior.c:$(n)' targetID='prior' inputName='distribution' if='inlikelihood(clockRate.c:$(n)) and clockRate.c:$(n)/estimate=true'/>
<!-- when FixMeanMutationRatesOperator, the prior is uniform due to the operator -->
Expand Down
4 changes: 2 additions & 2 deletions src/codonmodels/evolution/alignment/CodonAlignment.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ public CodonAlignment(Alignment alignment, GeneticCode geneticCode) {
if (this.m_dataType == null || !this.m_dataType.getTypeDescription().equals(Codon.CODON)) {
DataType oldType = this.m_dataType;
this.m_dataType = new Codon(geneticCode);
Log.warning.println("Warning: CodonAlignment (" + this.getID() + ") original data type was " +
oldType + ", is corrected to " + this.m_dataType + " - " + geneticCode.getDescription() + " !");
Log.warning.println("Warning: find CodonAlignment (" + this.getID() + ") is not a Codon data type (" +
oldType + "), so set it to : " + this.m_dataType + " - " + geneticCode.getDescription() + " !");
}
initAndValidate();
}
Expand Down
3 changes: 2 additions & 1 deletion src/codonmodels/evolution/datatype/Codon.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@

import beast.base.core.Input;
import beast.base.core.Log;
import beast.base.evolution.datatype.DataType;
import beast.base.evolution.datatype.Nucleotide;

import java.util.Arrays;
import beast.base.evolution.datatype.DataType;

/**
* Implements DataType for codon,
Expand Down
14 changes: 13 additions & 1 deletion test/codonmodels/evolution/alignment/CodonAlignmentTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@

import beast.base.evolution.alignment.Alignment;
import beast.base.evolution.alignment.Sequence;
import beast.base.evolution.datatype.DataType;
import beast.pkgmgmt.BEASTClassLoader;
import codonmodels.evolution.CodonData;
import codonmodels.evolution.datatype.Codon;
import org.junit.Test;

import java.util.List;
import java.util.Set;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import static junit.framework.Assert.assertEquals;

/**
* @author Walter Xie
Expand All @@ -30,6 +35,13 @@ public void testGetSequence() {
}
}

@Test
public void testGettingDataType() {
Set<String> dataTypes = BEASTClassLoader.loadService(DataType.class);
System.out.println(dataTypes);
assertTrue("Cannot load Codon data type !", dataTypes.contains(Codon.CODON));
}

@Test
public void testCodonUsage() {
Alignment data = CodonData.getAlig6T333();
Expand Down
2 changes: 1 addition & 1 deletion test/codonmodels/evolution/datatype/CodonTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import java.util.Arrays;
import java.util.List;

import static junit.framework.Assert.*;
import static org.junit.Assert.*;

/**
* @author Walter Xie
Expand Down
1 change: 0 additions & 1 deletion test/codonmodels/evolution/datatype/GeneticCodeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import java.util.Arrays;

import static junit.framework.Assert.assertEquals;
import static org.junit.Assert.*;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import java.util.Arrays;

import static junit.framework.Assert.assertEquals;
import static org.junit.Assert.assertEquals;


/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import java.util.Arrays;

import static junit.framework.Assert.assertEquals;
import static org.junit.Assert.assertEquals;

/**
* Build transition probability matrices under 3-node tree,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.junit.Before;
import org.junit.Test;

import static junit.framework.Assert.assertEquals;
import static org.junit.Assert.assertEquals;

/**
* @author Walter Xie
Expand Down
2 changes: 1 addition & 1 deletion test/codonmodels/evolution/substmodel/M0ModelTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import java.util.Arrays;
import java.util.stream.DoubleStream;

import static junit.framework.Assert.assertEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

/**
Expand Down
1 change: 1 addition & 0 deletions version.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<provider classname="codonmodels.CodonSubstitutionModel"/>
<provider classname="codonmodels.evolution.alignment.CodonAlignment"/>
<provider classname="codonmodels.evolution.datatype.Codon"/>
<!-- <provider classname="codonmodels.evolution.datatype.GeneticCode"/>-->
<provider classname="codonmodels.evolution.likelihood.DataAugTreeLikelihood"/>
<provider classname="codonmodels.evolution.likelihood.GenericDATreeLikelihood"/>
<provider classname="codonmodels.evolution.operators.GibbsSamplingOperator"/>
Expand Down

0 comments on commit d7e0379

Please sign in to comment.