Skip to content

Commit

Permalink
Minor fix in plot backbone function.
Browse files Browse the repository at this point in the history
  • Loading branch information
TimHenrichsen committed Sep 2, 2023
1 parent bb1928d commit a51aa9b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions rDNA/rDNA/R/rDNA.R
Original file line number Diff line number Diff line change
Expand Up @@ -2611,7 +2611,7 @@ print.dna_backbone <- function(x, trim = 50, ...) {
#' @export
plot.dna_backbone <- function(x, ma = 500, ...) {

if (attr(object, "method") != "nested") {
if (attr(x, "method") != "nested") {
# temperature and acceptance probability
plot(x = x$diagnostics$iteration,
y = x$diagnostics$temperature,
Expand Down Expand Up @@ -2675,13 +2675,13 @@ plot.dna_backbone <- function(x, ma = 500, ...) {

# define merging pattern: negative numbers are leaves, positive are merged
# clusters
merges_clust <- matrix(nrow = nrow(object) - 1, ncol = 2)
merges_clust <- matrix(nrow = nrow(x) - 1, ncol = 2)

merges_clust[1,1] <- -nrow(object)
merges_clust[1,2] <- -(nrow(object) - 1)
merges_clust[1,1] <- -nrow(x)
merges_clust[1,2] <- -(nrow(x) - 1)

for (i in 2:(nrow(object) - 1)) {
merges_clust[i, 1] <- -(nrow(object) - i)
for (i in 2:(nrow(x) - 1)) {
merges_clust[i, 1] <- -(nrow(x) - i)
merges_clust[i, 2] <- i - 1
}

Expand All @@ -2692,7 +2692,7 @@ plot.dna_backbone <- function(x, ma = 500, ...) {
a$merge <- merges_clust

# Define merge heights
a$height <- object$backboneLoss[1:nrow(object) - 1]
a$height <- object$backboneLoss[1:nrow(x) - 1]

# Order of leaves
a$order <- 1:nrow(object)
Expand Down

0 comments on commit a51aa9b

Please sign in to comment.