This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def grouperchunker(seq, size): | |
return (seq[pos:pos + size] for pos in xrange(0, len(seq), size)) | |
for group in grouper(animals, 3): | |
print group | |
from itertools import | |
def grouper(n, iterable, fillvalue=None): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://github.com/matplotlib/matplotlib/issues/881 | |
# Several of the ColorBrewer maps are "qualitative", meaning | |
# they are just a group of colors that can be used together | |
# for categories of data. So I remapped Accent to segments | |
# instead of continuous: | |
# Actually, these should be used with ListedColormap, and | |
# the number of colors should depend on the number of | |
# categories in the data, with colors removed from the | |
# list in a certain order? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Dereplication | |
usearch --sort reads.fa --output reads.sorted.fa | |
usearch --derep_fullseq --cluster reads.sorted.fa --seedsout unique.fa [--uc results.uc] [--sizeoout] [--minsize n] [--slots n] [--w wordlength] | |
usearch --derep_fullseq --cluster reads.sorted.fa --seedsout unique.fa --uc results.uc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://timotheepoisot.fr/2013/02/17/stacked-barcharts/ | |
library(RColorBrewer) | |
Abund = round(matrix(runif(200,0,1),nc=10),2) | |
Abund = Abund/max(Abund) | |
rownames(Abund) = LETTERS[c(1:nrow(Abund))] | |
colnames(Abund) = letters[c(1:ncol(Abund))] | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# infile is 'rename_mapping.txt' tab-sep: oldname newname | |
# ext of file to be replace can be specified | |
with open('rename_mapping.txt', 'r') as fh: | |
map = { line.strip().split()[0]:line.strip().split()[1] for line in fh.readlines() } | |
oldnames = !ls *.fastq.gz | |
for oldname in oldnames: | |
if oldname in map: | |
newname = map[oldname] | |
!mv $oldname $newname |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source('prep_data.R') | |
library(vegan) | |
library(RColorBrewer) | |
# select env/process data | |
meta <- data[ , 1:( which( names(data) == "amplib_id" )) ] | |
env <- data[ , ( which( names(data) == "primary_sed" )):( which( names(data) == "otu_0" ) - 1) ] | |
otu <- as.matrix(data[, (which(names(data) == "otu_0" )):ncol(data) ]) | |
summary(env) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### MATPLOTLIBRC FORMAT | |
# This is a sample matplotlib configuration file - you can find a copy | |
# of it on your system in | |
# site-packages/matplotlib/mpl-data/matplotlibrc. If you edit it | |
# there, please note that it will be overridden in your next install. | |
# If you want to keep a permanent local copy that will not be | |
# over-written, place it in HOME/.matplotlib/matplotlibrc (unix/linux | |
# like systems) and C:\Documents and Settings\yourname\.matplotlib | |
# (win32 systems). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ggplot2 implements the idea of a "grammar of graphics". The grammar implemented | |
# by ggplot2 could be summarized as follows: | |
# | |
# plot: coord, scale, facet(?) + layers | |
# layer: data mapping stat geom position? | |
# | |
# A plot is defined by a coordinate system (coord), one or more scales (scale), an | |
# optional faceting specification (facet), and one or more layers (layer). A layer | |
# is defined as an R data frame (data), a specification mapping columns of that | |
# frame into aesthetic properties (mapping), a statistical approach to summarize |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1:10 | |
c(1, 2, 3, 4) | |
seq(1, 10, 1) | |
seq(from=1, to=10, by=1) | |
sequence(c(10, 5)) | |
seq(along.with=myData) # makes seq of 1:length(myData)) | |
seq(10, along.with=myData) # makes seq of 10:length(myData)) | |
seq(from=2, length.out=10) | |
rep(x, times = 1, length.out = NA, each = 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git init | |
# Print & Set Some Basic Config Variables (Global) | |
$ git config --global user.email | |
$ git config --global user.name | |
$ git config --global user.email "[email protected]" | |
$ git config --global user.name "My Name" |
OlderNewer