-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlimma_contrast.r
More file actions
43 lines (35 loc) · 894 Bytes
/
limma_contrast.r
File metadata and controls
43 lines (35 loc) · 894 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
suppressMessages(library(edgeR))
suppressMessages(library(limma))
suppressMessages(library(anndata))
library("optparse")
option_list = list(
make_option(
c("--input_fit"),
type="character",
),
make_option(
c("--contrast"),
type="character",
),
make_option(
c("--contrast_output_path"),
type="character",
)
);
opt_parser = OptionParser(option_list=option_list);
opt = parse_args(opt_parser);
cat(opt$input_fit)
cat()
cat(opt$contrast)
cat()
cat(opt$contrast_output_path)
cat()
fit = readRDS(opt$input_fit)
cat("> Computing contrast...\\n")
contr <- makeContrasts(contrasts=opt$contrast, levels=colnames(coef(fit)))
tmp <- contrasts.fit(fit, contr)
tmp <- eBayes(tmp)
result <- topTable(tmp, n=Inf, sort='none')
if (!(length(opt$contrast_output_path)==0)){
write.csv(result, opt$contrast_output_path)
}