Skip to content

Instantly share code, notes, and snippets.

@cthoyt
cthoyt / make_mapping.py
Created June 1, 2021 17:25
Map from OBO Foundry prefixes to Bioregistry prefixes
import json
import sys
import click
import bioregistry
@click.command()
@click.option('--output', default=sys.stdout)
@cthoyt
cthoyt / npa_xeno_example.csv
Created January 30, 2021 16:44
Example dataset for PyNPA
We can't make this file beautiful and searchable because it's too large.
Experiment1.m5_node_label,Experiment1.m5_fold_change,Experiment1.m5_tstats
COX1,0.0442820351919402,1.27430203477638
ATP6,0.0829436812093022,2.86171297191134
SCGB1A1,-0.0829577087977886,-2.31945514137341
BPIFB1,0.303399473563391,7.82213833931689
RPL41,-0.0316199085257711,-1.3019865836353
ND2,0.0609064988662182,1.5913565091562
HBB,-0.60815873574393,-2.82215934759009
SCGB3A1,-0.114966188117398,-1.12153734714022
EEF1A1,-0.0856593570605189,-2.61018187225134
@cthoyt
cthoyt / generate_literals.py
Last active December 7, 2020 16:28
Generate random literal datasets in PyKEEN
"""
Author: Charles Tapley Hoyt (@cthoyt)
License: MIT
See related blog post at https://cthoyt.com/2020/12/07/generating-literal-datasets.html
"""
from typing import Any, List, TextIO, Tuple, Type, Union
import click
import torch
@cthoyt
cthoyt / constrained-evaluation-on-hetionet.ipynb
Created August 25, 2020 02:38
Constrained Evaluation on Hetionet.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cthoyt
cthoyt / README.md
Last active April 17, 2020 13:23
Remapping organism names in BioGRID identifiers dump

BioGRID Identifiers Problem, Solved

The file I included here has a set of organisms in the BioGRID identifiers download (version 3.5.184), latest as of time of writing on 2020-04-17) whose ORGANISM_OFFICIAL_NAME is not correct. I went and mapped these all with a mixture of synonym search on NCBITaxon and manual intervention. Each has the taxonomy identifier, so it can be used to get the most up-to-date information.

I would highly suggest including a taxonomy ID in this dump as well as the name, so it can be programatically mapped for anyone trying to integrate this

@cthoyt
cthoyt / cthoyt-thesis-drinking-game.md
Last active October 6, 2021 14:39
Charlie's PhD Thesis: The Drinking Game

Charlie's PhD, The Drinking Game

How to play:

  1. Read Charlie's PhD thesis... or just skim through it looking for fun
  2. Drink based on the following rules:

1 Sip

  • Charlie uses too many references
@cthoyt
cthoyt / hbp_ideogram.html
Created February 7, 2019 12:50
Ideogram of the Human Brain Pharmacome Repository
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Human Brain Pharmacome Knowledge</title>
<script src="https://unpkg.com/[email protected]/dist/js/ideogram.min.js"></script>
</head>
<body>
<script>
var ideogram = new Ideogram({
import pubchempy as pcp
keys = '''MXDPZUIOZWKRAA-UZOALHFESA-K
MJUVRTYWUMPBTR-MRXNPFEDSA-N
HJBWBFZLDZWPHF-UHFFFAOYSA-N
HZIYEEMJNBKMJH-UHFFFAOYSA-N
CPZBLNMUGSZIPR-NVXWUHKLSA-N
GKDRMWXFWHEQQT-UHFFFAOYSA-N
KSMAGQUYOIHWFS—UHFFFAOYSA-N
OFZJKCQENFPZBH-UHFFFAOYSA-N
@cthoyt
cthoyt / truthycontext.py
Last active September 6, 2017 18:22
A context manager using frame hacks to only run when truthy
import unittest
from contextlib import contextmanager
# see https://stackoverflow.com/questions/12594148/skipping-execution-of-with-block
@contextmanager
def when_truthy(argument):
"""
The point of this function is to make it so you never have to write
@cthoyt
cthoyt / update_resources.sh
Last active July 20, 2017 10:32
Update BEL Resources on Artifactory with Selventa Generator
#!/usr/bin bash
mkdir output
# Download and install pybel-tools
git clone https://github.com/pybel/pybel-tools
cd pybel-tools
python3 -m pip install --user .
cd ..