This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(MASS) | |
pcov <- function(x) { | |
xs <- scale(x, scale=FALSE) | |
dd <- as.integer(!is.na(x)) | |
dim(dd) <- dim(x) | |
denom <- (t(dd) %*% dd) - 1L | |
no_obs <- denom == 0L | |
xs[is.na(xs)] <- 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Title: Using Bioconductor to Analyze your 23andme Data | |
Bioconductor is one of the open source projects of which I am most | |
fond. The documentation is excellent, the community wonderful, the | |
development fast-paced, and the software *very* well written. | |
There's a new package in the development branch (due to be released as | |
2.10 very soon) called `gwascat`. `gwascat` is a package that serves | |
as an interface to the [NHGRI's](http://www.genome.gov/) database of | |
genome-wide association studies. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Thanks https://github.com/EBI-predocs/latex-thesis/blob/master/Makefile for | |
# some tips | |
LATEXMK = latexmk -xelatex | |
# CONFIG | |
target = manuscript | |
references = bib.bib | |
# SETUP | |
includes := $(shell ls *.tex) ${references} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(purrr) | |
foo <- function(x) { | |
return(function(y) { | |
y + x | |
}) | |
} | |
args <- list(1, 2) | |
foos_map <- map(args, foo) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file is NOT licensed under the GPLv3, which is the license for the rest | |
# of YouCompleteMe. | |
# | |
# Here's the license text for this file: | |
# | |
# This is free and unencumbered software released into the public domain. | |
# | |
# Anyone is free to copy, modify, publish, use, compile, sell, or | |
# distribute this software, either in source code form or as a compiled | |
# binary, for any purpose, commercial or non-commercial, and by any |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'); | |
var d3 = require('d3'); | |
var jsdom = require('node-jsdom'); | |
var xmlserializer = require('xmlserializer'); | |
var margin = {top: 2, right: 4, bottom: 2, left: 4}; | |
var width = 200 - margin.left - margin.right, | |
height = 14 - margin.top - margin.bottom; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(GenomicRanges) | |
summarizeByTile <- | |
# given a GRanges (or some sort of ranged data) object `x`, and a | |
# *corresponding* vector values to summarize `y` (these *must* | |
# correspond), calculate the summary per tile with the function `fun`. | |
# Note: this is still beta; wider tests coming, use with caution. | |
function(x, y, tiles, fun, mcol_name="y") { | |
stopifnot(length(x) == length(y)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import division | |
from collections import Counter | |
from math import log | |
def entropy(seq, unit="bit"): | |
""" | |
Returns entropy of DNA sequence. | |
The entropy formula is: | |
entropy = -sum_i (log(p_i) * p_i) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
entropy.py | |
Calculate entropy of a given list. | |
""" | |
from math import log, log10 | |
from collections import Counter | |
import pdb | |
def entropy(x, logfun=lambda x: log(x, 2)): |