Skip to content

Instantly share code, notes, and snippets.

View aaronsaunders's full-sized avatar

Aaron Marc Saunders aaronsaunders

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# UPARSE analysis pipeline form amplicon sequences\n",
"\n",
"We will follow the Illumina paired end tutorial.\n",
"\n",
@aaronsaunders
aaronsaunders / .gitignore
Last active August 29, 2015 14:01 — forked from octocat/.gitignore
My .gitignore template
# emacs backups
*~
\#*#
# data files
*.log
*.tsv
*.dat
# image files
@aaronsaunders
aaronsaunders / nix-cheat.sh
Last active January 25, 2021 06:54
Quick reference for nix command line commands that I can never remember...
# Unix shell
# run if zero exit
cd tmp/a/b/c && tar xvf ~/archive.tar # untar if dir exists
# run if non-zero exit
cd tmp/a/b/c || mkdir -p tmp/a/b/c
cd tmp/a/b/c || mkdir -p tmp/a/b/c && tar xvf -C tmp/a/b/c ~/archive.tar
which
whereis
@aaronsaunders
aaronsaunders / qiime_demo.ipynb
Last active December 26, 2015 21:09
An example analysis of 16S rRNA amplicons using QIIME.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aaronsaunders
aaronsaunders / biofileformat.py
Created October 27, 2013 20:25
file parsing and length plotting
"""
Mappings from file extensions to biopython types.
Copied from Erik Matsens seqmagick https://github.com/fhcrc/seqmagick/
"""
import argparse
import contextlib
import copy
import functools
@aaronsaunders
aaronsaunders / .Rprofile
Last active December 26, 2015 13:49
Dotfiles
# from https://gist.github.com/stephenturner/5700920
# http://inundata.org/2011/09/29/customizing-your-rprofile/
## Returns names(df) in single column, numbered matrix format.
.env$n <- function(df) matrix(names(df))
# Shorten S3 methods so s(obj) instead of summary(obj)
s <- base::summary;
h <- utils::head;
n <- base::names;
@aaronsaunders
aaronsaunders / 0_reuse_code.js
Created October 23, 2013 10:44
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
#!/usr/bin/env python
import fileinput
import sys
from argparse import ArgumentParser
# https://docs.python.org/dev/library/argparse.html
parser = argparse.ArgumentParser(description = """docstring here""")
parser.add_argument('-i','--input',
@aaronsaunders
aaronsaunders / random-sample-list.py
Created October 1, 2013 08:41
Get random sample from list while maintaining ordering of items? I have a sorted list, let say: (its not really just numbers, its a list of objects that are sorted with a complicated time consuming algorithm) mylist = [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 ,9 , 10 ] Is there some python function that will give me N of the items, but will keep the order…
# Following code will generate a random sample of size 4.
rand_smpl = [ mylist[i] for i in sorted(random.sample(xrange(len(mylist)), 4)) ]