Skip to content

Instantly share code, notes, and snippets.

@indraniel
indraniel / vcf-subpopulation-annotate.go
Created September 10, 2015 14:28
annotate a VCF with allelic frequency information (AF, AC, & AN) on total and subpopulation sets
package main
/*
Building & Usage
----------------
go build -o foo subpopulation-annotate.go
./foo --in /path/to/input/test.vcf --sample-population-map /path/to/20120131-omni-2141-sample-superpopulation.dat --out /path/to/out.vcf.gz
Where "20120131-omni-2141-sample-superpopulation.dat" is a tsv file like:
@indraniel
indraniel / vcf-filter.go
Created September 11, 2015 02:29
A golang VCF file filtering template
package main
import (
"fmt"
"log"
"os"
"os/signal"
"strings"
"syscall"
package main
import (
"fmt"
"log"
"math"
"os"
"os/signal"
"strconv"
"strings"
package main
import (
"fmt"
"log"
"math"
"os"
"os/signal"
"strconv"
"strings"
@indraniel
indraniel / knit-latex.r
Created September 29, 2015 17:02
A very bare-bones way to knitr a TeX document
#!/usr/bin/env Rscript
args <- commandArgs(trailingOnly=TRUE)
file <- args[1]
cat(paste("Processing: ", file, "\n"))
library(knitr)
knit(file)
@indraniel
indraniel / analytics-project-layout.md
Created September 29, 2015 17:16
A WIP skeleton layout for analytics projects

A useful starter skeleton layout for analytics project.

project-dir 
├── README.md
├── bin
├── data
│   ├── derived
│   ├── original
│   └── test

├── docs

@indraniel
indraniel / sff2fastq-main.c
Created July 7, 2012 19:42
modification to sff2fastq's main.c to highlight/debug the trimming read points in a SFF file
/* N O T E S ******************************************************************/
/*
substitute this file for the main.c in the sff2fastq project. Upon
recompliation you then try the following command:
sff2fastq -n <sff-file>
This will add an extra debugging line in the FASTQ output like:
@indraniel
indraniel / transpose.awk
Created October 13, 2015 20:36
transpose a text table
#!/usr/bin/awk -f
# taken from: http://stackoverflow.com/questions/1729824/transpose-a-file-in-bash
{
for (i=1; i<=NF; i++) {
a[NR,i] = $i
}
}
NF>p { p = NF }
END {
@indraniel
indraniel / 1-fetch-na12878-pedigree-metadata.py
Created December 30, 2015 23:12
use lxml to fetch NA12878 Coriell Sample Info
#!/usr/bin/env python
from __future__ import print_function, division
import sys, os, pprint
from glob import glob
import requests
from lxml import html
from toolz.curried import *
@indraniel
indraniel / Makefile
Last active January 16, 2016 19:44
An example of a LaTeX/knitr report setup containing a git commit revision number
.PHONY: clean
PRJDIR := /path/to/project
DOCS := $(PRJDIR)/docs
RLIBS := /gscmnt/gc2801/analytics/idas/jira/BIO-1465/rpkgs
REPORTDIR := $(DOCS)/writeups
PDFLATEX := /home/archive/texlive-2015/2015/bin/x86_64-linux/pdflatex
writeup: $(REPORTDIR)/report.pdf