Skip to content

Instantly share code, notes, and snippets.

@lomereiter
lomereiter / markov.rb
Created May 6, 2013 11:34
Markov algorithm interpreter
# -*- coding: utf-8 -*-
Rule = Struct.new :from, :to, :exit
def parseSingleRule(rule_src)
rule_src =~ /^\s*([^\s]*)\s*=>\s*([\.]?)([^\s]*)\s*$/
r = Rule.new($1, $3)
r.exit = $2 == '.'
r
end
import bio.bam.reader;
import bio.bam.pileup;
import bio.core.base;
import bio.core.tinymap;
import std.stdio, std.parallelism, std.algorithm, std.array, std.range;
void main(string[] args) {
defaultPoolThreads = 4;
import std.stdio, std.range, std.algorithm, std.conv, std.string, std.file;
immutable letters = "abcdefghijklmnopqrstuvwxyz"d;
auto replaces(S)(S word) {
return word.length.iota.map!(i =>
letters.length.iota.map!(j =>
word[0 .. i].chain(letters[j .. j+1], word[i+1 .. $])))
.joiner;
}
// building suffix trees in linear time using the Ukkonen's algorithm
//
// with -debug flag, LOTS of output is printed during construction
// so that each step of the algorithm can be studied
import std.stdio;
import std.array, std.range, std.algorithm;
class SuffixTree {
static struct Node {
@lomereiter
lomereiter / auto_brightness.py
Created May 23, 2015 19:59
automatic brightness adjustment on external monitor
import cv
import commands
import time
from PIL import Image
from collections import deque
camera = cv.CreateCameraCapture(-1)
prev_brightness_values = deque([], 5)
prev_brighness = None
> git-lfs smudge genotype_files/gemma/HLC.map
LocalWorkingDir=/home/lomereiter/github/genenetwork2
LocalGitDir=/home/lomereiter/github/genenetwork2/.git
LocalMediaDir=/home/lomereiter/github/genenetwork2/.git/lfs/objects
TempDir=/home/lomereiter/github/genenetwork2/.git/lfs/tmp
GIT_DIR=.git
Error accessing media: genotype_files/gemma/HLC.map (84241b81feb7eec3c0b914e223ff23810c69610a6e759baf4797bab4a4850de8)
Error downloading /home/lomereiter/github/genenetwork2/.git/lfs/objects/84/24/84241b81feb7eec3c0b914e223ff23810c69610a6e759baf4797bab4a4850de8.
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py
index a572a60..b152357 100755
--- a/wqflask/base/data_set.py
+++ b/wqflask/base/data_set.py
@@ -555,12 +555,22 @@ class DataSet(object):
# """ % (query_args))
try:
- self.id, self.name, self.fullname, self.shortname = g.db.execute("""
+ if self.type != "ProbeSet":
// compilation: rdmd --build-only -O -release -inline -IBioD sambamba_161.d
// to use LDC: rdmd --compiler=ldmd2 [--force] ...
import bio.bam.reader, bio.bam.writer, std.parallelism;
void main(string[] args) {
// boilerplate
defaultPoolThreads = 8;
auto input = new BamReader(args[1]); // use std.getopt for better args handling
auto output = new BamWriter(args[2]);
output.writeSamHeader(input.header);
@lomereiter
lomereiter / pipeline.py
Last active August 31, 2015 23:22
Metabolomics pipeline
import sys
# path to pyIMS parent dir
sys.path.append("/home/lomereiter/github")
from pyIMS.image_measures.level_sets_measure import measure_of_chaos
from pyIMS.image_measures.isotope_image_correlation import isotope_image_correlation
from pyIMS.image_measures.isotope_pattern_match import isotope_pattern_match
import numpy as np
import cPickle
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.