Skip to content

Instantly share code, notes, and snippets.

View philippbayer's full-sized avatar

Philipp Bayer philippbayer

View GitHub Profile
[ 5527.775]
X.Org X Server 1.13.3
Release Date: 2013-03-07
[ 5527.775] X Protocol Version 11, Revision 0
[ 5527.775] Build Operating System: 2.6.32-358.2.1.el6.x86_64
[ 5527.775] Current Operating System: Linux localhost.localdomain 3.8.11-200.fc18.x86_64 #1 SMP Wed May 1 19:44:27 UTC 2013 x86_64
[ 5527.776] Kernel command line: BOOT_IMAGE=/vmlinuz-3.8.11-200.fc18.x86_64 root=/dev/mapper/fedora-root ro rd.lvm.lv=fedora/swap rd.md=0 rd.dm=0 rd.luks=0 rd.lvm.lv=fedora/root vconsole.keymap=de rhgb quiet LANG=en_US.UTF-8
[ 5527.776] Build Date: 17 April 2013 04:51:09AM
[ 5527.776] Build ID: xorg-x11-server 1.13.3-3.fc18
[ 5527.776] Current version of pixman: 0.28.0
@philippbayer
philippbayer / bla.py
Created May 24, 2013 07:01
How to slightly nudge the position of ylabels down
for tick in ax.get_xticklabels():
pos = tick.get_position()
tick.set_position((pos[0], pos[1]-1))
@philippbayer
philippbayer / natural_sort.go
Last active June 30, 2019 18:00
A perverted kind of natural sort in golang
package main
import (
"fmt"
"log"
"sort"
"strconv"
"strings"
"unicode"
)
@philippbayer
philippbayer / gist:5881974
Created June 28, 2013 02:15
Running pg_stat_statements on openSNP
SELECT query, calls, total_time, rows, 100.0 * shared_blks_hit
nullif(shared_blks_hit + shared_blks_read, 0) AS hit_percent
FROM pg_stat_statements ORDER BY total_time DESC LIMIT 5;
--
query | calls | total_time | rows | hit_percent
-----------------------------------------------------------------------------------------------------------
@philippbayer
philippbayer / similarity.py
Created January 3, 2014 05:35
My solution for "String Similarity" for HackerRank
def get_similarity(a, suffix):
from itertools import izip
score = 0
for a, b in izip(a, suffix):
if a != b:
break
score += 1
return score
def stringSimilarity(a):
@philippbayer
philippbayer / bla
Last active August 29, 2015 13:56
weirdness in rpy2
In R:
png("heatmap_before_sorting.png")
image(distance_matrix)
dev.off()
library("gclus")
ordered <- order.single(distance_matrix, clusters=NULL)
sorted_matrix <- distance_matrix[ordered, ordered]
In Python:
@philippbayer
philippbayer / blabla
Created June 11, 2015 21:01
getting 1000 genomes data with tabix and python
urls={"1":"ftp://ftp-trace.ncbi.nih.gov/1000genomes/ftp/release/20130502/ALL.chr1.phase3_shapeit2_mvncall_integrated_v5a.20130502.genotypes.vcf.gz",
"10":"ftp://ftp-trace.ncbi.nih.gov/1000genomes/ftp/release/20130502/ALL.chr10.phase3_shapeit2_mvncall_integrated_v5a.20130502.genotypes.vcf.gz",
"11":"ftp://ftp-trace.ncbi.nih.gov/1000genomes/ftp/release/20130502/ALL.chr11.phase3_shapeit2_mvncall_integrated_v5a.20130502.genotypes.vcf.gz",
"12":"ftp://ftp-trace.ncbi.nih.gov/1000genomes/ftp/release/20130502/ALL.chr12.phase3_shapeit2_mvncall_integrated_v5a.20130502.genotypes.vcf.gz",
"13":"ftp://ftp-trace.ncbi.nih.gov/1000genomes/ftp/release/20130502/ALL.chr13.phase3_shapeit2_mvncall_integrated_v5a.20130502.genotypes.vcf.gz",
"14":"ftp://ftp-trace.ncbi.nih.gov/1000genomes/ftp/release/20130502/ALL.chr14.phase3_shapeit2_mvncall_integrated_v5a.20130502.genotypes.vcf.gz",
"15":"ftp://ftp-trace.ncbi.nih.gov/1000genomes/ftp/release/20130502/ALL.chr15.phase3_shapeit2_mvncall_integrated_v5a.20130502.genotypes.vcf.gz",
"16":
@philippbayer
philippbayer / plot_gene_covs.R
Last active November 11, 2015 09:01
This R script creates a nice faceted plot of read coverage of reads based on bedtools genomecov -d output, to which one column with gene names was added
# Fileformat is
# Gene Chr Pos Cov
# gene_A A01 40 0
# gene_A A01 41 2
# ...
# gene_D A01 508 41
# gene_D A01 509 42
# ...
geneCov <- read.table("./test_genes.txt", sep="\t", header=F)
@philippbayer
philippbayer / index.html
Last active December 8, 2015 04:08
Simple D3 gene expression example
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.node {
stroke: #fff;
stroke-width: 1.5px;
}
.link {
@philippbayer
philippbayer / index.html
Created December 8, 2015 04:16
Another test
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.node {
stroke: #fff;
stroke-width: 1.5px;
}
.link {