Skip to content

Instantly share code, notes, and snippets.

View cthoyt's full-sized avatar
💭
On sabbatical - unable to respond until Fall 2024.

Charles Tapley Hoyt cthoyt

💭
On sabbatical - unable to respond until Fall 2024.
View GitHub Profile
@cthoyt
cthoyt / process.sh
Created November 9, 2016 18:33
Bel.rb Installation trouble
[544] [19:04] [cthoyt@microvac:~]
$ rvm use 2.3.0 --install
ruby-2.3.0 is not installed - installing.
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.12/x86_64/ruby-2.3.0.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/cthoyt/.rvm/rubies/ruby-2.3.0, this may take a while depending on your cpu(s)...
@cthoyt
cthoyt / compare_bel_compilers.sh
Created January 26, 2017 21:46
Compares Java, Python, and Ruby BEL compilers
mkdir /tmp/beltest
cd /tmp/beltest
curl http://resources.openbel.org/belframework/1.0/knowledge/small_corpus.bel > small.bel
curl http://resources.openbel.org/belframework/1.0/knowledge/large_corpus.bel > large.bel
# Test Python
python -m pip install pybel
time python -m pybel convert --path small.bel --pickle small.gpickle
time python -m pybel convert --path large.bel --pickle large.gpickle
@cthoyt
cthoyt / use_pip.py
Created April 28, 2017 19:04
Programatically use pip
# Pip is actually a python package!
import pip
# It's screwy and not really written to be used this way, but we still can
pip_install_cmd = pip.commands.InstallCommand()
# load up all the args you'd use after pip install and away we go!
args = ['--upgrade', '--user', 'requests']
pip_install_cmd.main(args)
@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 ..
@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
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 / 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/ideogram@1.5.0/dist/js/ideogram.min.js"></script>
</head>
<body>
<script>
var ideogram = new Ideogram({
@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 / 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 / constrained-evaluation-on-hetionet.ipynb
Created August 25, 2020 02:38
Constrained Evaluation on Hetionet.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.