Skip to content

Instantly share code, notes, and snippets.

View lindenb's full-sized avatar
😶
I hate people.

Pierre Lindenbaum lindenb

😶
I hate people.
View GitHub Profile
@lindenb
lindenb / R01.mk
Last active August 29, 2015 13:55
how to use <a href="http://www.r-project.org/"><b>R</b></a> as the main <b>SHELL</b> of <a href="https://www.gnu.org/software/make/manual/html_node/index.html">GNU-Make</a> instead of using a classical linux shell like bash
.PHONY: all clean
SHELL = ./mockR
.SHELLFLAGS= -e
.ONESHELL:
CHROM=1 2
UCSC=http://hgdownload.cse.ucsc.edu/goldenpath/hg19/database/
@lindenb
lindenb / ucsc01.js
Created March 6, 2014 09:58
trying to connect to ucsc mysql with 'node.js'
var mysql = require('mysql');
var connection = mysql.createConnection({
debug:true,
trace:true,
host : 'genome-mysql.cse.ucsc.edu',
port : 3306,
database: 'hg19',
user : 'genome',
.PHONY:all
PROXY1= ## -httpproxy:host:port
PROXY2= ## -Dhttp.proxyHost=host -Dhttp.proxyPort=port
all: Test.class
java ${PROXY2} -cp tmp:. Test
Test.class : Test.java tmp/uk/ac/ebi/webservices/whatizit/ws/ObjectFactory.java tmp/gov/nih/nlm/ncbi/eutils/entrez/eutils/esearch/ObjectFactory.java
javac -sourcepath tmp:. $<
@lindenb
lindenb / Makefile
Created March 12, 2014 11:12
Answer to https://twitter.com/BioMickWatson/status/443694391350525953 : clipped sequences ignored by samtools. Added 8 bases to all reads in 5' and 3': only a few SNPs found.
sam.dir=/commun/data/packages/samtools-0.1.19
bwa=/commun/data/packages/bwa-0.7.6a/bwa
.PHONY:all reads
all: test.vcf
test.vcf: test.bam.bai
${sam.dir}/samtools mpileup -uf ex1.fa test.bam | ${sam.dir}/bcftools/bcftools view -vcg - > $@
test.bam.bai : ex1.fa.bwt f1.fq f2.fq
import java.io.*;
class Test
{
private static class Source
implements Runnable
{
private PipedOutputStream pipedOutputStream=new PipedOutputStream();
private InputStream in;
Source(InputStream in) throws IOException
@lindenb
lindenb / newick.js
Last active August 29, 2015 13:58
answer to biostar http://www.biostars.org/p/97409/ "Collapse clades in a Newick tree with average distance to tips < x"
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script>
var newick= null;
/* parser generated by jison 0.4.13 */
/*
Returns a Parser object of the following structure:
Parser: {
@lindenb
lindenb / gist:11079312
Created April 19, 2014 09:37
genbank to fasta
BEGIN {
inE=0;
inS=0;
def="";
}
/\/\// {
inS=0;
inE=0;
next;
}
javascript:var%20b64pad='';var%20chrsz=8;function%20b64_sha1(s){return%20binb2b64(core_sha1(str2binb(s),s.length*chrsz));}function%20core_sha1(x,len){x[len%3E%3E5]|=0x80%3C%3C(24-len);x[((len+64%3E%3E9)%3C%3C4)+15]=len;var%20w=Array(80);var%20a=1732584193;var%20b=-271733879;var%20c=-1732584194;var%20d=271733878;var%20e=-1009589776;for(var%20i=0;i%3Cx.length;i+=16){var%20olda=a;var%20oldb=b;var%20oldc=c;var%20oldd=d;var%20olde=e;for(var%20j=0;j%3C80;j++){if(j%3C16)w[j]=x[i+j];else%20w[j]=rol(w[j-3]^w[j-8]^w[j-14]^w[j-16],1);var%20t=safe_add(safe_add(rol(a,5),sha1_ft(j,b,c,d)),safe_add(safe_add(e,w[j]),sha1_kt(j)));e=d;d=c;c=rol(b,30);b=a;a=t;}a=safe_add(a,olda);b=safe_add(b,oldb);c=safe_add(c,oldc);d=safe_add(d,oldd);e=safe_add(e,olde);}return%20Array(a,b,c,d,e);}function%20sha1_ft(t,b,c,d){if(t%3C20)return%20(b&c)|((~b)&d);if(t%3C40)return%20b^c^d;if(t%3C60)return%20(b&c)|(b&d)|(c&d);return%20b^c^d;}function%20sha1_kt(t){return%20(t%3C20)?1518500249:(t%3C40)?1859775393:(t%3C60)?-1894007588:-899497514;}functio
@JAVA_EXE@
<html>
<script>
// Create the XHR object.
function createCORSRequest(method, url) {
var xhr = new XMLHttpRequest();
if ("withCredentials" in xhr) {
// XHR for Chrome/Firefox/Opera/Safari.
xhr.open(method, url, true);
} else if (typeof XDomainRequest != "undefined") {