Skip to content

Instantly share code, notes, and snippets.

John Stanton-Geddes johnstantongeddes

Block or report user

Report or block johnstantongeddes

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@johnstantongeddes
johnstantongeddes / 2014-09-18_verbatim-r-chunks-in rmd.rmd
Last active Aug 29, 2015 — forked from jennybc/2014-09-18_verbatim-r-chunks-in rmd.rmd
How to get verbatim R chunks in R markdown. Again. Writing it down now.
View 2014-09-18_verbatim-r-chunks-in rmd.rmd
---
title: "Get verbatim R chunks in R Markdown"
author: "Jenny Bryan"
date: "18 September, 2014"
output:
html_document:
keep_md: TRUE
---
My periodic revisitation of "how can I include a verbatim R chunk in `.rmd`"? This time I am writing it down! Various proposed solutions:
View ggplot_examples.Rmd
---
title: "GrammaR of graphics using `ggplot2` in R"
author: "John Stanton-Geddes"
date: "December 8, 2014"
output: html_document
---
The `ggplot2` package, deveoped by Hadley Wickham, is the most downloaded R package of [all time](http://www.rdocumentation.org/) and one of the standards for publication-ready figures. Fron the [ggplot website](http://ggplot2.org/)
> ggplot2 is a plotting system for R, based on the grammar of graphics, which tries to take the good parts of base and lattice graphics and none of the bad parts. It takes care of many of the fiddly details that make plotting a hassle (like drawing legends) as well as providing a powerful model of graphics that makes it easy to produce complex multi-layered graphics.)
@johnstantongeddes
johnstantongeddes / ROpenBUGS_example.R
Created Aug 19, 2014
Example of running BUGS for Bayesian inference from R
View ROpenBUGS_example.R
####################################
# TITLE: ONEWAY.R
# PURPOSE: ILLUSTRATE ONE WAY ANALYSIS OF VARIANCE
# DATA: AGES AT WHICH INFANTS FIRST WALKED ALONE, FROM FISHER AND VAN BELLE (2nd edition),
# PAGE 359. FOUR GROUPS: ACTIVE GROUP,
@johnstantongeddes
johnstantongeddes / df_fit_lm.R
Created Jun 13, 2014
Challenge to fit a lm to every "gene" in df
View df_fit_lm.R
df <- data.frame(gene = rep(c(paste("gene", 1:10, sep="")), 5),
treatment = rep(paste("trt", 1:5, sep=""), each=10),
temp = rep(1:5, each=10),
exp = rnorm(50))
head(df)
# lm for a single gene
lmout <- lm(exp ~ temp, data = df[df$gene == "gene1", ])
@johnstantongeddes
johnstantongeddes / RPKM-TPM.r
Created Oct 10, 2013
Script to compare calculation of Reads per Kilobase per Million mapped reads (RPKM) to Transcripts per Million (TPM) using example data from http://blog.nextgenetics.net/?e=51. Wagner et al. 2012 "Measurement of mRNA abundance using RNA-seq data: RPKM measure is inconsistent among samples" Theory Biosci. 131:281-285
View RPKM-TPM.r
# Script to compare Reads per Kilobase per Million mapped reads (RPKM) to Transcripts per Million (TPM) for gene expression count data
# Wagner et al. 2012 "Measurement of mRNA abundance using RNA-seq data: RPKM measure
# is inconsistent among samples" Theory Biosci. 131:281-285
library(plyr)
## Worked example from http://blog.nextgenetics.net/?e=51
X <- data.frame(gene=c("A","B","C","D","E"), count=c(80, 10, 6, 3, 1),
@johnstantongeddes
johnstantongeddes / interleave-illumina-backward.py
Created Jul 30, 2013
Python script to add Illumina 1.3 format fastq paired read tags '\1' and '\2' for forward and reverse reads, respectively, to an interleaved Illumina 1.8 format fastq file. Modified from [/khmer/sandbox/interleave.py](https://github.com/ged-lab/khmer/blob/master/sandbox/interleave.py)
View interleave-illumina-backward.py
#! /usr/bin/env python
import screed, sys, itertools
s1_file = sys.argv[1]
s2_file = sys.argv[2]
for r1, r2 in itertools.izip(screed.open(s1_file), screed.open(s2_file)):
name1 = r1.name
if not name1.endswith('/1'):
name1 += '/1'
You can’t perform that action at this time.