Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

https://forge.inrae.fr/scales/treediff.git
23 July 2025, 17:13:49 UTC
  • Code
  • Branches (4)
  • Releases (0)
  • Visits
    • Branches
    • Releases
    • HEAD
    • refs/heads/main
    • refs/tags/0.2.1
    • refs/tags/v0.1
    • refs/tags/v0.2
    • f060379f1ef7604e07a6354568d372fe3ccef64b
    No releases to show
  • c7205de
  • /
  • man
  • /
  • treediff.Rd
Raw File Download Save again
Take a new snapshot of a software origin

If the archived software origin currently browsed is not synchronized with its upstream version (for instance when new commits have been issued), you can explicitly request Software Heritage to take a new snapshot of it.

Use the form below to proceed. Once a request has been submitted and accepted, it will be processed as soon as possible. You can then check its processing state by visiting this dedicated page.
swh spinner

Processing "take a new snapshot" request ...

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
  • revision
  • snapshot
origin badgecontent badge
swh:1:cnt:2c65e9f3fd728ec88c4d06b43abba4ce46173268
origin badgedirectory badge
swh:1:dir:93379ae2ac7d7f36f88572656dbc524f3a1a2053
origin badgerevision badge
swh:1:rev:f060379f1ef7604e07a6354568d372fe3ccef64b
origin badgesnapshot badge
swh:1:snp:c36295817c399bf58e154ba758a9746fb381d408

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
  • revision
  • snapshot
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
Tip revision: f060379f1ef7604e07a6354568d372fe3ccef64b authored by Nathalie Vialaneix on 20 February 2024, 16:16:21 UTC
Merge branch 'dev' into 'main'
Tip revision: f060379
treediff.Rd
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/treediff.R
\name{treediff}
\alias{treediff}
\alias{summary.treeTest}
\alias{print.treeTest}
\title{Perform the treediff test}
\usage{
treediff(trees1, trees2, replicates, scale = FALSE, order_labels = FALSE)

\method{print}{treeTest}(x, ...)

\method{summary}{treeTest}(object, ...)
}
\arguments{
\item{trees1}{A list of trees corresponding to the first condition (set).
Trees are structured into groups (or clusters) with the same number of
replicates in each group. Trees are ordered by groups and then by replicates:
\{group1+rep1, group1+rep2, ...\}. One test is performed for each group.}

\item{trees2}{A list of trees corresponding to the second condition. Trees
are also structured in groups (or clusters) that are exactly the same than
for the first condition. The number of replicates in each group can be
different from that of \code{trees1}.}

\item{replicates}{A numeric vector of length 2 with the number of replicates
for each condition.}

\item{scale}{Logical. If \code{TRUE}, the trees are all rescaled to have a
minimum height equal to 0 and a maximum height equal to 1. Default to
\code{FALSE}.}

\item{order_labels}{Logical. If \code{TRUE}, align leaves ordering in all
trees (required if your trees don't have their leaves ordered identically).
Default to \code{FALSE}.}

\item{x}{a \code{treeTest} object to print}

\item{...}{not used}

\item{object}{a \code{treeTest} object to print}
}
\value{
An object of class \code{treeTest} with the following entries:
\item{p.value}{ the p-value for the treediff test.}
\item{statistic}{ the value of the Student's statistic of each leaf pair of
the tree test.}
\item{p.value.indiv}{ the p-value of the Student's test for each leaf pair of
 the tree test.}
\item{method}{ a character string indicating what type of test was 
performed.}
\item{data.name}{ a character string giving the names of the tree 
conditions.}
}
\description{
Perform the treediff test to compare two sets of trees.
}
\details{
This function compares two sets of trees using a p-value aggregation
method. The p-values are obtained by the treediff method, as described in
(Neuvial \emph{et al.}, 2023).
}
\examples{
leaves <- c(100, 120, 50, 80)

trees <- sapply(leaves, FUN = function(leaf) {
  base_data <- matrix(rnorm(2000), nrow = leaf, ncol = 200)

## generates two sets of trees with 4 clusters with 100, 120, 50 and 80
## leaves respectively
## 4 replicates in the first condition and 6 in the second condition

  set1 <- replicate(4, sample(1:100, 50, replace = FALSE))
  set2 <- replicate(6, sample(101:200, 50, replace = FALSE))

  trees1 <- apply(set1, 2, function(asample) {
    samples <- base_data[, asample]
    out <- hclust(dist(samples), method = "ward.D2")
    return(out)
  })

  trees2 <- apply(set2, 2, function(asample) {
    samples <- base_data[, asample]
    out <- hclust(dist(samples), method = "ward.D2")
    return(out)
  })
  return(list("trees1" = trees1, "trees2" = trees2))
})

trees1 <- unlist(trees[1, ], recursive = FALSE)
trees2 <- unlist(trees[2, ], recursive = FALSE)
replicates <- c(4, 6)

tree_pvals <- treediff(trees1, trees2, replicates)
## 4 p-values, one for each cluster
tree_pvals$p.value
}
\references{
Neuvial Pierre, Randriamihamison Nathanaël, Chavent Marie,
Foissac Sylvain and Vialaneix Nathalie (2024) A two-sample tree-based test 
for hierarchically organized genomic signals. \emph{Journal of the Royal
Statistical Society, Series C}, \emph{Forthcoming}.
}
\author{
Gwendaëlle Cardenas\cr
Marie Chavent \email{marie.chavent@u-bordeaux.fr}\cr
Sylvain Foissac \email{sylvain.foissac@inrae.fr}\cr
Pierre Neuvial \email{pierre.neuvial@math.univ-toulouse.fr}\cr
Nathanaël Randriamihamison\cr
Nathalie Vialaneix \email{nathalie.vialaneix@inrae.fr}
}

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API