Skip to content

Commit a430eaa

Browse files
committed
Copy .weightedFDR() from csaw to avoid use of ":::"
1 parent b5a8c3e commit a430eaa

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Package: diffHic
2-
Version: 1.37.2
2+
Version: 1.37.3
33
Date: 2024-05-11
44
Title: Differential Analysis of Hi-C Data
55
Author: Aaron Lun, Gordon Smyth

R/diClusters.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ diClusters <- function(data.list, result.list, target, equiweight=TRUE, cluster.
55
#
66
# written by Aaron Lun
77
# created 12 January 2016
8-
# last modified 13 January 2016
8+
# last modified by Aaron Lun 4 June 2019
9+
# last modified 11 May 2024 to call local .weightedFDR
910
{
1011
# Setting initial parameters.
1112
if (missing(target)) {
@@ -49,7 +50,7 @@ diClusters <- function(data.list, result.list, target, equiweight=TRUE, cluster.
4950
last <- last + nrow(result.list[[x]])
5051
}
5152
all.ps <- unlist(all.ps)
52-
adjp <- csaw:::.weightedFDR(all.ps, weights)
53+
adjp <- .weightedFDR(all.ps, weights)
5354

5455
# Getting the sign.
5556
if (is.na(fc.col)) {

R/weightedFDR.R

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Copied from csaw package
2+
3+
.weightedFDR <- function(p, w) {
4+
if (length(p)!=length(w)) { stop("weights and p-value vector are not of same length") }
5+
o <- order(p)
6+
p <- p[o]
7+
w <- w[o]
8+
adjp <- numeric(length(o))
9+
adjp[o] <- rev(cummin(rev(sum(w)*p/cumsum(w))))
10+
pmin(adjp, 1)
11+
}

0 commit comments

Comments
 (0)