Connected compound perturbations in R/API different than submitted to web

25 views
Skip to first unread message

Peter Arnesen

unread,
Apr 13, 2023, 10:15:11 AM4/13/23
to iLincs
Hi, thanks for creating this great resource!

When I submit a data frame using R/API with the goal of getting a list of chemical perurbagens it returns a different list than when I simply upload the csv to your submit a signature tab under "Signatures". 

I have tried to figure out what I could be doing wrong by studying your API-documentation at: http://www.ilincs.org/ilincs/APIdocumentation , but I am not able to understand what I could be doing wrong.

Could you please advice me to how I can submit signatures of some genes and their corresponding fold change and p-values using R/API?

Thanks in advance!

Peter

mario.me...@gmail.com

unread,
Apr 16, 2023, 1:14:53 PM4/16/23
to iLincs
Hi Peter, 

Not sure what went wrong with your analysis. iLINCS API and UIs should generally give identical results. Below is the minimal example of using the API on the example signature from iLINCS (sample1 at http://www.ilincs.org/ilincs/signatures/main/upload). This is an excerpt from the examples in the GitHub (https://github.com/uc-bd2k/ilincsAPI). I downloaded the example file (sample1.csv) and used iLINCS API to analyze it with iLINCS. The results are identical to the ones obtained by uploading this same file to iLINCS via UI. 

Please note that in the example, I create a unique file name for local file to avoid cashing issue. This can sometime cause problems with API. If this is not addressing your problem, please give me a more specific example and I will help you troubleshoot.

Best,
Mario

## Find connected signatures based on user submitted full signature
```{r}
library(httr)
library(jsonlite)
library(htmltools)

# assuming that the "sample1.csv" file is downloaded from iLINCS and saved in ~/Downloads
setwd("~/Downloads")

# creating tab delimited signature file for upload
sample1<-read.csv("sample1.csv")
## creating unique file name to avoid caching issues
localFileName<-paste0("sigFile",floor(runif(1)*1e10),".tsv")
write.table(sample1,file=localFileName,sep="\t",row.names=F,col.names = T,quote=F)

# upload signature file to ilincs
req <- POST("http://www.ilincs.org/api/SignatureMeta/upload", body=list(file=upload_file(localFileName)))
ilincsSignatureFile <- httr::content(req)$status$fileName[[1]]

# Find connected chemical perturbagen signatures
req <- (POST("http://www.ilincs.org/api/ilincsR/findConcordances", body = list(file=ilincsSignatureFile, lib="LIB_5"), encode = "form"))
output <- data.table::rbindlist(httr::content(req)$concordanceTable, use.names = TRUE, fill = TRUE)
head(output)
```
Screen Shot 2023-04-16 at 1.12.45 PM.png
Reply all
Reply to author
Forward
0 new messages