-
Notifications
You must be signed in to change notification settings - Fork 2
/
useCase1b.Rmd
134 lines (113 loc) · 4.95 KB
/
useCase1b.Rmd
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
---
title: "iLINCS API R Notebook"
output:
pdf_document: default
html_document:
df_print: paged
---
<style type="text/css">
.main-container {
max-width: 1200px;
margin-left: auto;
margin-right: auto;
}
</style>
<!-- ## Prerequisites -->
#Loading packages
```{r include = FALSE}
library(knitr)
library(tinytex)
library(httr)
library(jsonlite)
library(htmltools)
library(ggplot2)
library(enrichR)
```
#Setting default width option
```{r set-options, echo=FALSE, cache=FALSE}
options(width = "200")
```
# Display Signature Libraries
```{r list signature libraries}
apiUrl <- "http://www.ilincs.org/api/SignatureLibraries"
req <- GET(apiUrl)
json <- httr::content(req, as = "text")
ilincs_libraries <- fromJSON(json)
ilincs_libraries[,c("libraryID","libraryName")]
```
# Searching for Everolimus chemical perturbage (CP) perturbation signatures in the MCF7 cell line
```{r search signatures}
term <- "Everolimus"
ilincs_libId<-"LIB_5"
apiUrl <- paste("http://www.ilincs.org/api/SignatureMeta/findTermWithSynonyms?term=",term,"&library=",ilincs_libId,sep="")
req <- GET(apiUrl)
everolimusCps<-fromJSON(httr::content(req,type="text"))$data
everolimusCpsMcf7<-everolimusCps[intersect(grep("Everolimus",everolimusCps$compound),grep("MCF7",everolimusCps$cellline)),]
everolimusCpsMcf7[,c("compound","time","concentration","signatureid","cellline")]
```
# Enrichr analysis of everolimus signature at 0.04uM concentration (LINCSCP_137891) (Fig 2C)
```{r}
ilincs_signatureId <- "LINCSCP_137891"
req <- POST("http://www.ilincs.org/api/ilincsR/downloadSignature", body = list(sigID = ilincs_signatureId, display = FALSE), encode = "json")
ilincs_sessionId<-unlist(httr::content(req))
ilincs_sessionId
signatureFileUrl=paste("http://www.ilincs.org/tmp/",ilincs_sessionId,".xls",sep="")
everolimusSignatureData<-read.table(signatureFileUrl,sep="\t",header=T,stringsAsFactors = F)
sigGenes100<-everolimusSignatureData$Name_GeneSymbol[order(everolimusSignatureData$Significance_pvalue)[1:100]]
setEnrichrSite("Enrichr")
enriched <- enrichr(genes=sigGenes100, databases="KEGG_2019_Human")
enriched[["KEGG_2019_Human"]][1:5,]
```
# Finding and summarizing connected CGSes with the Everolimus signature at 0.04uM concentration (LINCSCP_137891)
## Finding connected CGSes
```{r connected CGSes}
ilincs_libId<-"LIB_6"
apiUrl <- paste("http://www.ilincs.org/api/SignatureMeta/findConcordantSignatures?sigID=",ilincs_signatureId,"&lib=",ilincs_libId,sep="")
req <- GET(apiUrl)
connectedCgs<-fromJSON(httr::content(req,type="text"))
head(connectedCgs[,c("signatureid","similarity","pValue","cellline","treatment")])
```
## Summary boxplot, Figure 2D in the manuscript
```{r connected CGSes Boxplot}
geneFreq <- sort(table(connectedCgs$treatment[1:100]),decreasing=TRUE)[5:1]
geneFreqDf<-data.frame(gene=factor(names(geneFreq),levels=names(geneFreq),ordered=T),geneFreq=as.vector(geneFreq))
tp100cgs<-ggplot(data=geneFreqDf,aes(x=gene,y=geneFreq)) +
geom_bar(stat="identity",fill="steelblue") +
coord_flip() + theme_bw() +
theme(axis.ticks=element_line(color="grey80"),text=element_text(size=20),legend.key.size=unit(1,"cm"),axis.line.x=element_line(colour="black"),panel.grid.major=element_blank(),panel.grid.minor=element_blank(),panel.border=element_blank(),panel.background=element_blank()) +
labs(x="",y="Number of Signatures")
tp100cgs
```
## Enrichr analysis of connected CGSes (Fig 2D)
```{r}
setEnrichrSite("Enrichr")
enrichedCgsTargets <- enrichr(genes=unique(connectedCgs$treatment), databases="KEGG_2019_Human")
enrichedCgsTargets[["KEGG_2019_Human"]][1:5,]
```
# Finding and summarizing connected chemical perturbage (CP) signatures with the Everolimus signature at 0.04uM concentration (LINCSCP_137891)
## Finding connected CPs
```{r connected CPs}
ilincs_libId<-"LIB_5"
apiUrl <- paste("http://www.ilincs.org/api/SignatureMeta/findConcordantSignatures?sigID=",ilincs_signatureId,"&lib=",ilincs_libId,sep="")
req <- GET(apiUrl)
connectedCps<-fromJSON(httr::content(req,type="text"))
head(connectedCps)
```
## Summary boxplot, Figure 2E in the manusript
```{r connected CPs Boxplot}
top100GeneTargets<-unlist(strsplit(connectedCps$GeneTargets[1:100],split="\\|"))
geneFreq <- sort(table(top100GeneTargets),decreasing=TRUE)[5:1]
geneFreqDf<-data.frame(gene=factor(names(geneFreq),levels=names(geneFreq),ordered=T),geneFreq=as.vector(geneFreq))
tp100cp<-ggplot(data=geneFreqDf,aes(x=gene,y=geneFreq)) +
geom_bar(stat="identity",fill="steelblue") +
coord_flip() + theme_bw() +
theme(axis.ticks=element_line(color="grey80"),text=element_text(size=20),legend.key.size=unit(1,"cm"),axis.line.x=element_line(colour="black"),panel.grid.major=element_blank(),panel.grid.minor=element_blank(),panel.border=element_blank(),panel.background=element_blank()) +
labs(x="",y="Number of Signatures")
tp100cp
```
## Enrichr analysis of connected CGSes (Fig 2E)
```{r}
setEnrichrSite("Enrichr")
enrichedCgsTargets <- enrichr(genes=unique(top100GeneTargets), databases="KEGG_2019_Human")
enrichedCgsTargets[["KEGG_2019_Human"]][1:5,]
```