This file contains 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
# Functions for parallelizing things | |
def init_spark(nproc=-1, appname="sparksession"): | |
"""Function to start a Spark executor.""" | |
from pyspark.sql import SparkSession | |
if nproc == -1: | |
# Use all CUPs | |
spark = SparkSession.builder.master( | |
"local[*]").appName(appname).getOrCreate() | |
else: |
This file contains 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 flatten_json(y): | |
out = {} | |
def flatten(x, name=''): | |
if type(x) is dict: | |
for a in x: | |
flatten(x[a], name + a + '_') | |
elif type(x) is list: | |
i = 0 | |
for a in x: |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
#!/usr/bin/env python | |
# Sequence alignment using PyMOL | |
# The purpose of this script is to generate a sequence alignment between | |
# the original crystal structure of the apo and holo models, and the sequence | |
# of the finalised, ungapped Rosetta models. This allows us to get a 1 to 1 | |
# corresponcence between the residue numberings in both structures. | |
# USAGE: Run once from the project root. | |
# "pockets.csv" contains the information about apo holo pairs. |
This file contains 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 xmltodict | |
import pandas as pd | |
with open("full_database.xml") as db: | |
doc = xmltodict.parse(db.read()) | |
values = [] | |
for item in doc['drugbank']['drug']: | |
logp = None | |
try: |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
#!/usr/bin/env bash | |
set -Eeuo pipefail | |
cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 | |
trap cleanup SIGINT SIGTERM ERR EXIT | |
usage() { | |
cat <<EOF |
This file contains 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
#!/bin/bash | |
# Genesets aggregated by taxid | |
aggs=`curl -s "https://mygeneset.info/v1/query?q=*&facets=taxid&facet_size=100"` | |
taxids=`echo $aggs | jq -r '.facets.taxid.terms | map(.term) | @csv'` | |
counts=`echo $aggs | jq -r '.facets.taxid.terms | map(.count) | @csv'` | |
# Query scientific name for each taxid | |
resp=`curl -s -X POST -d "q=${taxids}" "http://t.biothings.io/v1/query"` | |
species=`echo $resp | jq -r 'map(.scientific_name) | @csv'` |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.