Skip to content

Commit

Permalink
resolve merge conflict for limma confounder test.
Browse files Browse the repository at this point in the history
  • Loading branch information
jakob-wirbel committed May 10, 2024
2 parents 7c097b5 + 3c7ba22 commit 6055aa1
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions R/helper_tests.R
Original file line number Diff line number Diff line change
Expand Up @@ -613,21 +613,10 @@ test.via.limma <- function(data, label, conf){
stopifnot(all(colnames(data)==names(label)))
test.package('limma')
if (is.null(conf)){
fit <- lmFit(data, design = model.matrix(~label))
res <- eBayes(fit)
p.val <- res$p.value[,'label']
fit <- lmFit(data, design = data.frame(intercept = -1, label))
} else {
df <- model.matrix(~label+conf[colnames(data), 'conf'])
colnames(df)[1] <- 'intercept'
colnames(df)[3] <- 'conf'
df2 <- data.frame(label=label, conf=conf[colnames(data), 'conf'])
# fit <- lmFit(data, design = df)
# contr <- makeContrasts(label-intercept, levels = colnames(df))
# contr.fit <- contrasts.fit(fit, contrasts = contr)
fit <- lmFit(data, design = data.frame(intercept = -1, label),
block=conf[colnames(data), 'conf'], correlation = 0.5)
res <- eBayes(fit)
p.val <- res$p.value[,'label']
x <- duplicateCorrelation(data, design = data.frame(label), block = conf[colnames(data), 'conf'])
fit <- lmFit(data, design = data.frame(intercept = -1, label), block = conf[colnames(data), 'conf'], correlation = x[[1]])
}


Expand Down

0 comments on commit 6055aa1

Please sign in to comment.