Skip to content

Instantly share code, notes, and snippets.

View brentp's full-sized avatar

Brent Pedersen brentp

View GitHub Profile
import os
import stats
import hts
import plotly
import strformat
import bpbiopkg/pedfile
#[
look at allele balance on mitochondrial chromosome.
this only plots sites for each sample that have an allele balance (alt / ref + alt) between 0.01 and 0.99.
type Signal* = object
left*: uint32
right*: uint32
left_exact* {.bitsize: 1.}: uint32
right_exact* {.bitsize: 1.}: uint32
when defined(debug):
name*: string
proc makeSignal(): Signal =
result.left_exact = 1'u32
import hts
import strformat
import os
import osproc
import tables
var
vcf_path = commandLineParams()[0]
fasta_path = commandLineParams()[1]
vcf: VCF
{.emit:"""
#define bam_get_qual(b) ((b)->data + ((b)->core.n_cigar<<2) + (b)->core.l_qname + (((b)->core.l_qseq + 1)>>1))
""".}
proc bam_get_qual*(b: ptr bam1_t): ptr uint8 {.importc, nodecl.}
# http://docs.aws.amazon.com/batch/latest/userguide/create-batch-ami.html
sudo yum update
sudo yum install -y grub
sudo yum install -y ecs-init
sudo reboot now
sudo stop ecs
sudo rm -rf /var/lib/ecs/data/ecs_agent_data.json
sudo -E su
@brentp
brentp / geneplot.py
Created July 18, 2017 21:53
gene plotter.
import numpy as np
from matplotlib import pyplot as plt
from matplotlib import gridspec
import seaborn as sns
sns.set_style('white')
def geneplot(exons, patho_variants, population_variants=None, constraint=None,
density=None,
opts={'constraint_color': (0.7, 0.7, 0.7),
package bit_test
import (
"math/big"
"testing"
)
func BenchmarkUint64(b *testing.B) {
for i := 0; i < b.N; i++ {
var x uint64
apt-get update
apt-get -qy install libcurl4-openssl-dev curl cmake make build-essential libbz2-dev lzma-dev liblzma-dev git \
python-dev
mkdir -p /home/ubuntu
cd /home/ubuntu
git clone --depth 1 http://root.cern.ch/git/root.git
mkdir root/ibuild
cd root/ibuild
cmake -D x11=OFF ../
make -j4 install
from scipy.stats import chisquare
import sys
def cnrand(counts):
"""
cnrand will return the chisquare p-value of the observed distribution
of copy-number genomes **of the same CN with 0...n copies of H47R
# test 4-copy genomes (0 ... 4)
# 1 0 copy, 1 3-copy and 1 4-copy
@brentp
brentp / cram-proposal.md
Last active February 8, 2017 17:22
biogo/hts cram proposal

Proposal: CRAM (v3) format support in GO

Last updated: Feb. 8, 2017

Abstract

CRAM format encodes genomic alignments to a reference. It has better lossless (and optional lossy) compression compared to existing BAM format. It is also becoming more widely used. We propose the addition of a CRAM Reader to biogo/hts under hts/cram.