Skip to content

Instantly share code, notes, and snippets.

View mpkocher's full-sized avatar

M. Kocher mpkocher

View GitHub Profile
@mpkocher
mpkocher / Program.fs
Last active August 29, 2015 14:04
Example ported Streaming Report Model in Fsharp
open System
open FSharp.Data
open FSharpx.Collections
// Example file filtered_subread_summary.csv
// passedFilter = 1 True
// MovieName,HoleNumber,Start,End,Length,PassedFilter
// m120201_042231_42129_c100275262550000001523007907041260_s1_p0,9,0,1756,1756,1
// m120201_042231_42129_c100275262550000001523007907041260_s1_p0,11,1513,4949,3436,1
@mpkocher
mpkocher / Program.scala
Created August 11, 2014 04:11
Port of the streaming filter report to Scala
package com.github.mpkocher
import java.io.File
// This library is not very impressive, but it works.
// The main limitation is that it doesn't read in large chunks of the file.
import com.github.tototoshi.csv._
/*
filtered_summary.csv
@mpkocher
mpkocher / update_venv_pkgs.sh
Created August 29, 2014 23:36
Update all packages in virtualenv env via pip
function update_ve_pkgs() {
echo "Updating pip packages"
for i in $(pip freeze | tr "==" " " | awk '{print $1}') ; do pip install --upgrade $i; done
}
@mpkocher
mpkocher / Program.scala
Last active August 29, 2015 14:05
Nashorn Experiments Scala + JS (Requires Oracle JDK1.8 )
package com.github.mpkocher
import java.io.IOException
import java.nio.charset.Charset
import java.nio.file.Files
import java.nio.file.Paths
import java.util
import java.util.List
import java.util.ArrayList
import javax.script.ScriptEngineFactory
@mpkocher
mpkocher / Readme.rst
Last active August 29, 2015 14:05
Dependency Inject Task definition model inspired by angularjs

DI Task API Model inspired by angularjs

# Very simple task
one_proc = 1
opts_schema = {} # task has no options
@mpkocher
mpkocher / el_pbcoreo.py
Last active October 2, 2019 15:30
Example of using pbcore's FastaReader with generators in Python
import os
import functools
import numpy as np
from pbcore.io import FastaReader, FastaRecord
def _to_records(func, file_name):
with FastaReader(file_name) as f:
@mpkocher
mpkocher / 0_reuse_code.js
Last active August 29, 2015 14:13
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@mpkocher
mpkocher / Dockerfile
Last active August 29, 2015 14:14
Dockerfile Extending docker-pacbiobase pbcore example
# Install pbcore example
FROM mpkocher/docker-pacbiobase
MAINTAINER Michael Kocher
RUN cd /tmp && git clone https://github.com/PacificBiosciences/pbcore.git && cd pbcore && pip install .
@mpkocher
mpkocher / FuturesMain.scala
Created April 14, 2015 22:26
Scala Futures Example
package com.github.mpkocher.futuresdemo
import com.typesafe.scalalogging.LazyLogging
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration._
import scala.concurrent.{Await, Future}
import scala.util.{Failure, Success}
import numpy as np
from pbcore.io.BasH5IO import BasH5Reader
class MovieResult(object):
"""Simple container class to hold the results of Movie (bax)"""
def __init__(self, file_name, movie_name, read_lengths, accuracies, num_passes):