Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
treediff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
A compter du 1er avril, attention à vos pipelines :
Nouvelles limitations de Docker Hub
Show more breadcrumbs
SCALES
treediff
Commits
c0217284
Commit
c0217284
authored
2 years ago
by
Nathalie Vialaneix
Browse files
Options
Downloads
Patches
Plain Diff
very minor corrections in code
parent
849278dd
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
NAMESPACE
+3
-0
3 additions, 0 deletions
NAMESPACE
R/treediff.R
+16
-15
16 additions, 15 deletions
R/treediff.R
man/treediff.Rd
+11
-10
11 additions, 10 deletions
man/treediff.Rd
with
30 additions
and
25 deletions
NAMESPACE
+
3
−
0
View file @
c0217284
# Generated by roxygen2: do not edit by hand
export(fisher_mix)
export(treediff)
importFrom(dplyr,"%>%")
importFrom(dplyr,group_by)
importFrom(dplyr,summarise)
importFrom(limma,squeezeVar)
importFrom(reshape2,colsplit)
importFrom(stats,cophenetic)
importFrom(stats,pt)
importFrom(stats,rf)
This diff is collapsed.
Click to expand it.
R/treediff.R
+
16
−
15
View file @
c0217284
...
...
@@ -17,7 +17,8 @@
#' @param replicates A numeric vector of length 2 with the number of replicates
#' for each condition.
#'
#' @return An object of class \code{treeTest} with the following entries: \itemize{
#' @return An object of class \code{treeTest} with the following entries:
#' \itemize{
#' \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.}
...
...
@@ -29,10 +30,11 @@
#' conditions.}
#' }
#'
#' @author Pierre Neuvial \email{pierre.neuvial@math.univ-toulouse.fr}\cr
#' Nathanaël Randriamihamison\cr
#' @author Gwendaelle Cardenac\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}
#'
#' @references Neuvial Pierre, Randriamihamison Nathanaël, Chavent Marie,
...
...
@@ -52,11 +54,10 @@
#'
#'
#' @examples
#' leaves <- c(100, 120, 50, 80)
#'
#' leaves <- c(100,120,50,80)
#'
#' trees <- sapply(leaves, FUN = function(l){
#' base_data <- matrix(rnorm(2000), nrow = l, ncol = 200)
#' 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
...
...
@@ -79,22 +80,22 @@
#' return(list("trees1" = trees1, "trees2" = trees2))
#' })
#'
#' trees1 <- unlist(trees[1,], recursive = FALSE)
#' trees2 <- unlist(trees[2,], recursive = FALSE)
#' replicates
=
c(4, 6)
#' 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
treediff
<-
function
(
trees1
,
trees2
,
replicates
){
treediff
<-
function
(
trees1
,
trees2
,
replicates
)
{
# Check if `replicates` is numeric vector
if
(
inherits
(
replicates
,
"numeric"
)
!=
TRUE
){
if
(
inherits
(
replicates
,
"numeric"
)
!=
TRUE
)
{
stop
(
"`replicates` is not a numeric vector"
)
}
# Check if the length of replicates is 2
if
(
length
(
replicates
)
!=
2
){
if
(
length
(
replicates
)
!=
2
)
{
stop
(
"`replicates` must be a vector of length 2."
)
}
...
...
@@ -111,7 +112,7 @@ treediff <- function(trees1, trees2, replicates){
tree_order2
<-
lapply
(
trees2
,
"[["
,
"order"
)
leaves2
<-
sapply
(
tree_order2
,
length
)
if
(
!
identical
(
unique
(
leaves1
),
unique
(
leaves2
))){
if
(
!
identical
(
unique
(
leaves1
),
unique
(
leaves2
)))
{
stop
(
"the number of leaves in one or more clusters is different between "
,
"the two sets of trees."
)
}
...
...
@@ -230,7 +231,7 @@ compute_pvalue <- function(average_coph, squeezed_var, replicates) {
cluster
<-
average_coph
$
cluster
# Calculate the numerator for the t-statistic
numerator
<-
Reduce
(
"-"
,
average_coph
[,
-3
])
numerator
<-
Reduce
(
"-"
,
average_coph
[,
-3
])
# Store replicates values for each group
n1
<-
replicates
[
1
]
...
...
This diff is collapsed.
Click to expand it.
man/treediff.Rd
+
11
−
10
View file @
c0217284
...
...
@@ -21,7 +21,8 @@ different from that of \code{trees1}.}
for each condition.}
}
\value{
An object of class \code{htest} with the following entries: \itemize{
An object of class \code{treeTest} with the following entries:
\itemize{
\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.}
...
...
@@ -42,11 +43,10 @@ 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)
leaves <- c(100,120,50,80)
trees <- sapply(leaves, FUN = function(l){
base_data <- matrix(rnorm(2000), nrow = l, ncol = 200)
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
...
...
@@ -69,9 +69,9 @@ trees <- sapply(leaves, FUN = function(l){
return(list("trees1" = trees1, "trees2" = trees2))
})
trees1 <- unlist(trees[1,], recursive = FALSE)
trees2 <- unlist(trees[2,], recursive = FALSE)
replicates
=
c(4, 6)
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
...
...
@@ -84,9 +84,10 @@ structure between families of trees. \emph{Preprint submitted for
publication}.
}
\author{
Pierre Neuvial \email{pierre.neuvial@math.univ-toulouse.fr}\cr
Nathanaël Randriamihamison\cr
Gwendaelle Cardenac\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}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment