Skip to content

Instantly share code, notes, and snippets.

View stephenturner's full-sized avatar

Stephen Turner stephenturner

View GitHub Profile
idat2lumibatch <- function(filenames) {
# filenames is a character vector of iDAT filenames
require(illuminaio)
require(lumi)
idatlist = lapply(filenames,readIDAT)
exprs = sapply(idatlist,function(x) {
return(x$Quants$MeanBinData)})
se.exprs = sapply(idatlist,function(x) {
return(x$Quants$DevBinData/sqrt(x$Quants$NumGoodBeadsBinData))})
beadNum = sapply(idatlist,function(x) {
# Put this in your .bashrc:
echo 'eval $(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)'
## Install bioperl
wget http://bioperl.org/DIST/BioPerl-1.6.1.tar.gz # get the tarball
tar -zxvf BioPerl-1.6.1.tar.gz # extract
cd BioPerl-1.6.1
perl Build.PL
./Build test
./Build install
## Test bioperl installation (you should get a version number)
@stephenturner
stephenturner / install-bioperl-1.sh
Last active December 25, 2015 15:29
Installing bioperl without root
## Install local::lib with boostrapping technique
wget http://search.cpan.org/CPAN/authors/id/E/ET/ETHER/local-lib-1.008018.tar.gz #download the tarball
tar -zxvf local-lib-1.008018.tar.gz # unpack
cd local-lib-1.008018
mkdir -p ~/perl5 # default installation path
perl Makefile.PL --bootstrap
make test && make install
# Make the utility script executable (do this once)
chmod +x ~/bin/ngs/gatk/gatk
# Put the GATK directory in your path (add to .bashrc)
export PATH=$HOME/bin/ngs/gatk/:$PATH
# The "old way" to invoke GATK's help:
java -Xmx100m -jar ~/bin/ngs/gatk/GenomeAnalysisTK.jar -h
# The easy way:
@stephenturner
stephenturner / jarlauncher.sh
Created August 12, 2013 15:34
Utility shell script to launch bare jar file. Put in directory with the jar file of interest, and make executable. This example runs GATK.
#!/bin/bash
PREFIX=$(dirname $0)
java -Xmx500m -jar $PREFIX/GenomeAnalysisTK.jar $*

Using ```r

# This is a comment
a <- 1:3
b <- c("a", "b", "c")
data.frame(a, b)

Using ```{r}

@stephenturner
stephenturner / .Rprofile.r
Last active January 3, 2025 12:36
My .Rprofile
## See http://gettinggeneticsdone.blogspot.com/2013/06/customize-rprofile.html
## Load packages
library(BiocInstaller)
## Don't show those silly significanct stars
options(show.signif.stars=FALSE)
## Do you want to automatically convert strings to factor variables in a data.frame?
## WARNING!!! This makes your code less portable/reproducible.
#!/bin/sh
## twitterchive.sh
## Stephen Turner (stephenturner.us)
##
## Script uses the t command line client (https://github.com/sferik/t)
## to search twitter for keywords stored in the arr variable below.
##
## Must first install the t gem and authenticate with OAuth.
##
## Most of this code was adapted near-verbatim from Neil's post about ISMB 2012.
## http://nsaunders.wordpress.com/2012/08/16/twitter-coverage-of-the-ismb-2012-meeting-some-statistics/
## Modify this. This is where I keep this repo.
repoDir <- ("~/code/twitterchive/")
## Go to the analysis directory
setwd(paste(repoDir, "analysis", sep=""))
## Function needs better documentation