Skip to content

Instantly share code, notes, and snippets.

Jeff Hammerbacher hammer

Block or report user

Report or block hammer

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@hammer
hammer / platform-input-support-config.yaml
Last active Jul 8, 2019
Configuration organized by ES index; note that this will not parse correctly! It's for purely pedagogical purposes.
View platform-input-support-config.yaml
# [invalid-]evidence-data
evidences:
gs_output_dir: evidence-files
downloads:
- bucket: otar000-evidence_input/CRISPR/json
output_filename: crispr-{suffix}.json.gz
resource: input-file
subset_key:
- target
- id
@hammer
hammer / mrtarget.data.19.06.yml
Last active Jul 7, 2019
Configuration organized by ES index
View mrtarget.data.19.06.yml
# relation-data
ddr:
evidence-count: 3
score-threshold: 0.1
# association-data
scoring_weights:
crisp: 1
europepmc: 0.2
expression_atlas: 0.2
@hammer
hammer / Dockerfile
Last active Feb 24, 2018 — forked from flying-sheep/Dockerfile
scanpy-locale-setup
View Dockerfile
FROM ubuntu:17.10
ENV LANG C.UTF-8
RUN apt-get update && \
apt-get install -y python3 python3-pip libxml2-dev zlib1g-dev wget git cmake && \
apt-get clean
RUN apt-get install -y python3-numpy # not necessary in scanpy 0.2.9.2/0.2.10
@hammer
hammer / cosmic_sigs.R
Last active Jan 9, 2017
Exploring COSMIC signatures
View cosmic_sigs.R
# deconstructSigs signatures.cosmic
library("deconstructSigs")
library("tibble")
signatures.cosmic.tidy <- tibble::rownames_to_column(as.data.frame(t(signatures.cosmic)))
# COSMIC http://cancer.sanger.ac.uk/cancergenome/assets/signatures_probabilities.txt
cosmic.current <- read.delim("http://cancer.sanger.ac.uk/cancergenome/assets/signatures_probabilities.txt", check.names = F)
cosmic.current.clean <- cosmic.current[ , colnames(cosmic.current) != ""]
cosmic.current.tidy <- cosmic.current.clean[,names(cosmic.current.clean) not in c("Substitution Type","Trinucleotide")]
@hammer
hammer / seqs2bed.py
Created Jan 11, 2016
Convert DeepSEA training sequences a BED file
View seqs2bed.py
import h5py
# HDF5 file with two arrays: 'trainxdata' (samples) and 'traindata' (labels)
INFILE_SAMPLES = ''
INFILE_REFERENCE_FASTA = ''
OUTFILE_FASTA = 'deepsea_train10k.fa'
OUTFILE_BED = 'deepsea_train10k.bed'
def onehot2base(onehot):
if onehot == [1,0,0,0]:
View sgd.ml
type sample = {
x : float;
y : float
}
type model = {
theta : float;
beta : float
}
View jpmp
#!/bin/bash
pid=$1
nsamples=$2
sleeptime=$3
for x in $(seq 1 $nsamples)
do
jstack $pid
sleep $sleeptime
done | \
@hammer
hammer / HelloKryo.scala
Created May 4, 2014
Demonstration of problems with chill-avro (twitter/chill #183)
View HelloKryo.scala
import com.twitter.bijection.avro.{GenericAvroCodec, GenericAvroCodecs}
import com.twitter.bijection.Injection
import com.twitter.chill._
import org.apache.avro.generic.{GenericRecord, GenericRecordBuilder}
import org.apache.avro.SchemaBuilder
import scala.util.{Failure, Success}
object HelloKryo {
def main(args: Array[String]) {
// Build a schema
@hammer
hammer / HelloAvro.scala
Last active Apr 26, 2019
Concise example of how to write an Avro record out as JSON in Scala
View HelloAvro.scala
import java.io.{IOException, File, ByteArrayOutputStream}
import org.apache.avro.file.{DataFileReader, DataFileWriter}
import org.apache.avro.generic.{GenericDatumReader, GenericDatumWriter, GenericRecord, GenericRecordBuilder}
import org.apache.avro.io.EncoderFactory
import org.apache.avro.SchemaBuilder
import org.apache.hadoop.fs.Path
import parquet.avro.{AvroParquetReader, AvroParquetWriter}
import scala.util.control.Breaks.break
object HelloAvro {
@hammer
hammer / server_side_datatable.py
Created Jan 21, 2014
Implementation of a server-side DataTable (cf. http://datatables.net/release-datatables/examples/data_sources/server_side.html) using Flask, Flask-RESTful, and Psycopg. You should only have to edit source_database, source_table, and source_columns to make it work. Of course you'll probably want to edit the resource name and URL as well.
View server_side_datatable.py
from string import Template
from distutils.util import strtobool
from flask import Flask, request
from flask.ext.restful import Api, Resource
import psycopg2
# Flask-RESTful Api object
app = Flask(__name__)
You can’t perform that action at this time.