Skip to content

Instantly share code, notes, and snippets.

View danielecook's full-sized avatar
😀
Things are going good

Daniel E Cook danielecook

😀
Things are going good
View GitHub Profile
@danielecook
danielecook / pyenv.sublime-build
Created May 2, 2018 20:15
pyenv sublime build system
{
"cmd": ["/usr/local/var/pyenv/shims/python", "-u", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python"
}
@danielecook
danielecook / summarize_vcf.py
Created March 15, 2018 14:43
summarize VCF
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Author: Daniel E. Cook
This script summarizes variation for samples.
"""
import sys
@danielecook
danielecook / rarefaction.R
Last active March 14, 2018 06:55
rarefaction.R
library(tidyverse)
# bcftools query -f "[%GT\t]\n" WI.20170531.impute.vcf.gz | awk '{ gsub(":GT", "", $0); gsub("(# )?\[[0-9]+\]","",$0); print $0 }' | sed 's/0|0/0/g' | sed 's/1|1/1/g' | sed 's/0|1/NA/g' | sed 's/1|0/NA/g' | head -n 1000000 | gzip > ~/Desktop/impute_gts.test.tsv.gz
df_use <- tseries::read.matrix(gzfile("~/Desktop/impute_gts.tsv.gz"))
storage.mode(df_use) <- "logical"
# cols
@danielecook
danielecook / gist:a2061ea53a6f2fe1b5f1bec5286dccdc
Last active February 22, 2018 07:36
Integrate into wi-nf / SnpEff annotation
# OUT PUT FILES::::
# elegans_transcript_WS258.bed ( COMES FROM /elegans_genes_WS258.bb )
# elegans_gene_WS258.bed (remember; comes from GFF3)
# FASTA! c_elegans.PRJNA13758.WS245.genomic.fa (ftp://ftp.wormbase.org/pub/wormbase/releases/WS258/species/c_elegans/PRJNA13758/)
# Download gene file
wget ftp://ftp.wormbase.org/pub/wormbase/releases/WS258/MULTI_SPECIES/hub/elegans/elegans_genes_WS258.bb
# Bit of a misnomer --> These are transcripts
BigBedToBed elegans_genes_WS258.bb elegans_transcripts_WS258.bed
@danielecook
danielecook / swot.py
Created February 1, 2018 11:14
Generate swot (domain --> school/university)
import os
import shutil
import pickle
from subprocess import Popen, PIPE
from collections import defaultdict
out, err = Popen(['git','clone','https://github.com/leereilly/swot'],
stdout=PIPE,
stderr=PIPE).communicate()
school_directory = defaultdict()
{
"shell_cmd": "`pyenv which python` -u \"$file\"",
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python"
}
@danielecook
danielecook / .block
Created December 14, 2017 17:45 — forked from mbostock/.block
Tree of Life
license: gpl-3.0
height: 960
@danielecook
danielecook / .block
Created December 14, 2017 17:45 — forked from mbostock/.block
Tree of Life
license: gpl-3.0
height: 960
@danielecook
danielecook / count.sh
Created December 8, 2017 05:18
Count the number of lines in git repo #git
git ls-files | xargs cat | wc -l