Skip to content

Instantly share code, notes, and snippets.

View kbroman's full-sized avatar

Karl Broman kbroman

View GitHub Profile
1MIN
Normal Mutant
B6 146.63 138.61000000000001 153.63999999999999 166.05 179.29 186.88
BTBR 245.71 239.98 243.13 177.8 171.6 188.07
5MIN
Normal Mutant
B6 333.55 353.64 408.82 450.64 474.37 423.85
BTBR 514.47 610.64 597.94000000000005 412.07 447.48 446.5
# modify prompt color for teaching
# color prompt to include branch information
function color_my_prompt {
local __user_and_host="\[\033[01;30m\]\u@\h"
local __cur_location="\[\033[01;30m\]\W" # use \w for full path; \W for last bit
local __git_branch='`git branch 2> /dev/null | grep -e ^* | sed -E s/^\\\\\*\ \(.+\)$/\(\\\\\1\)\ /`'
local __prompt_tail="\[\033[01;30m\]$"
local __last_color="\[\033[00;33m"
## Stuff from Karl's ~/.Rprofile file
## hate those stars and scientific notation
options(show.signif.stars=FALSE, scipen=10)
## rstudio as my cran mirror
options(repos="http://cran.rstudio.com",
CRAN = "http://cran.rstudio.com",
browserNLdisabled = TRUE,
deparse.max.lines = 2)
if(!require(qtlcharts)) {
library(devtools)
install_github("kbroman/qtlcharts")
library(qtlcharts)
}
library(qtl)
library(htmlwidgets)
data(grav)
grav$pheno <- grav$pheno
@kbroman
kbroman / dot.Rprofile
Created February 25, 2015 20:45
A .Rprofile file for Dave Harris.
message("Beware of recycling\n \\\ \n \\\
\\`*-.
) _`-.
. : `. .
: _ ' \
; *` _. `*-._
`-.-' `-.
; ` `.
:. . \\
@kbroman
kbroman / test_qtlcharts.Rmd
Created February 23, 2015 15:07
Problem with multiple htmlwidgets within an R Markdown document
---
title: "test qtlcharts"
author: "Karl Broman"
date: "February 23, 2015"
output: html_document
---
```{r load_lib}
library(devtools)
install_github("kbroman/qtlcharts", ref="htmlwidgets")
## trying to understand sizingPolicy in htmlwidgets
#
# It seems like viewer.defaultHeight/Width are ignored
# within RStudio
# testjs package
if(!require(testjs)) {
library(devtools)
install_github("kbroman/testjs")
library(testjs)
@kbroman
kbroman / ReadMe.md
Last active February 9, 2024 05:19
Linking two D3-based plots

An example that links two plots

This is an example to link two plots with D3, in response to a question posed by @keeghin.

See also this jsfiddle.

The typical thing I do is to assign a class to points that includes a

library(qtl)
library(parallel)
# fake intercross data
data(fake.f2)
# single-QTL genome scan
fake.f2 <- calc.genoprob(fake.f2, step=1)
out <- scanone(fake.f2, method="hk")
set.seed(91820205)
n <- 50
nlev <- 5
ncol <- 4
x <- rnorm(n)
y <- factor(sample(1:nlev, n, replace=TRUE), levels=1:nlev)
z <- factor(sample(1:ncol, n, replace=TRUE), levels=1:ncol)
library(broman)