This file contains hidden or 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
# elsa-fy for minecraft | |
# using the miner R package, https://github.com/ROpenSciLabs/iner | |
# | |
# when she walks on water, it turns to ice | |
elsafy <- function(player_id=NULL, water=c(8, 9), ice=174, delay=0.02) | |
{ | |
on.exit( { # clean up a bit | |
for(i in 1:20) miner:::mc_receive() | |
} ) |
This file contains hidden or 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
// [[Rcpp::depends(RcppEigen)]] | |
#include <RcppEigen.h> | |
using namespace Rcpp; | |
using namespace Eigen; | |
MatrixXd AtA(const MatrixXd A) { | |
int n = A.cols(); | |
return MatrixXd(n,n).setZero().selfadjointView<Lower>() |
This file contains hidden or 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
# calculating transition probabilities for 19-way Arabidopsis MAGIC | |
# | |
# full diallel both directions (F1) | |
# 3 generations random mating (F4) - 384 families | |
# selfed for 6 generations; could be "cousin" lines from an F4 family | |
# 1026 MAGIC lines; 527 in paper | |
# | |
# Kover et al (2009) PLOS Genet 5: e1000551 | |
# https://doi.org/10.1371/journal.pgen.1000551 | |
# |
This file contains hidden or 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
# 2^n-way RIL by selfing | |
# binned two-locus probabilities, likelihood for rec frac, MLE | |
# 8-way RIL by selfing | |
probs8 <- function(r) c((1-r)^2, r*(1-r), r/2)/8/(1+2*r) * c(8, 8, 48) | |
llik8 <- | |
function(r, counts) |
This file contains hidden or 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
### Keybase proof | |
I hereby claim: | |
* I am kbroman on github. | |
* I am kbroman (https://keybase.io/kbroman) on keybase. | |
* I have a public key ASDXTXYHggi4u82YcSipBqLzFN0_nIi2Fx_1To3szhvg7Ao | |
To claim this, I am signing this object: |
This file contains hidden or 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
# Halloween 2016 counts figure | |
# Karl Broman | |
# http://kbroman.org | |
# the data: time and kid count | |
x <- read.csv("halloween2016.csv", comment.char="#") | |
colnames(x) <- c("time", "n.kids") | |
# cumulative numbers of kids | |
csum <- cumsum(x$n.kids) |
This file contains hidden or 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
\documentclass{article} | |
\begin{document} | |
Here's a scatterplot: | |
<<scatterplot>>= | |
x <- rnorm(100) | |
y <- x + rnorm(100) | |
plot(x,y) |
This file contains hidden or 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
# convert "5 min" "3 h" "4 d" etc to seconds | |
shit2sec <- | |
function(shit) | |
{ | |
# remove leading space | |
shit <- sub("^\\s+", "", shit) | |
# remove ending space | |
shit <- sub("\\s+$", "", shit) |
This file contains hidden or 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
# simulating DOF1 data | |
# cross between DO individuals and some 9th strain | |
library(simcross) | |
library(qtl2geno) | |
# load some DO data, for the founder genotypes and map | |
file <- paste0("https://raw.githubusercontent.com/rqtl/", | |
"qtl2data/master/DO_Recla/recla.zip") | |
do_recla <- read_cross2(file) |
This file contains hidden or 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
# simulate RIL | |
# | |
# QTL on chr 6 at 19.9 cM | |
# a = -6.85, hsq = 0.1768 | |
# load R/qtl | |
library(qtl) | |
# QTL effect and residual SD | |
a <- -6.85 |