diff --git a/lphy-base/src/main/java/lphy/base/evolution/alignment/MetaDataAlignment.java b/lphy-base/src/main/java/lphy/base/evolution/alignment/MetaDataAlignment.java index 7bee64c2a..35378e92f 100644 --- a/lphy-base/src/main/java/lphy/base/evolution/alignment/MetaDataAlignment.java +++ b/lphy-base/src/main/java/lphy/base/evolution/alignment/MetaDataAlignment.java @@ -189,6 +189,24 @@ public Alignment charset(String str) { return AlignmentUtils.getCharSetAlignment(charSetBlocks, this); } + @MethodInfo(description="return an alignment array defined by charsets, which could be pre-defined in the nexus file.", + narrativeName = "character set", + category = GeneratorCategory.TAXA_ALIGNMENT, + examples = {"cpacific.lphy"}) + public Alignment[] charsets() { + if (hasCharsets(charsetMap)) { + List partitions = new ArrayList<>(); + for (Map.Entry> entry : charsetMap.entrySet()) { + List charSetBlocks = entry.getValue(); + SimpleAlignment alg = AlignmentUtils.getCharSetAlignment(charSetBlocks, this); + // TODO how to set id ? + partitions.add(alg); + } + return partitions.toArray(new Alignment[0]); + } + throw new IllegalArgumentException("Not charset is found !"); + } + // @MethodInfo(description="return a trait alignment, which contains the set of traits
" + // "extracted from taxa names in this alignment.
" + // "The sepStr is the substring to split the taxa names,
" + diff --git a/lphy-base/src/main/java/lphy/base/evolution/substitutionmodel/BinaryCovarion.java b/lphy-base/src/main/java/lphy/base/evolution/substitutionmodel/BinaryCovarion.java new file mode 100644 index 000000000..4b189b678 --- /dev/null +++ b/lphy-base/src/main/java/lphy/base/evolution/substitutionmodel/BinaryCovarion.java @@ -0,0 +1,151 @@ +package lphy.base.evolution.substitutionmodel; + +import lphy.core.model.Value; +import lphy.core.model.ValueUtils; +import lphy.core.model.annotation.GeneratorCategory; +import lphy.core.model.annotation.GeneratorInfo; +import lphy.core.model.annotation.ParameterInfo; +import lphy.core.model.datatype.DoubleArray2DValue; + +/** + * Description is copied from https://taming-the-beast.org/tutorials/LanguagePhylogenies/ : + * + * In the Binary Covarion model each character can have one of four states + * that are divided into visible states and hidden states. + * The visible ones are 0 and 1 and the hidden ones are fast and slow. + * Characters change their binary state at a rate 1 in the fast state and at rate alpha in the slow state. + * Furthermore, they are allowed to change from one of the hidden categories to another at a switch rate s. + * + * This implements the BEAST mode in BEAST 2. + */ +public class BinaryCovarion extends RateMatrix { + + public static final String AlphaParamName = "alpha"; + public static final String SwitchRateParamName = "s"; + public static final String vfreqParamName = "vfreq"; + public static final String hfreqParamName = "hfreq"; + + private final int NumOfStates = 4; + + public BinaryCovarion(@ParameterInfo(name = AlphaParamName, description = "the rate of evolution in slow mode.") Value alpha, + @ParameterInfo(name = SwitchRateParamName, description = "the rate of flipping between slow and fast modes") Value s, + @ParameterInfo(name = vfreqParamName, description = "the frequencies of the visible states") Value vfreq, + @ParameterInfo(name = hfreqParamName, description = "the frequencies of the hidden rates") Value hfreq, + @ParameterInfo(name = meanRateParamName, description = "the mean rate of the process. default = 1.0", optional = true) Value meanRate) { + + super(meanRate); // TODO this seems not used because of overwrites + + setParam(AlphaParamName, alpha); + setParam(SwitchRateParamName, s); + setParam(vfreqParamName, vfreq); + setParam(hfreqParamName, hfreq); + } + + @GeneratorInfo(name = "binaryCovarion", verbClause = "is", narrativeName = "Binary Covarion model", + category = GeneratorCategory.RATE_MATRIX, examples = {"cpacific.lphy"}, + description = "The rate matrix of the Covarion model for Binary data. It is equivalent to the BEAST mode.") + public Value apply() { + + double alpha = ValueUtils.doubleValue(getParams().get(AlphaParamName)); + double switchRate = ValueUtils.doubleValue(getParams().get(SwitchRateParamName)); + + double[] vfreq = ValueUtils.doubleArrayValue(getParams().get(vfreqParamName)); + double[] hfreq = ValueUtils.doubleArrayValue(getParams().get(hfreqParamName)); + + Double[][] unnormalizedQ = setupUnnormalizedQMatrix(alpha, switchRate, vfreq, hfreq); + Double[] freqs = getFrequencies(vfreq, hfreq); + + Double[][] Q = binaryCovarion(unnormalizedQ, freqs); + + return new DoubleArray2DValue(Q, this); + } + + private Double[][] binaryCovarion(Double[][] Q, Double[] freqs) { + + // set up diagonal + for (int i = 0; i < NumOfStates; i++) { + double sum = 0.0; + for (int j = 0; j < NumOfStates; j++) { + if (i != j) + sum += Q[i][j]; + } + Q[i][i] = -sum; + } + // normalise rate matrix to one expected substitution per unit time + normalize(freqs, Q); + + return Q; + } + + private Double[][] setupUnnormalizedQMatrix(double a, double s, double[] vf, double[] hf) { + double f0 = hf[0]; + double f1 = hf[1]; + double p0 = vf[0]; + double p1 = vf[1]; + + assert Math.abs(1.0 - f0 - f1) < 1e-8; + assert Math.abs(1.0 - p0 - p1) < 1e-8; + + Double[][] unnormalizedQ = new Double[NumOfStates][NumOfStates]; + + unnormalizedQ[0][1] = a * p1; + unnormalizedQ[0][2] = s; + unnormalizedQ[0][3] = 0.0; + + unnormalizedQ[1][0] = a * p0; + unnormalizedQ[1][2] = 0.0; + unnormalizedQ[1][3] = s; + + unnormalizedQ[2][0] = s; + unnormalizedQ[2][1] = 0.0; + unnormalizedQ[2][3] = p1; + + unnormalizedQ[3][0] = 0.0; + unnormalizedQ[3][1] = s; + unnormalizedQ[3][2] = p0; + + return unnormalizedQ; + } + + void normalize(Double[] freqs, Double[][] Q) { + double subst = 0.0; + int dimension = freqs.length; + + for (int i = 0; i < dimension; i++) { + subst += -Q[i][i] * freqs[i]; + } + + // normalize, including switches + for (int i = 0; i < dimension; i++) { + for (int j = 0; j < dimension; j++) { + Q[i][j] = Q[i][j] / subst; + } + } + + double switchingProportion = 0.0; + switchingProportion += Q[0][2] * freqs[2]; + switchingProportion += Q[2][0] * freqs[0]; + switchingProportion += Q[1][3] * freqs[3]; + switchingProportion += Q[3][1] * freqs[1]; + + //System.out.println("switchingProportion=" + switchingProportion); + + // normalize, removing switches + for (int i = 0; i < dimension; i++) { + for (int j = 0; j < dimension; j++) { + Q[i][j] = Q[i][j] / (1.0 - switchingProportion); + } + } + } + + private Double[] getFrequencies(double[] vf, double[] hf) { + Double[] freqs = new Double[NumOfStates]; + freqs[0] = vf[0] * hf[0]; + freqs[1] = vf[1] * hf[0]; + freqs[2] = vf[0] * hf[1]; + freqs[3] = vf[1] * hf[1]; + return freqs; + } + + +} diff --git a/lphy-base/src/main/java/lphy/base/spi/LPhyBaseImpl.java b/lphy-base/src/main/java/lphy/base/spi/LPhyBaseImpl.java index 31e641c53..024b3dd83 100644 --- a/lphy-base/src/main/java/lphy/base/spi/LPhyBaseImpl.java +++ b/lphy-base/src/main/java/lphy/base/spi/LPhyBaseImpl.java @@ -79,10 +79,8 @@ public List> declareFunctions() { return Arrays.asList(ARange.class, ArgI.class, // Substitution models JukesCantor.class, K80.class, F81.class, HKY.class, GTR.class, WAG.class, - GeneralTimeReversible.class, LewisMK.class, - NucleotideModel.class, - BModelSetFunction.class, - bSiteModelFunction.class, + GeneralTimeReversible.class, LewisMK.class, BinaryCovarion.class, + BModelSetFunction.class, bSiteModelFunction.class, NucleotideModel.class, // Data types BinaryDatatypeFunction.class, NucleotidesFunction.class, StandardDatatypeFunction.class, diff --git a/tutorials/cpacific.lphy b/tutorials/cpacific.lphy new file mode 100644 index 000000000..5a1e764b7 --- /dev/null +++ b/tutorials/cpacific.lphy @@ -0,0 +1,25 @@ +data { + bird = "55-56 189-190 370-371 596-597 635-636 737-738 16-18 42-44 64-66 67-69 225-227 233-235 255-257 305-307 321-323 392-394 480-482 483-485 486-488 533-535 566-568 629-631 632-634 667-669 670-672 688-690 870-872 908-910 977-979 995-997 1129-1131 1228-1230 1260-1262 1275-1277 12-15 19-22 172-175 258-261 395-398 399-402 440-443 499-502 592-595 650-653 733-736 866-869 904-907 1009-1012 1072-1075 1162-1165 1224-1227 1237-1240 1250-1253 1-5 176-180 191-195 214-218 228-232 272-276 300-304 338-342 352-356 365-369 387-391 410-414 421-425 469-473 569-573 654-658 714-718 817-821 831-835 849-853 854-858 1019-1023 1067-1071 1300-1304 1335-1339"; + and = "6-11 78-83 138-143 219-224 308-313 324-329 381-386 415-420 434-439 474-479 512-517 536-541 560-565 574-579 580-585 586-591 607-612 691-696 739-744 796-801 802-807 891-896 1013-1018 1061-1066 1203-1208 1231-1236 1254-1259 1305-1310 1319-1324 57-63 121-127 144-150 314-320 403-409 526-532 673-679 719-725 726-732 745-751 789-795 859-865 884-890 897-903 988-994 1046-1052 1076-1082 1209-1215 23-30 70-77 103-110 181-188 206-213 247-254 292-299 330-337 357-364 426-433 518-525 542-549 613-620 621-628 659-666 680-687 706-713 781-788 911-918 980-987 1053-1060 1216-1223 1311-1318 94-102 163-171 343-351 372-380 503-511 598-606 697-705 763-771 772-780 808-816 822-830 956-964 1241-1249 1278-1286 1351-1359 45-54 84-93 111-120 128-137 196-205 262-271 489-498 550-559 1036-1045 1094-1103 1132-1141 1142-1151 1152-1161 1325-1334"; + belly = "31-41 236-246 458-468 752-762 873-883 919-929 998-1008 1083-1093 1118-1128 1166-1176 1192-1202 1340-1350 151-162 965-976 1024-1035 1263-1274 637-649 836-848 930-942 943-955 1287-1299 444-457 1104-1117 277-291 1177-1191"; + D = readNexus(file="data/cpacific.nex"); + taxa = D.taxa(); + partitions = D.charset([bird, and, belly]); // TODO [b, a] cannot connect to b,a + // partitions = D.charsets(); // TODO returns Align[], but this cannot trigger vect + // L = nchar(partitions); // if cannot trigger vect, here will return 1 value, also nchar() is deprecated + L = partitions.nchar(); + rootAge = 100; +} +model { + alpha ~ Uniform(lower=1.0E-4, upper=1.0); + switchRate ~ Gamma(shape=0.05, scale=10.0); + Q = binaryCovarion(alpha=alpha, s=switchRate, vfreq=[0.5, 0.5], hfreq=[0.5, 0.5]); + + λ ~ Exp(mean=0.01); + mu ~ Exp(mean=0.01); + rho ~ Beta(alpha=22.0, beta=25.0); + + ψ ~ BirthDeath(lambda=λ, mu=mu, taxa=taxa, rootAge=rootAge); + + D ~ PhyloCTMC(tree=ψ, L=L, Q=Q); +} \ No newline at end of file diff --git a/tutorials/data/cpacific.nex b/tutorials/data/cpacific.nex new file mode 100644 index 000000000..50a3b57f0 --- /dev/null +++ b/tutorials/data/cpacific.nex @@ -0,0 +1,34 @@ +#NEXUS + +BEGIN DATA; + DIMENSIONS NTAX=20 NCHAR=1359; + FORMAT DATATYPE=binary MISSING=? GAP=-; +MATRIX +FijianBau 010000100000001010000101000000000000100000100100000000010100000010001001000000100000100000000010000000000100000001010000001000000100000000100000010000000000000001001000000010001000010000000101000000010000000000100010000000010010100001000110000100010000100110100000000100000001000001100000000000001000100001001000001000000100010000000000101010010000000010000010000001000010100001000001000010001000100100010000001000010000010000100000000100001100000010000000000010000000000100110000100100100000010000010000000010000010000000100010010001001000000000001010001000001000001001000000001000100000100000101000000100000010000000010001000001001001000001000000000010100001000000001010010000000010000001001000000000001010100000001000100000010000010001001010010000000011010000000010000000000001010000000100000000100010000010010000001000000001000100001000000000000100001000010000001000100000000100000100000001000001000010001001000000000000000010000000100000000000000000100100000000000001000001000100000001000000100100000000001000000101100000000000001000101000000010000000010001000000010010000000010000001010000000000010000100000000000000100000010010000000000001100000000000001010001000000000000001000000000010000010000000010100000000010000100010001000001000100000001000101000100010000000000100001000000100000000000010000010000000010000100000010000000010000001000000000100000 +EastFutuna 001000000010110010001000000100000101011000100001000000010000100001011010010100100000011000000010100000011010000000010000010010001010000000100000010100000001000000010000000010001000000100000101000011000000000101000010000100000100110001000000001100010000000110100000010000001000011000000000000000011000100001001110000010000100100100100000001010010100000001000110000000010010010000000110000100001001000110000011000100001100010000100000000100000010100001000000000100100000010000000010100110110100101100010001000000001000101100000010010001000001001101000000000100001000001000110011000011000010000011001010010001000010010000000100100001001001000000001000000100100001000000010010010000100100000001??????010100000010010000010001000000100000011001000100010101101000001010011100000010100000000001000001000010000001000000100000011000000100000100000101011101000100000100000101001000110001011000001001000110000100000000101001001000011010000000010010000000000100000000000100000000011110000000100010000010001001000000100000010000100000001000000000010000000100001001100100000000000101000010000001000100000001101000000000101000000000001000011000010000001000001100001000000001000001000011000000000110000100000000011000000001010010010001000000100010010100001001000100001000000100110000010000000100000001000010001000000010110101000110000000011000000001000100000100000000001000000 +Hawaiian 00100001000000101000100000010000001000000010001000000001001000000101101001000010000000000100001000000000000010000000010000000010000010000??????0000100010000000000010000000000100100000100000101000001000000001000010000100100000100100001001000000000010001000110100000100000000010000000000010000000000100100001000100000010000100100000010000001010000000010001000001000000100010010000000110000100001001000100010100001000001100?????000100000101000001000000100000000000000100000100000010010010011001000000001000010000000100010100000001001000100010000010000000001100000100000100001000010001100001000001100101000001000000100001000001000000100100100010000100000010?????00000100010010011000001000000001010000010000000010010000010000001000101100010001010000000010000000001100000101000010010100000000100100000001000000010011000000000010000000100110000000100011000100001000001001001000110000000001001000000100000100000010001001100000001000010000000000000100000010000000000100000000100000000000100010000000010001001000000000010001000001100010000000000000000010001000000000000101000001000010000001000010001000001000000000000000010000000000000010010001000000000000010000100000000001000100000000000000000010000001000000000001010000010010000000101010010010001000010000001000000100110000011000000110100000000010100000000010010101000111000001001000000100000000101000000000001000000 +Kapingamarangi 0000100100000010100010000000010000000100001000000000100100001000010110100001001000000110000000000000010100100000000100000000010000000010000001001000000000000001000000000100100010000010000001011000000000010????????010000100000100100001000001000000????????01101000000100000????????????????????00111000010000100010000001100010010000????????01010?????????0010001000000001000101000100001100001000010010001000101000001000011000100001000000011000000100000000000100000000000010100000000101001001000001000000100000001000010001001000000100100010??????01000000??????????01000001000110001000??????010000011001011000000000001????????00100000???0100101000000000000010?????01000000010010010000000000001001010000?????????000000010010000001000100100010001010000010100000000000010010000000010100100000010000001100010000000010000000001010000000100000100001000001100000100001000000100001000110000001000001000000010000000100????010????????010010110000000001000000?????????????000000001000100000000001000100000000100??????????????0100010000011000000000001000100001000000001001000000??????01000000100011000010000000000100100000000000000000101100001000010000001000000010000000000000100001000000000010001000000100000010000000000001010000111????????????01001010000100010000000100??????0110100000000000100010000000000010000000010010101000110000000010000000000100100000000000010000000001 +Luangiua 001000010000001010001001000100000000001000100001000000010000100001011010010000100000011000000000001000010010000000010000010010000001000000001000000010000010000000010100000????0100000010000010100100100000000010000001000001000010000010100100000000001000100011010000100000000010000000000000001000001100010000100011000001000010010000????????010000010000000010000100000?????01000000001011001010000100100010001010000010000000101000010000000000010001??????????????00100000000010000000010100100100000100000011001000000001000100101000010010001000100001000000000000010001000001000100011000??????001010001001011000000000001????????????????01001001000000001000001000100001000000010???010000000000010001??????0101000000100100000100010000001001000100010100000101010010000000000100000000100001000000100000000010100000010000110000000100000011000001000000010010010001000010000001000010001100000010000010000001000001000000111010010010000101001100000000010000000000000000010000010000000100000000001000010000000100010???????????0100??????0110000000010000000000010000100000010000000010000100001000000100000001000000100000000010000000000000010000000001000000000010000000100000000100000100000000010000010000000000001001100000000001000001000010000????01001010000100010000100100000010011000000000010010001000000?????????????0100101010001001000000100??????????0100000100000000000000100 +Mangareva 001000000100111010001000000100000010000000100010000000010010100001011000000010000010000000010010000000010010100100001000010010000000000100100000000100000000000010010000000010000100000010000101000001000000000100000010000100000100100001001000000000010001000110100011010000001000011000000000000000001100100001000000100011000100100000100000001010?????????00100000000100100001001000000011000010000100100010000001100100000110000001010000000100000001001000100000000000001000000100??????010010011001000000001000010000000100010010000001001000100010000010000000000000100100000100001001100000001001000001100101000001000000100001000010000000100100100000000000010010?????01001000010010011000000100000011??????000000010010010000010000000010100100010001010000000010000000001000000000001000010010000100000100000??????0000100001000000001000001000000001000000000000101000010000010010010001100011100000010000001000001000000100010010000000100101000000000000100000000010000000000001000001000000000001000001000000100010000000000010100010000011000001000000000000001000001000001000000??????01000010000001000100000000100000000100000010000000001010001000010000010000000000010000000000010001000000000001000000000100000000110000000001010000010010000000101010010100001001000001001000000100110000010000000100100000000000000000010010010000100110000000010000000100000100001000000000001000000 +Maori 0010000110000010110010000001000000000001001000100000000100000100010110001010001000000101000000100001000100100000000010000100101000100000001000000001000001000000000100010000100011000001000001010000000010000000010000001001000001001000010010000000000100010001101000000000001?????00000000000100000000001010000100010000001100010010000001000000101000000100000100000100000010001010000100011000010000100100010001010000100000000100100000010000101000001000000100000000000001000001000??????0100100110010000000010000000000101000101010000010010001000100000000100010011000001000001000010000100??????01000001100101000001001000100001000010000000100100100010000000000010?????01001000010010010001000001000001010000000000100010010000010000001000100100010001010000000010000000001000000000100000000010000100000000010010000000010011000000010000000100000100001000000000000100001000001001001000110100000000001000000100000100000010001001100000000000100000000000000010000010000000000000010000000000100000100001000000010001000001000000010000100001100010000000000000000100001000000100000001000001000010000001000000001000001000000000000000001000000000010000010000000010000000000100010000000001000000100000000000000001000000000001000001010000010000001000101010010100001001000000001000000100110000000100000110000000100010100000000001000000100111000000000100000100000100000000001000001000000 +Marquesan 00100001000000101000100001010000001000000010001001000001001100000101101001000010000001000000001000000001001010000010000001011000001100000010000000110001010000000000000010000100010000001000010101000100000000010000000010010000010010000100100000000001000100011010000110000100100000000000010000000001010010000100110000010000010010000010000000101000000100000100000010000010001000100000011000010000100100010101110000100000110001010001000000000100001000000100000000000001000000100??????010010011010010010001000000000100100010010000001101000100011000010001000010010000010000100001001000001100001000001100101000001000000100001000000001000100100101010001100000010001000100100001001001001000110000001101000001000000001001000001000001100010010001000101000000001000000000100001010000001110000000010000???????00100000001001100000001010000010000011000110000000100010000100000100100100011011010100000100000010000000001001000100100000001001011000000000001000000000001000000011000000000000001000010001000000010000100001000000001000100000110000100000000000001000000100000010000000010000100001000000100000000110000000001000010000110000000100000100001000101000000000001000010010000000100010000000001000000010000000110000000000001000001001000000010101001010000100000001000100000010011000101100000???0100000000010100000000010010101000111100000010000000100000101000000010000001000000 +Nukuoro 001000010000001010001001000000000101010000100000000001010000100001011010000000010000010000000?????????01001000000000000101001100100000000000001???????????????????00000000101000100000100000010110000100000000010000001000??????0100100001001000000000????????01101000000100000?????0000000100000000011100001000???0110000001100010010000001000000101000000100000100????????001000101000001001100001010010010001000101000001000011000100001000000001000000100000000000010???????????01000010001010010010??????????0100000001000010001001000000100100010??????0100000001000100000000010100010001100000100001000001100101100000000000100100000000000100100100100001000100000010?????010000000100100100000????????001010000?????????0100100000100???????0100100010001010000010100000100001010010000000010100100????????000110001000000100001100000001000000010000010000000011111000010000100000010000100011???????????0100000001000010000000010100100100001001011000??????????????????????????00001000000010000000000100000001???????01000000000010010000100001100????????????01000010000100000010000000000100100001000001100?????????????????????000100000000000110000100001000000100000000000100??????????????0000100000000100000000000001000100000000001000011100010000????01001010000100010000000100000010011000001000000010?????????001010000000001101010100011010000001000000000001?????00000000001????????? +RapanuiEasterIsland 001000010100001010001000000100000010001000100011000000010010100001011000101000100000000010000000110000000000010000001000000000100001000000100000001000000010000000010100000010000110000011000101000000000010000001000001100100000100100001001000000000010001000110010001000000000010010000000000000000010100100001000100000000100100100000000100001010000000100001000000100001000010100001000110000100001001000100???????0100000110001010000100000100000001000000100000000000000001000001000101010010011000000100001000000000100100010111000001001000100010000100010001000100000100000100001001100000001001000001100101000000000000100001000????????0100100100010000000000010?????001100000100010000001001000000010100000100000000000001000100000010001000000100010100000000100000000010000001000000101000000000000101000000010000100000000001000001000001000001000010011000100001000010000000010010001100001010000010000001000001000000100010000000100000010100000100000000000000000010000000001000000000000001001000100000000100010000001000000100000100?????0001000000000000001000010000001000000??????0100001000000100010000000010010110000000000000010000100001100001000000010000000001000000000100000100010000000000000010000000001000000000000001???????0100000001010100100000010000000010010000001001100000100000001000000100000000001000000110100000101000010??????00100000000100100000000100000000010 +Rarotongan 00100001000000101101100000010000001001100010000001100001001110000101101001000010000001110000001000000000000011000000100001001000000110000010000000010000100000000001000100001000110000010000010101000100000000010100000010010000010010000100100000000001100100011010000110000000101001010000000000000001100010000100010000001100010010000001000000101000000100000100000100000010001010001000011001010100100100010101010000100000000101000????????0101000001000110000000000000001000000100010000010010011001100000001010010000000100010111000001001000100010000010000000001100000100000100001001100000001001000001100101000001000000100011000010000000100100100010000100000010?????001100000100100110000001000000010001000100000000100100000100000110000011000100010000010101000000000010110010000000100001100001000000010000100000010000000010000100001001000001000010011000110001000010000010010010001100111010000010000001000001000000100010010000000100101100000111000000000000000001000001010100011000000000001010110000100110010000000100000100010000011000100000000000000001000010000001000000010000010000100000010000010010000011101000001100000000000000010001000100000010000000000011000010000000010000100000000010000001000000011101000001011100000100100000001010100101000010010000010010000001001100000100000001001001000000101000000000100101010001111000010111000001000001001???????????001000000 +Rennellese 001000010000001010001000001000000000001000100000100000010000100001011010000100100000011100000010000000010010000000010000010010000010000000100000100100000000100000010001000010001000000100000101000001000000000101000?????00100001001000010000001000000100010001101000000000100010000110000000000000000100001000010011100000100001001000000010000010100010000000010000000100011000100100000001100000010010010001000000110001000011000100001000000011000000100000000100000000010000000100001000101001001101000011000100010010000010001011000000100100010001000011000000010000000010000010000100110000010000100000110010100100010010110100000001000000010010010001000010000011001000????????0100100100000001000000010100000100000000110000000100010000000000010100010101000000010000000010100110000000101001000000010000010000100000010000001000000100000001000001000000001010110001000010000001000011001100000100000010000001000001100000101010010010000111100100000000000010000100000000000000010000000100100000001000100000100010010010000000000100??????0110000001000000000100000000100010010000000100000100001000000010000010000000000000100010100000000000100001100001000000100000010000100000000100000100000100000000000001000000001010000000000001000001000010000010001001010000100010000000100001010011000001000000010?????????0010001000000010010101000110100000011001000010000100000110000000001000000 +Rotuman 000100010000001010001001000000000000100000010000000100010010000???001010000000100000000000100010000000010000000000000010000001000010000000010000010000000000010000?????????0100?????000000010101000000000100000000001000010000100100100001000000000010????????0110100??????????00010000000000000100010000000001001000001000010000010000010100000001010011000000000100100000001000??00100000000001000001010????0100000000101000010000010000000000100100001100000000100000000000000100?????000001???0100100000000010010001000000000001000000010000101001000000101000000000000100001000001000001??????001000000001010001?????????000010010000000100000001001001000000100000000100001000000010010010010000000000100001010000010000000000001000010001000000000010000101000100010000000000100000000000010010100000????????010000001000000000100000001000010000000001000100100000000000000100001000000010001???00000000001000001000001001000000100001000001000000000001000000100000000000000000100000000010000000000010001000000100100010010000000010000001000010?????0000000100000000000010000000100001010??????000010100000010001000000001??????????000000000001000001000000001001010000000000000001000000100000010000001000000000000000010000000000001010000010000000000010010001000000101000000000010010000001010000000001000010000000001000000001000001000??????00000001000100??????????01000???????????000010000 +Samoan 001000010000001010001000000100000000001000100011000000010000100001011010010000100000010100000010000000010011000000010000010010101000000000100000101010000011000000010001000010000001000100000101000001000000001101010010000101000100100001001000000000010110000110100000011000001000010010010000000000001000100001001000000010000100100000010000000001010010100001000001000001100010000100000110000100001001010100010100001100001101010000100000000100000010000000001000000000010000010000100000100100110100001100010001000100001000101000000010010001100101001101000010001000001000001000100010000000110010000011001010101000011001000000100110000001001101000100000000000100100001001000010010010000100100000001010000010100000010010000110001000000100000010001010000010101100100000010010000000010100010001001000110000010000001010010100000010000000100000100000000101010000100001000000100001000110000010010001000000100000100000010001000010000010000010000010000000000001000000000000100000000010000000000100001000010011001001000000000010000100001100000000100000000000100001000100001000001000001000010000001000100000000100001000000001000000000000000000001010000000001000010000000000101000001000001000000000000000000010000001000000101110000010001000000100010000010001000100000000010000100110000110000000100100001000000010000000010110101000110000000010000001101000100001000100000001000000 +SouthIslandMaori ???????????0001???00100000010000000000001???0010000000??0000001001011????????010000000000000101000010001001000010000000001011000000000001010000000010000010000000001010000001000001000010000010001000000000010010000000100??????01001000010???????????01000100011010000000000010001000000000000000100001000000010100010000001100010??????0000001001010??????????????000000010000101010000100011000?????0100100010000001100001000000100100001000000101000001??????????????0000001000000100000010???01001001100010000100001000000010001000000010000001010??????0000010000000000010010000010001000100000000101000001000101000001000000100001000000000010100100100010000000000010?????????????01001001100000110000000101000000000100001001000001000000100010010001000101000000001000000000100000010100000000101000010000???????????????????01100000001000000010000010000000000000100000010100000001000100011000000100000100000??????0100000011001001100000000000110000000000000001?????????????000000100010000001000001000010000000001010000010000000100???????????0001000000000000001000010000001000000001000010000100000010000000110000??????????00100000000000000010000000100010000000????????????????????00100001000000000000000000000100000000100000101000001000000100010101001010000100100000000100??????011000000000001010?????????000000000000100100??????01110000000001??????????01000???????????001000000 +Tahitian 00100000010000101000100000010000001000000010000100000001001000000101100010100000100001100000000000001000000001001001000001001000000010000010000000010000100000000001000100001000010000000010010100000010000000001000000010010000010010000110000001000000000001011000100010000000100001010000000000000000100010000010010000001100010010100001000000111000000000100100000100000010001010001000011000010000010100010001010000100000001001010000100000101000001000100000000000000001000000100??????001010011000000000101000001000000110010110000001001000100010000001000000001100000101100100001000001000001001000000100101000001000000100000100010000000100100100000000000100010?????0011000001001000010000110000000101000000100000001001000000010000100010010001000101000000100000000000100100000100001000010000010000000100000001000010001100000001010000001000010000001000000000001000000100100100100???0000100000000010000100000100000010001001000000000000001000100000000000000001000000001000000000100000000000100001000000010001000001000000010001000000010001000000000000000100001000000010000000010000100001001001000000001000001000000000000010000000000000000100001000001000000000000100000010000001000100000000010000000000000000000000100010000000010000000010101001010100000100000001001000000100110000000001000110000100000010100000000010010000100111000001001000000100000000101000000000001000000 +Tikopia 00100001001000101000100000001000100001100010??????????010000100001011010000100100000011000000010000000010010000000010000010010001000000000100000010100????????????01001000001000100000010000010100000100000000010000001000010000010010000100000000010000010000011010000100000000001001000000100000000001100010000100011000001000010??????????????01010010000000001000001000000100010010000000110000100001001000100010100000100000001010000100011000100000010010000000000001000000000010000100010100100100100000100010001000000001000100100000010010001000100001001000010001000001000001000100010000??????0100000110010101000000010000010000001000000010010010011000010000011000001????????010010010000000100000001010000000010000010010000010001000000100000011001010100010110100000000010010000000010100010????????00010000100000010000001000000100000101000001000000010011010001000010000001000010001100000010000010000000000101000000100010011000000110000100000110100000000010001000000000010000000101000000001000100000000100???00000000100010000100001100000000001000000000000101000100100000001000001000010000001000100000000100100000000001000000000001000011000010000001000000000001000000001000001000001000000???????????????01001100000000001000001101000000010001001010000100010000000100000010011010001000000010?????????00110000000000100101010001100000000110??????????0100000110000000011000000 +Tongan 001000000010001010001000100000000000100000100001100000010000100001001010000100100000010000000010000000001000000000010000010010000000010000100000000001000000001000010000000010001000000100000101000001000000000001000010000100000100100001000000000001010000000110100000001000000010010010000000000000001000110001001000000010000100100000000010001010010000000001000001000001000010010000000110000100001001000110000011000100001100010000000100000100000010000000000100000000100000001000000100100100100100001000010001000000000001001000000010010001000010000100000010001000001000001000100010000000100010000010001000001000000100010000000100000001001001000000000110000100100000000001010010000000100100000001010000010000000010000000010001000000100000010001000100000001000000100010010000000010100000000001000110000010000001000010100000000100010100000100000000000000100100001000000100001000110000010000000000010100000000001010001000000001010000000000010000000000001000000000000100000000010000000000100001000010001001000000100000010000100001100000001000000000000100000001000100000001000001000010000100000100000000101000000000010000000000000000010000010000001000000010000000000001000001000000001000000000001000000000001000000000010001000001000000110010010100001000000100001000000100110000100000000100000001000000000001000010010101000110000000010000000001000100001000000000000001000 +Tuamotu 00100??????000101100100000010001001001100010001000000001001110000101101000010000010001100000001100000001001011000000100001001000000100000010000000010001000000000001000100001000010000000100010100000100000000010000000010010000010000100100100000000001100100011010000110000000001001010000000000000001100010000100110000000001010??????0010000001010?????????00100000100000110001001000000011000010100100100010001010000100000100001000000100000111000001001000000000000000001000001100010000010010011000100000001000000000100100010111000001001000100010000110000000001100000100000100001001100000001001000001100101000001000000100001000????????0010100100010000100000010?????00010000010010011000001100000001000010010000000????????010000000100000110001000101000001010000000000111101110000001000011000010000000100000000100100001100000001000?????????010000010000000100011000100000100100100011010110100000100000010000010000001000100110000001001011000000010000000000000100000000100001000110000000000010000100000001000100001000000001000100000110000100000000000000010000100000010000000100000100001000000100010000100010110010000000000000000100100001100001000000100000100001100000101000000100001000000000100000010000001101000000000101000001001000000010101001010000100000000100100??????0110000010000000100010000000000000000100011010000100111100001011100000100000100001000000000001000000 +EastUvea ?????00000100010100010????????001000011000100001000000010000100001001??????????????0011000000010000000010010100000010000010010001010000000100000010100????????????010000000010001000????????01010000110000000?????????????00100001001000???0000000100001000100011010000001100000100001100000000000000001100?????0100100000001000010010000????????01010?????????00001000100000101001001000000011000?????010010001100101000000010011000100000001000001000????000000000000010000001000001000010001010010???0000100000010001000000001000101000000010010001000010000100000010001000001000001000110011000001000010000????010000010000010000100000001001000010010010010000000000?????????01001000010010000000100100000???000001010000000????????0010001000100100000011001010100000001001000101010011000000010100000????????0110000010000001000000100000011000010100000100000101011100000100001000000100001000110001001000001000000110000100000010101001001000011010010000011110000000?????????????00100000000011100000000100001000010011001000000100000010000100001100??????????????????????00001000100000001000001000010000001000101000000100000100000100001000000001000011000010??????????0100000100000000100000100001100000000011000000000000001000000010011000001000100000????010010100001000001000001000000100110000010000000100000001000010001000000010110101000110000000011000000001000100001000000000001000000 +; +END; + +begin assumptions; + charset bird = 55-56 189-190 370-371 596-597 635-636 737-738 16-18 42-44 64-66 67-69 225-227 233-235 255-257 305-307 321-323 392-394 480-482 483-485 486-488 533-535 566-568 629-631 632-634 667-669 670-672 688-690 870-872 908-910 977-979 995-997 1129-1131 1228-1230 1260-1262 1275-1277 12-15 19-22 172-175 258-261 395-398 399-402 440-443 499-502 592-595 650-653 733-736 866-869 904-907 1009-1012 1072-1075 1162-1165 1224-1227 1237-1240 1250-1253 1-5 176-180 191-195 214-218 228-232 272-276 300-304 338-342 352-356 365-369 387-391 410-414 421-425 469-473 569-573 654-658 714-718 817-821 831-835 849-853 854-858 1019-1023 1067-1071 1300-1304 1335-1339; + charset and = 6-11 78-83 138-143 219-224 308-313 324-329 381-386 415-420 434-439 474-479 512-517 536-541 560-565 574-579 580-585 586-591 607-612 691-696 739-744 796-801 802-807 891-896 1013-1018 1061-1066 1203-1208 1231-1236 1254-1259 1305-1310 1319-1324 57-63 121-127 144-150 314-320 403-409 526-532 673-679 719-725 726-732 745-751 789-795 859-865 884-890 897-903 988-994 1046-1052 1076-1082 1209-1215 23-30 70-77 103-110 181-188 206-213 247-254 292-299 330-337 357-364 426-433 518-525 542-549 613-620 621-628 659-666 680-687 706-713 781-788 911-918 980-987 1053-1060 1216-1223 1311-1318 94-102 163-171 343-351 372-380 503-511 598-606 697-705 763-771 772-780 808-816 822-830 956-964 1241-1249 1278-1286 1351-1359 45-54 84-93 111-120 128-137 196-205 262-271 489-498 550-559 1036-1045 1094-1103 1132-1141 1142-1151 1152-1161 1325-1334; + charset belly = 31-41 236-246 458-468 752-762 873-883 919-929 998-1008 1083-1093 1118-1128 1166-1176 1192-1202 1340-1350 151-162 965-976 1024-1035 1263-1274 637-649 836-848 930-942 943-955 1287-1299 444-457 1104-1117 277-291 1177-1191; +end;