Skip to content

Instantly share code, notes, and snippets.

@hammer
hammer / mrtarget.data.19.06.yml
Last active July 7, 2019 19:46
Configuration organized by ES index
# 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 / platform-input-support-config.yaml
Last active July 8, 2019 20:28
Configuration organized by ES index; note that this will not parse correctly! It's for purely pedagogical purposes.
# [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 / server_side_datatable.py
Created January 21, 2014 15:58
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.
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__)
@hammer
hammer / HelloAvro.scala
Last active October 17, 2022 04:16
Concise example of how to write an Avro record out as JSON in 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 {