-
Notifications
You must be signed in to change notification settings - Fork 0
/
SNPedia.R
54 lines (39 loc) · 1.85 KB
/
SNPedia.R
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
44
45
46
47
48
49
50
51
52
53
54
if (!requireNamespace("BiocManager"))
install.packages("BiocManager")
BiocManager::install()
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("BiocStyle", version = "3.8")
## ----style, echo = FALSE, results = 'asis'---------------------------------
BiocStyle::markdown()
## --------------------------------------------------------------------------
library (SNPediaR)
pg <- getPages (titles = "Rs53576")
pg
## --------------------------------------------------------------------------
pgs <- getPages (titles = c ("Rs53576(A;A)", "Rs53576(A;G)", "Rs53576(G;G)"))
pgs
## --------------------------------------------------------------------------
extractSnpTags (pg$Rs53576)
## --------------------------------------------------------------------------
sapply (pgs, extractGenotypeTags)
## --------------------------------------------------------------------------
getPages (titles = c ("Rs53576(A;A)", "Rs53576(A;G)", "Rs53576(G;G)"),
wikiParseFunction = extractGenotypeTags,
tags = c ("allele1", "allele2", "magnitude"))
## --------------------------------------------------------------------------
findPMID <- function (x) {
x <- unlist (strsplit (x, split = "\n"))
x <- grep ("PMID=", x, value = TRUE)
x
}
## --------------------------------------------------------------------------
getPages (titles = c ("Rs53576", "Rs1815739"),
wikiParseFunction = findPMID)
## --------------------------------------------------------------------------
res <- getCategoryElements (category = "Is_a_medical_condition")
head (res)
## --------------------------------------------------------------------------
grep ('cancer', res, value = TRUE)
## --------------------------------------------------------------------------
sessionInfo ()