Skip to content

Instantly share code, notes, and snippets.

View ngehlenborg's full-sized avatar
🧪
🍋➡️🥤

Nils Gehlenborg ngehlenborg

🧪
🍋➡️🥤
View GitHub Profile
import re
import sys
import csv
import json
import urllib2
from datetime import datetime
from collections import defaultdict as dd
@ngehlenborg
ngehlenborg / gist:9107086
Created February 20, 2014 04:26
Set Indexing Experiments
// experiments
// Author: Nils Gehlenborg (@ngehlenborg)
var nextBitPermutation = function( current ) {
// from: http://www-graphics.stanford.edu/~seander/bithacks.html#NextBitPermutation
var v = current;
var t = (v | (v - 1)) + 1;
var w = t | ((((t & -t) / (v & -v)) >> 1) - 1);
return ( w>>>0 );
};
@ngehlenborg
ngehlenborg / hex-to-rgba.js
Last active August 29, 2015 13:57
Hex color string to RGB values to create RGBA color
var hexToRgba = function( hexString, alpha ) {
alpha = alpha || 1;
var hexColor = parseInt( hexString.substring(1), 16 );
return ( 'rgba(' + ( ( hexColor << 8 ) >>> 24 ) + ',' + ( ( hexColor << 16 ) >>> 24 ) + ',' + ( ( hexColor << 24 ) >>> 24 ) + ',' + alpha + ')' );
}
@ngehlenborg
ngehlenborg / yappi-profiling.py
Created August 19, 2015 01:05
Yappi profiling in current thread using wall clock time.
import yappi
yappi.set_clock_type("wall")
yappi.start(builtins=False,profile_threads=False)
# code to profile goes here
yappi.get_thread_stats().print_all()
yappi.stop()
yappi.clear_stats()
import string
input_file = open('massachusetts_municipalities.txt', 'r')
list_entries = {}
for line in input_file:
if line[0] not in list_entries:
list_entries[line[0]] = []
list_entries[line[0]].append(line.strip())
output_file = open('interleaved_list.txt', 'w')
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Matrix visualization</title>
<link href="../caleydo/bundle.css" type="text/css" rel="stylesheet">
<style type="text/css">
.select-selected {
fill: orange;
@ngehlenborg
ngehlenborg / fiddle.css
Last active February 23, 2016 03:57 — forked from flekschas/data.js
Caleydo Web Tutorial - AngularJS heatmap integration
@import url(https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,700);
$colorBlindBlue: #50b4e9;
$colorBlindYellow: #f0e442;
$colorDirectHoverBg: #ccc;
$colorIndirectHoverBg: #e5e5e5;
$colorSelectedBg: $colorBlindYellow;
#app {
@ngehlenborg
ngehlenborg / pubmed_visualization_papers.R
Created March 3, 2016 22:54
Query PubMed to retrieve counts of visualization papers* published in bioinformatics journals** between 2000 and 2015. (* = "visualization" in title or abstract, ** = Bioinformatics, BMC Bioinformatics, PLoS Computational Biology, Briefings in Bioinformatics)
require(RISmed);
queryPapers <- function(year, query="visualization") {
query <- paste('((', query, '[Title/Abstract]) AND ("', year,'"[Date - Publication]) AND ("Bioinformatics (Oxford, England)"[Journal] OR "BMC bioinformatics"[Journal] OR "PLoS computational biology"[Journal] OR "Briefings in bioinformatics"[Journal]))', sep="")
queryPubs <- EUtilsSummary(query, type='esearch', db='pubmed')
all <- paste('(("', year,'"[Date - Publication]) AND ("Bioinformatics (Oxford, England)"[Journal] OR "BMC bioinformatics"[Journal] OR "PLoS computational biology"[Journal] OR "Briefings in bioinformatics"[Journal]))', sep="")
allPubs <- EUtilsSummary('(("2015"[Date - Publication]) AND ("Bioinformatics (Oxford, England)"[Journal] OR "BMC bioinformatics"[Journal] OR "PLoS computational biology"[Journal] OR "Briefings in bioinformatics"[Journal]))', type='esearch', db='pubmed')
require(RISmed);
require(ggplot2);
makeJournalQuery <- function( journals ) {
query <- paste( "(" , paste( "\"", journals, "\"[Journal]", sep="", collapse=" OR " ), ")", sep="" );
return ( query );
}
queryPapers <- function( year, query, journals ) {

HiC data

Smaller test set

Real data set

FILENAME=rao_et_al/HMEC/5kb_resolution_intrachromosomal/chr1/MAPQGE30/chr1_5kb.RAWobserved
FILENAME=rao_et_al/HMEC/5kb_resolution_intrachromosomal/chr1/MAPQGE30/chr1_5kb.RAWobserved
FILENAME=rao_et_al/HUVEC/5kb_resolution_intrachromosomal/chr1/MAPQGE30/chr1_5kb.RAWobserved