Skip to content

Instantly share code, notes, and snippets.

import pandas as pd
from numpy.random import randint
from numpy import median, percentile
my_data = pd.read_csv('dataset.csv')
n = len(my_data)
num_bootstrap_samples = 1000
bootstrap_results = []
for b in xrange(num_bootstrap_samples):
@alyssafrazee
alyssafrazee / tutorials.md
Created December 9, 2014 02:57
tutorial stuff: ballgown & polyester

Using Ballgown and Polyester

Ballgown

Reading data

  • ballgown creates a ballgown object from tablemaker output
  • ballgownrsem creates a ballgown object from RSEM output. (not yet well-tested).
  • gffRead and gffReadGR read GTF (annotation) files into R
    • gffRead gives you a data frame
  • gffReadGR gives you a GRanges object
@alyssafrazee
alyssafrazee / geuvadis_analysis.R
Created October 21, 2014 04:08
PCA for GEUVADIS data
## simple analysis code for GEUVADIS data
## AF Oct 2014
library(ballgown) #biocLite
library(RSkittleBrewer) #install_github
library(RColorBrewer) #CRAN
library(usefulstuff) #install_github
library(RCurl) #CRAN
load('fpkm.rda') # download at http://files.figshare.com/1625419/fpkm.rda
@alyssafrazee
alyssafrazee / project_ideas.md
Created October 4, 2014 03:51
in case you ever run out of stuff to do in your free time...
@alyssafrazee
alyssafrazee / github.md
Created August 20, 2014 20:59
intro to github

starting a new project

  1. Make a repository on GitHub. Check the box that says "initialize this repo with a README."
  2. Clone that repository on to your computer. That's git clone + the ssh URL you can find on the right-hand side of the repository. Go to the directory where you want the repository_name folder to live.
  3. Run a git status as a sanity check. (Everything should be clean).
  4. Write some code!
  5. Run a git status again. See that your code now lives in your repository, but hasn't yet been added to version control. (the file names should be red in your terminal)
  6. "Add" (git add) the code to version control.
  7. Run another git status. The file names should now be green, meaning they've been added to the version control staging area, but not committed to your repository's history.
  8. Commit your changes with git commit -m 'message_here').
@alyssafrazee
alyssafrazee / geuvadis_ballgown.R
Created August 8, 2014 19:49
code to create publicly-available Ballgown objects from GEUVADIS data
## create ballgown objects with GEUVADIS data
source("http://bioconductor.org/biocLite.R")
biocLite('ballgown')
library(ballgown)
system('mkdir -p Ballgown/small_objects')
## make phenotype table:
dataDir = 'Ballgown/' #tablemaker output lives here
sampnames = list.files(dataDir, pattern = 'H|N')
@alyssafrazee
alyssafrazee / bioc.md
Last active August 29, 2015 14:04
notes from BioC 2014

notes from BioC 2014

packages and the git-svn bridge

instructions on website I didn't get my invite to get an SVN account - mystery.

  • add bioc-sync as a collaborator on your git repo
  • then, webhooks & services --> add webhook. (there's a URL for this on the bioc instruction page.)
  • git-svn bridge doesn't really do merging very well: it's "winner-take all." you have to pick whether git or svn wins on merge conflicts.
  • only deals with master branch of git repo
@alyssafrazee
alyssafrazee / food.md
Last active January 19, 2017 05:51
an ever-changing list of places I've been to and enjoyed

San Francisco

breakfast

  • Plow
  • Mission Beach Cafe
  • Griddle Fresh
  • Toast

coffee

  • Reveille
  • Philz
@alyssafrazee
alyssafrazee / power.R
Created July 7, 2014 03:29
quick binomial power calculations (simulated)
# power calculation examples
get_power = function(truep, p0, n, alpha=0.05) {
num_rejections = 0
for(i in 1:10000){
dat = rbinom(n, size=1, prob=truep)
pv = 2*(1-pbinom(sum(dat), size=n, prob=p0))
if(pv < alpha) num_rejections = num_rejections + 1
}
return(num_rejections / 10000)
@alyssafrazee
alyssafrazee / datasets.md
Last active August 29, 2015 14:03
some sites with cool data

interesting datasets on the internet