Skip to content

Instantly share code, notes, and snippets.

View kbroman's full-sized avatar

Karl Broman kbroman

View GitHub Profile
#!/usr/bin/env python
#
# init and step probabilities for RI by sib-mating
# values returned are log of probabilities
#
# True genotypes BB or DD
# forward direction means BxD for cross
import math # for log
#include <Rcpp.h>
using namespace Rcpp;
// For each row, find which column has the minimum value
// With ties, pick the first
// Result is indexed starting at 1
// [[Rcpp::export]]
IntegerVector whichmin_byrow(const NumericMatrix& x)
{
const int n = x.rows();
---
title: "Test packageDescription"
author: "Karl Broman"
date: "October 19, 2015"
output: html_document
---
knitr package version: `r packageDescription("knitr")$Version`
@kbroman
kbroman / open-science-discourse.md
Created August 21, 2015 00:05 — forked from sckott/open-science-discourse.md
Discourse for open science
<!DOCTYPE HTML>
<html> <head>
<title>BioC 2015 live coding</title>
<style>body{font-family:sans-serif;}</style>
</head>
<body>
<h2>BioC 2015 live coding</h2>
<script charset="utf-8"
type="text/javascript"
#!/usr/bin/env python
import csv
def read_csv_file (filename):
data = {}
with open(filename) as csvfile:
rows = csv.reader(csvfile)
#include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp::export]]
void r_message(std::string text)
{
Rcpp::Function msg("message");
msg(text);
}
---
title: "Test R/qtlcharts"
author: "Karl Broman"
date: "June 22, 2015"
output: ioslides_presentation
---
## iplotCorr
```{r, iplotCorr, echo=FALSE, message=FALSE}
// hello world with node + express + consolidate + swig + mongodb
//
// grab name from MongoDB doc (course db, hello_mongo_express collection)
//
// type 'node hello_mongo.js' and go to http://localhost:8080
var express = require('express'),
app = express(),
cons = require('consolidate'),
MongoClient = require('mongodb').MongoClient;