Skip to content

Instantly share code, notes, and snippets.

View boboppie's full-sized avatar

Fengyuan Hu boboppie

  • AstraZeneca
  • Cambridge, UK
View GitHub Profile
@boboppie
boboppie / bayes_update.R
Created August 17, 2012 16:00 — forked from cjbayesian/bayes_update.R
generate a video demonstrating Bayesian updating
## Corey Chivers, 2012 ##
sim_bayes<-function(p=0.5,N=100,y_lim=20,a_a=2,a_b=10,b_a=8,b_b=3)
{
## Simulate outcomes in advance
outcomes<-sample(1:0,N,prob=c(p,1-p),replace=TRUE)
success<-cumsum(outcomes)
for(frame in 1:N)
{
png(paste("plots/",1000+frame,".png",sep=""))
@boboppie
boboppie / Makefile
Created August 30, 2012 19:43 — forked from lindenb/Makefile
NGS crash course
#http://samtools.sourceforge.net/mpileup.shtml
SAMDIR=/usr/local/package/samtools-0.1.18
SAMTOOLS=$(SAMDIR)/samtools
BCFTOOLS=$(SAMDIR)/bcftools/bcftools
BWA=/usr/local/package/bwa-0.6.1/bwa
REF=chr22.fa
.INTERMEDIATE : align.sam random_1.sai random_2.sai align.bam variations.bcf
@boboppie
boboppie / tax_search.R
Created September 18, 2012 06:11
Quick test of using genomes package in Bioconductor for taxonomy search
# genomes - Genome sequencing project metadata
# URL : http://www.bioconductor.org/packages/release/bioc/html/genomes.html
library(genomes)
ncbiTaxonomy("human", summary=TRUE)
#################################
# [1] "1 result found"
# taxid name rank division nucl prot struct genome gene
# 1 9606 Homo sapiens species primates 9936177 677498 20041 51 43470
@boboppie
boboppie / psqlfix.txt
Created November 26, 2012 14:16
Change postgres (9.1.6) default template1 to SQL_ASCII encoding
fh293@newt:~$ sudo -u postgres psql
psql (9.1.6)
Type "help" for help.
postgres=# update pg_database set datallowconn = TRUE where datname = 'template0';
UPDATE 1
postgres=# \c template0
You are now connected to database "template0" as user "postgres".
template0=# update pg_database set datistemplate = FALSE where datname = 'template1';
UPDATE 1
# Generate a Monte Carlo sample using Sobol' low-discrepancy quasi-random sequences
# James Keirstead
# 3 February 2012
#
# Random sampling with R's standard methods is inefficient for Monte Carlo analysis as
# the sampled values do not cover the parameter space evenly. This Gist allows users
# to create parameter samples using Sobol' sequences to get around this problem.
# makeMCSample
# Makes a Monte Carlo sample using Sobol' sequences
We can make this file beautiful and searchable if this error is corrected: It looks like row 3 should actually have 41 columns, instead of 39. in line 2.
"","X","Lake.ID","Name","treatment","shorline","sizehectars","elevation","UTM.zone","northing","easting","BUBO.breeding","BUBO.breeding2","PSRE.breeding.Y.N","RACA.y.n","veg.extent","X..of.transects.with.veg","bank.slope","silt.0.1.","silt.total","X10cm.area","vegetated.area","RACA.1K","lakes.1k","dist.ave","ls","raca.basin","fish.basin","lakes.basin","co.lakes.basin","ls2","woody","herbacious","unveg","total","woodyprop","herbprop","unvegprop","logveg","archerb","arcsilt"
"1",1,531,"Mill Creek",0,377.96,0.713,2008.9368,10,518882,4565085,"y",1,"n","y",0.691,0.682,0.308095216,0.6818,0.71212,111.5,261.17,3,4,0.5538,0.75,3,0,3,0,1,6082255.229,54367.17182,1399749.194,7536371.595,0.807053521,0.007213972,0.185732508,2.41692328905509,0.0850375574910141,1.00445938904933
"2",2,533,"East Boulder",1,1356.4,11.4,2034.8448,10,518069,4564441,"y",1,"y","y",2.28,0.292,0.092475736,0.376,0.3472,980.56,3092.59,5,10,0.8268,0.5,4,4,8,2,0.5,5699686.549,1302747.189,1470012.242,8472445.979,0.67273212,0.15376282,0.173505059,3.4903223
## Simulate Grime Dice ##
red<-c(4,4,4,4,4,9)
blue<-c(2,2,2,7,7,7)
olive<-c(0,5,5,5,5,5)
yellow<-c(3,3,3,3,8,8)
magenta<-c(1,1,6,6,6,6)
## Play n match-ups between d1 and d2
#initialize
library(datasets)
library(ggplot2)
#helper function (convert vector to named list)
namel<-function (vec){
tmp<-as.list(vec)
names(tmp)<-as.character(unlist(vec))
tmp
}
[[PageOutline]]
The following items should be tested before each release. Be sure to vary the following:
* super | regular user
* logged in | out
* Firefox, IE 7/9, Chrome, Safari
* new | old user
= ACCOUNT =
#!/bin/bash
PREFIX=$(dirname $0)
java -Xmx500m -jar $PREFIX/GenomeAnalysisTK.jar $*