Skip to content

Instantly share code, notes, and snippets.

View philippbayer's full-sized avatar

Philipp Bayer philippbayer

View GitHub Profile
@philippbayer
philippbayer / problems.md
Last active February 11, 2016 04:31
Solution for weird Module::Build install bug under perl

Commands are:

cpan
install Module::Build

when makepl_arg etc. are set to a non-standard, local folder.

Error message is:

@philippbayer
philippbayer / optima.sh
Last active January 25, 2016 09:16
optima
>cat /etc/*-release
Fedora release 23 (Twenty Three)
[more about Fedora I deleted]
>cat /proc/version
Linux version 4.3.3-301.fc23.x86_64 ([email protected]) (gcc version 5.3.1 20151207 (Red Hat 5.3.1-2) (GCC) ) #1 SMP Fri Jan 15 14:03:17 UTC 2016
>javac -version
javac 1.8.0_71
>java -version
openjdk version "1.8.0_71"
OpenJDK Runtime Environment (build 1.8.0_71-b15)
@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 {
@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 / 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 / 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 / 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 / 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 / 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 / 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"
)