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
# a function to deal with sprintf("%.2f", ...) returning -0.00 | |
# see https://twitter.com/hspter/status/314858331598626816 | |
f <- function(..., dig=2) { | |
g <- sprintf(paste0("%.", dig, "f"), ...) | |
z <- paste0("0.", paste(rep("0", dig), collapse="")) | |
g[g==paste0("-",z)] <- z | |
g | |
} |
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
# cistrans_coffee | |
# | |
# Interactive cis-trans eQTL plot | |
# | |
# In top figure, x-axis corresponds to marker location, y-axis is | |
# genomic position of probes on a gene expression microarray Each | |
# plotted point is an inferred eQTL with LOD > 10; opacity corresponds | |
# to LOD score, though all LOD > 25 are made fully opaque. | |
# | |
# Hover over a point to see probe ID and LOD score; also highlighted |
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
# cistrans_coffee | |
# | |
# Interactive cis-trans eQTL plot | |
# | |
# In top figure, x-axis corresponds to marker location, y-axis is | |
# genomic position of probes on a gene expression microarray Each | |
# plotted point is an inferred eQTL with LOD > 10; opacity corresponds | |
# to LOD score, though all LOD > 25 are made fully opaque. | |
# | |
# Hover over a point to see probe ID and LOD score; also highlighted |
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
# function to simulate chutes and ladders game | |
chutesNladders <- | |
function(nplayers=1) | |
{ | |
transitions <- rbind( | |
c(1, 38), | |
c(4, 14), | |
c(9, 31), | |
c(16, 6), | |
c(21, 42), |
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(qtl) | |
# simulate data | |
set.seed(57173190) | |
data(map10) | |
map10 <- map10[1:2] | |
x <- sim.cross(map10, n.ind=128, type="riself") | |
g1 <- pull.geno(x)[,"D1M6"] | |
g2 <- pull.geno(x)[,"D2M6"] | |
x$pheno[,1] <- rnorm(nind(x)) + 0.5*(g1==2) + 1.5*(g2==2) |
We can make this file beautiful and searchable if this error is corrected: It looks like row 4 should actually have 4 columns, instead of 7 in line 3.
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
id,chrom,cM,bp | |
1_444,1,0,44 | |
MSAT1.1,1,162,263 | |
5-727,5,34,727,,, | |
5-784,5,35,784,,, | |
5_472,5,24,472 |
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
###################################################################### | |
# | |
# cleanGeno: omit genotypes that are possibly in error, as indicated | |
# by apparent double-crossovers separated by a distance of | |
# no more than maxdist and having no more than maxmark | |
# interior typed markers | |
# | |
###################################################################### | |
cleanGeno <- |
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
$$latex | |
\begin{bmatrix} | |
a & z \\ | |
d & e \\ | |
g & h | |
\end{bmatrix} | |
$$ |
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
```{r} | |
cat(RJSONIO::toJSON(list(x=1, y=character(0)))) | |
sessionInfo() | |
``` |
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
mu <- 3 | |
sigma <- 5 | |
ran <- rnorm(1e5, mu, sigma) | |
differentiate <- | |
function(x, y) | |
{ | |
diffOfX <- diff(x) | |
data.frame( | |
x = x[-length(x)] + (diffOfX / 2), |
OlderNewer