From d42b69f3e2f9b6e0a392286d9db667d08e142552 Mon Sep 17 00:00:00 2001 From: Mariana P Braga Date: Mon, 12 Jan 2026 11:39:38 +0100 Subject: [PATCH 1/3] Fix access to host repertoire library --- inst/extdata/hostrep3states.tppl | 36 ++++++++++++++++---------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/inst/extdata/hostrep3states.tppl b/inst/extdata/hostrep3states.tppl index fde6526..7e82953 100644 --- a/inst/extdata/hostrep3states.tppl +++ b/inst/extdata/hostrep3states.tppl @@ -1,11 +1,11 @@ -import "host-rep-lib/lib.tppl" -import "host-rep-lib/container-types.tppl" -import "host-rep-lib/helpers.tppl" -import "host-rep-lib/belief-propagation.tppl" -import "host-rep-lib/dist-helpers.tppl" -import "host-rep-lib/full-model.tppl" -import "host-rep-lib/rb-drift-kernels.tppl" -import "host-rep-lib/independence-model.tppl" +import "treeppl::models/host-repertoire-evolution/host-rep-lib/lib.tppl" +import "treeppl::models/host-repertoire-evolution/host-rep-lib/container-types.tppl" +import "treeppl::models/host-repertoire-evolution/host-rep-lib/helpers.tppl" +import "treeppl::models/host-repertoire-evolution/host-rep-lib/belief-propagation.tppl" +import "treeppl::models/host-repertoire-evolution/host-rep-lib/dist-helpers.tppl" +import "treeppl::models/host-repertoire-evolution/host-rep-lib/full-model.tppl" +import "treeppl::models/host-repertoire-evolution/host-rep-lib/rb-drift-kernels.tppl" +import "treeppl::models/host-repertoire-evolution/host-rep-lib/independence-model.tppl" type ReturnType = ReturnType{ lambda: Real[], mu: Real, beta: Real, tree: HistoryTree @@ -54,7 +54,7 @@ model function rejectAccept( let leftMsg = mtxMul(newMsg, postorderTree.leftKernel); let rightMsg = mtxMul(newMsg, postorderTree.rightKernel); - // Construct an object containing the rate matrix in a suitable format for sampling + // Construct an object containing the rate matrix in a suitable format for sampling // from the embedded Markov chain let embeddedQMatrix = rateMatrixToEmbeddedMarkovChain(qMatrix); @@ -84,12 +84,12 @@ model function rejectAccept( beta = beta, tree = historyTree }; -} +} function suggestRepAligned(msg: Matrix[Real], i: Int, max: Int) => Int[] { if i <= max { let param = mtx3ToSeq(msg, i); - assume x ~ Categorical(param) drift categoricalMove(x, param); + assume x ~ Categorical(param) drift categoricalMove(x, param); return cons(x, suggestRepAligned(msg, i + 1, max)); } else { return []; @@ -115,7 +115,7 @@ function suggestRepRS(msg: Matrix[Real], max: Int, initialRep: Int[], depth: Int function suggestRepUnaligned(msg: Matrix[Real], i: Int, max: Int) => Int[] { if i <= max { let param = mtx3ToSeq(msg, i); - assume x ~ Categorical(param); + assume x ~ Categorical(param); return paste0([[x], suggestRepUnaligned(msg, i + 1, max)]); } else { return []; @@ -234,11 +234,11 @@ function sampleBranch( let orderedEvents = qSort(compAge, allHostEvents); let nEvents = length(orderedEvents); if allTimesValidBranch(startRep, orderedEvents, 1, nEvents, nhosts) { - // The branch is correct along the full history, + // The branch is correct along the full history, // accept and calculate the true weight of the sample - + // Calculate the debt -- this is the density of the endpoint conditioned - // (parallel) chains at the current sample. + // (parallel) chains at the current sample. let logDebt = independenceLikelihoodEndCond( startRep, finalRep, startAge, finalAge, unorderedBranch.history, modelParams, branchKernel ); @@ -274,17 +274,17 @@ function sampleBranch( logDebt = -log(0.0), logExcess = log(0.0), success = false - }; + }; } } function compAge(left: Event, right: Event) => Int { if (isNaN(right.eventTime)) { return -1; - } + } if (isNaN(left.eventTime)) { return 1; - } + } if (right.eventTime >= left.eventTime) { return 1; } else { From dd37fe6c91ad5e20418b78f1954ef410ffaeced8 Mon Sep 17 00:00:00 2001 From: Mariana P Braga Date: Mon, 12 Jan 2026 11:40:12 +0100 Subject: [PATCH 2/3] Fix links in Readme and add details --- README.md | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 1802e11..2e76b7b 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,15 @@ ## Overview -treepplr is the R Interface to [TreePPL](treeppl.org), a probabilistic programming language for phylogenetics. +treepplr is the R Interface to [TreePPL](https://treeppl.org), a probabilistic programming language for phylogenetics. -treepplr converts data to a format readable by TreePPL, reads the TreePPL output, and connects to downstream analyses in model-specific packages, such as the [evolnets](github.com/maribraga/evolnets) package for the host repertoire evolution model. +treepplr converts data to a format readable by TreePPL, reads the TreePPL output, +and connects to downstream analyses in model-specific packages, such as the +[evolnets](https://github.com/maribraga/evolnets) package for the host repertoire evolution model. -See the package's documentation [here](treeppl.org/treepplr). +See the package's documentation [here](https://treeppl.org/treepplr). There you +will find all package functions under [Reference](https://treeppl.org/treepplr/reference/index.html), +and basic examples of running various models under [Articles](https://treeppl.org/treepplr/articles/index.html). ## Installation @@ -14,8 +18,12 @@ See the package's documentation [here](treeppl.org/treepplr). You can install treepplr like so: ``` r -# install.packages("devtools") -# library(devtools) +if(!require("devtools", quietly = TRUE)) { + install.packages("devtools") + library(devtools) +} else { + library(devtools) +} devtools::install_github("treeppl/treepplr") ``` From 403c06b1e127e3fe823b0616709e6ca34ff64596 Mon Sep 17 00:00:00 2001 From: Mariana P Braga Date: Mon, 12 Jan 2026 11:40:25 +0100 Subject: [PATCH 3/3] Add R version dependency --- DESCRIPTION | 2 ++ 1 file changed, 2 insertions(+) diff --git a/DESCRIPTION b/DESCRIPTION index df8713d..3263b24 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -12,6 +12,8 @@ RoxygenNote: 7.3.3 URL: https://github.com/treeppl/treepplr, http://treeppl.org/treepplr/ BugReports: https://github.com/treeppl/treepplr/issues +Depends: + R (>= 4.1.0) Imports: assertthat, methods,