Skip to content

Instantly share code, notes, and snippets.

@eric-czech
eric-czech / ncbi_human_genes.csv
Created March 9, 2022 21:31
NCBI Human Gene List
We can't make this file beautiful and searchable because it's too large.
taxon_id,gene_id,gene_symbol
9606,109951028,A-GAMMA3'E
9606,1,A1BG
9606,503538,A1BG-AS1
9606,29974,A1CF
9606,2,A2M
9606,144571,A2M-AS1
9606,144568,A2ML1
9606,100874108,A2ML1-AS1
9606,106478979,A2ML1-AS2
@eric-czech
eric-czech / hgnc_gene_lookup.ipynb
Last active September 23, 2021 13:06
Google patents HGNC normalizations
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@eric-czech
eric-czech / zooma.py
Created August 9, 2021 19:12
Zooma API Query for EFO disease
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
@eric-czech
eric-czech / search_efo_ols.py
Created May 11, 2021 11:06
Search EFO OLS using disease query
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.
@eric-czech
eric-czech / script.R
Last active February 22, 2021 18:46
Code for figure 2 from Bellégo and Papeis 2019
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'])
@eric-czech
eric-czech / ols.py
Created January 20, 2021 20:31
OLS term search function
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]
@eric-czech
eric-czech / gwas_simulation.ipynb
Created January 18, 2021 19:25
GWAS Simulation Example
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.
@eric-czech
eric-czech / matmul_vs_einsum.ipynb
Created November 30, 2020 16:10
Dask matmul vs einsum
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.