Skip to content

Instantly share code, notes, and snippets.

View hannes-brt's full-sized avatar

Hannes Bretschneider hannes-brt

View GitHub Profile
@hannes-brt
hannes-brt / dna_encode.py
Last active May 7, 2023 11:36
One-hot encoding DNA with TensorFlow
# Copyright 2019 Hannes Bretschneider
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following
# conditions:
@hannes-brt
hannes-brt / decode_cossmo_example.py
Last active April 26, 2018 11:02
Function to decode a COSSMO training example in tfrecord format
def read_single_cossmo_example(serialized_example, n_tissues=1, coord_sys='rna1'):
"""Decode a single COSSMO example
coord_sys must be one of 'rna1' or 'dna0', if 'dna0' then an extra 'strand' field
must exist in the tfrecord and is extracted.
"""
assert coord_sys in ['dna0', 'rna1']
context_features = {
IMAGE _/nginx
@hannes-brt
hannes-brt / gist:f163015ac781e118c3e0
Created November 24, 2014 15:48
Query busy GPUs
nvidia-smi | grep -A 1000 'Compute processes' - | tail -n+4 | grep '^|' | cut -f 5 -d ' '
### Keybase proof
I hereby claim:
* I am hannes-brt on github.
* I am hannes_brt (https://keybase.io/hannes_brt) on keybase.
* I have a public key whose fingerprint is E0CD EEFA 5AA1 E8AD 3CDB F5B4 B6CB 4CC5 5250 D9C4
To claim this, I am signing this object:
@hannes-brt
hannes-brt / ipy_hide_input
Created August 12, 2013 00:20
This is a simple command line tool that adds a small snippet of Javascript to the end of the HTML output of `ipython nbconvert` that hides the input code in the output. This works for both '--to html' and '--to slides' The tool works both when given a file name or by reading from stdin: ```bash ipy_hide_input input_file.slides.html ipython nbcon…
#! /usr/bin/env python
"""
The MIT License (MIT)
Copyright (c) 2013 Hannes Bretschneider
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
@hannes-brt
hannes-brt / gist:4688151
Last active December 12, 2015 00:59
Readbase API example
{
"metadata": {
"name": "Map Bodymap STAR"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hannes-brt
hannes-brt / git-branch.sh
Created November 23, 2012 22:43
Show git-branch in prompt
# Show git-branch in prompt
c_cyan=`tput setaf 6`
c_red=`tput setaf 1`
c_green=`tput setaf 2`
c_sgr0=`tput sgr0`
parse_git_branch ()
{
if git rev-parse --git-dir >/dev/null 2>&1
then
@hannes-brt
hannes-brt / pyximport_numpy.py
Created December 28, 2010 13:08
Setup pyximport to include the numpy headers
import pyximport
import numpy as np
pyximport.install(setup_args={'include_dirs': np.get_include()})