This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from urllib.parse import quote_plus | |
def get_info(disease): | |
url_fmt = 'http://www.ebi.ac.uk/spot/zooma/v2/api/services/annotate?propertyValue={disease}&propertyType=disease&filter=ontologies:[efo]' | |
url = url_fmt.format(disease=quote_plus(disease)) | |
print(url) | |
res = requests.get(url).json() | |
if len(res) == 0: | |
return None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def search_efo(disease): | |
import requests | |
from urllib.parse import quote_plus | |
res = requests.get(f"https://www.ebi.ac.uk/ols/api/select?q={quote_plus(disease)}&ontology=efo") | |
res = res.json() | |
docs = res['response']['docs'] | |
if len(docs) == 0: | |
return None | |
return docs[0] |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(ggplot2) | |
# For figure 2 of paper https://www.semanticscholar.org/paper/Dealing-with-Logs-and-Zeros-in-Regression-Models-Bellégo-Pape/546a6f45433b413721f9a60f0be8e3e2b69fe103 | |
set.seed(1) | |
beta <- 1 | |
x_max <- 1 | |
x <- x_max * runif(10000) | |
y <- sapply(x, function(x) rpois(1, lambda=exp(beta * x + 1))) | |
df <- do.call(rbind, lapply(seq(.01, 1, by=.01), function(delta){ | |
beta_hat <- unname(lm(log(y + delta) ~ x)$coefficients['x']) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_ols(term): | |
import requests | |
url = 'http://www.ebi.ac.uk/ols/api/ontologies/efo/terms?obo_id=' + term | |
res = requests.get(url) | |
terms = res.json()['_embedded']['terms'] | |
assert len(terms) == 1 | |
return terms[0] |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Dask Cloud Provider REPL | |
# | |
# This is useful for creating clusters indepedent of the code that runs on them | |
# Example: python scripts/cloudprovider.py -- --interactive | |
# | |
from dask_cloudprovider.gcp.instances import GCPCluster | |
import fire | |
import os | |
import json |