Skip to content

Instantly share code, notes, and snippets.

View audy's full-sized avatar
🔬

Austin Richardson audy

🔬
View GitHub Profile
class BaseKitty
def meow
nil
end
end
class Nancy < BaseKitty
def meow
(super || "shshsh")
end
@audy
audy / fetch-refseq-annotations.rb
Created January 8, 2020 21:38
quickly fetch all of the annotations on refseq
#!/usr/bin/env ruby
require "open-uri"
require "parallel"
open("https://ftp.ncbi.nlm.nih.gov/genomes/refseq/bacteria/assembly_summary.txt") do |handle|
handle.gets # skip header
handle.gets
Parallel.each(handle, :in_processes => 6, :progress => 'downloading') do |line|
row = line.split("\t")
@audy
audy / racon
Last active December 11, 2019 22:21
racon haswell
@audy
audy / exhibits.txt
Last active December 9, 2019 21:48 — forked from agnaite/exhibits.txt
2017-04-01 2017-10-01 The Bear & Peacock Brewery Orlando, FL
2017-02-01 Nude Nite Orlando, FL
2016-09-01 Small Works Show City Arts Factory Orlando, FL
2016-08-01 Declaration of the Mind 1st Thursdays Orlando Museum of Art, FL
2016-07-01 Rock (People's Choice Award Winner) 1st Thursdays, Orlando Museum of Art, FL
2016-03-01 Viva La Diva 1st Thursdays, Orlando Museum of Art, FL
2016-03-01 Nude Nite Tampa, FL
2016-02-01 Peace and Harmony 1st Thursdays, Orlando Museum of Art, FL
2016-10-01 Winter Park, FL
2012-08-01 Vegas Gallery, Las Vegas, AZ
@audy
audy / one_hot_encode.py
Created December 4, 2019 05:39
A one-hot-encoder for DNA sequences that I find myself writing repeatedly
def one_hot_encode(sequence: str, alphabet=["G", "A", "T", "C"]):
"""
one-hot encode a string using a pre-defined alphabet
>>> one_hot_encode("GATC")
[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]
"""
vector = ([0] * len(alphabet)) * len(sequence)
@audy
audy / zerorm.py
Created August 9, 2019 22:23
Who needs an ORM?
#!/usr/bin/env python3
from models import *
def query(func):
def run_query():
rows = get_database().execute_sql(func.__doc__.strip())
for row in rows:
@audy
audy / downsample-fastq.py
Last active July 31, 2019 23:45
Argh! Downsample ye treasures, matey!
#!/usr/bin/env python3
import argparse
import random
import sys
import xopen
from collections import defaultdict
import statistics
import random
class InfiniteMedian:
"""
Works well if the number of possible values is low.
Otherwise, nicht sehr gut
"""
@audy
audy / docker-autosleep.sh
Created February 27, 2019 06:33
Automatically shut down after all docker containers have exited
#!/bin/bash
set -euo pipefail
container_substring="something-greppable-in-the-name"
function check {
docker ps | grep -v CONTAINER | grep -v ${container_substring}
}
@audy
audy / xml-to-dict.py
Created October 22, 2018 19:34
Convert nested XML data into dictionaries
#!/usr/bin/env python3
import xml.etree.ElementTree as ET
from pprint import pprint
import code
tree = ET.parse('biosample_result.xml')
def expand_blob(blob, attributes={}):
'''