comparison methylGSA.R @ 1:51dbd3d869ce draft default tip

Uploaded
author mora-lab
date Thu, 20 May 2021 08:44:37 +0000
parents
children
comparison
equal deleted inserted replaced
0:009f5b03ca69 1:51dbd3d869ce
1 ###############################################################################
2 # title: MethylGSA
3 # author: Xiaowei
4 # time: Mar.31 2021
5 ###############################################################################
6
7 spec <- matrix(c("data_file", "D",1, "character", "txt file",
8 "test_method","M",1,"character", "Test method",
9 "array_type","T",1,"character","Array type, 450K, EPCI",
10 "group","G",1,"character","group: all, body, promoter1, promoter2",
11 "GS_list","L",1,"character","Gene Set tested: Gene Ontology, KEGG, Reactome",
12 "minsize","I",1,"integer", "Minimum gene set size",
13 "maxsize","A",1,"integer", "Maximum gene set size",
14 "result", "R", 1, "character", "result table"
15 ), byrow = TRUE, ncol = 5)
16
17 opt <- getopt::getopt(spec)
18
19
20 # #===========================================================================
21 # #输入的参数
22 # #===========================================================================
23 # # txt文件
24 # opt$data_file
25 # opt$test_method
26 # opt$array_type
27 # opt$group
28 # opt$GS_list
29 # opt$minsize
30 # opt$maxsize
31
32
33 temp = read.table(opt$data_file)
34 cpg.pval1 = temp[,2]
35 names(cpg.pval1) = temp[,1]
36 inputmethod = opt$test_method
37
38 #================================================================
39 #run codes
40 #================================================================
41 suppressPackageStartupMessages(library(methylGSA))
42
43
44 if(opt$array_type=="450K"){
45 suppressMessages(library(IlluminaHumanMethylation450kanno.ilmn12.hg19))
46 }else{
47 suppressMessages(library(IlluminaHumanMethylationEPICanno.ilm10b4.hg19))
48 }
49
50 if(inputmethod == "methylglm"){
51 res <- methylglm(cpg.pval = cpg.pval1, array.type = opt$array_type,
52 group = opt$group, GS.list=NULL,
53 GS.idtype = "SYMBOL", GS.type = opt$GS_list,
54 minsize = opt$minsize, maxsize = opt$maxsize)
55
56 }
57
58 if(inputmethod == "RRA_ORA"){
59 res <- methylRRA(cpg.pval = cpg.pval1, array.type = opt$array_type,
60 group = opt$group, method = "ORA",
61 GS.list=NULL, GS.idtype = "SYMBOL", GS.type = opt$GS_list,
62 minsize = opt$minsize, maxsize = opt$maxsize)
63 }
64
65 if(inputmethod == "RRA_GSEA"){
66 res <- methylRRA(cpg.pval = cpg.pval1, array.type = opt$array_type,
67 group = opt$group, method = "GSEA",
68 GS.list=NULL, GS.idtype = "SYMBOL", GS.type = opt$GS_list,
69 minsize = opt$minsize, maxsize = opt$maxsize)
70 }
71
72 if(inputmethod == "gometh"){
73 res <- methylgometh(cpg.pval = cpg.pval1, sig.cut = 0.001, array.type = opt$array_type,
74 GS.list=NULL, GS.idtype = "SYMBOL", GS.type = opt$GS_list,
75 minsize = opt$minsize, maxsize = opt$maxsize)
76 }
77
78 #===============================================================================
79 write.csv(res, file = opt$result)