Skip to content

Commit

Permalink
use D.taxa() and deprecate taxa(D) #110
Browse files Browse the repository at this point in the history
  • Loading branch information
walterxie committed Nov 22, 2020
1 parent 156a277 commit 9dea135
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion examples/dataModelBlocks.lphy
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
data {
D = readNexus(file="examples/primate.nex");
L = nchar(D);
taxa = D.getTaxa();
taxa = D.taxa();
}
model {
theta ~ LogNormal(meanlog=3, sdlog=1);
Expand Down
2 changes: 1 addition & 1 deletion examples/fullDataExample.lphy
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
data {
D = readNexus(file="examples/primate.nex");
L = nchar(D);
taxa = D.getTaxa();
taxa = D.taxa();
}
model {
theta ~ LogNormal(meanlog=3, sdlog=1);
Expand Down
2 changes: 1 addition & 1 deletion examples/h3n2.lphy
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
data {
options = {ageDirection="forward", ageRegex="_(\d*\.\d+|\d+\.\d*)$"};
D = readFasta(file="examples/h3n2_2deme.fna", options=options);
taxa = D.getTaxa();
taxa = D.taxa();
L = nchar(D);
demes = split(str=D.getTaxaNames(), regex="_", i=1);
}
Expand Down
2 changes: 2 additions & 0 deletions src/lphy/core/functions/TaxaFunction.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import java.util.Arrays;

@Deprecated
public class TaxaFunction extends DeterministicFunction<Taxa> {

final String paramName;
Expand All @@ -18,6 +19,7 @@ public TaxaFunction(@ParameterInfo(name = "taxa", description = "the taxa value
setParam(paramName, x);
}

@Deprecated
@GeneratorInfo(name="taxa",description = "The taxa of the given taxa-dimensioned object (e.g. alignment, tree et cetera).")
public Value<Taxa> apply() {
Value v = getParams().get(paramName);
Expand Down
20 changes: 13 additions & 7 deletions src/lphy/evolution/alignment/AbstractAlignment.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,24 @@ public AbstractAlignment(final AbstractAlignment source) {
public abstract boolean hasParts();


//****** Sites ******
//****** MethodInfo ******

@MethodInfo(description="The number of characters/sites in this alignment.")
public Integer nchar() {
return nchar;
}

@Override
@MethodInfo(description="The names of the taxa.")
public String[] getTaxaNames() {
return taxa.getTaxaNames();
}

@MethodInfo(description = "the taxa of the alignment.")
public Taxa taxa() {
return getTaxa();
}

//****** Taxa ******

@Override
Expand All @@ -109,18 +121,12 @@ public String getTaxonName(int taxonIndex) {
return getTaxon(taxonIndex).getName();
}

@Override
@MethodInfo(description="The names of the taxa.")
public String[] getTaxaNames() {
return taxa.getTaxaNames();
}

@Override
public Taxon[] getTaxonArray() {
return taxa.getTaxonArray();
}

@MethodInfo(description = "the taxa of the alignment.")
public Taxa getTaxa() {
return taxa;
}
Expand Down

0 comments on commit 9dea135

Please sign in to comment.