Reading this [@Wang:2010fh], in particular Supp. report 4. Has to do with bootstrapping population estimates using the different enzymes used to find
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
tell application "Papers" | |
set outFile to "path_to_notebook_folder/library.bib" | |
export ((every publication item) as list) to outFile | |
end tell |
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
# -*- coding: utf-8 -*- | |
""" | |
Uses a context manager to provide a dictionary as a 'namespace' of sorts, | |
allowing you to use dot notation to work with the dictionary. Example: | |
d = {'a': 5, 'b': 10} | |
with named(d) as n: | |
# prints 5 | |
print n.a | |
# reassignment changes both n and d |
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
>denovo1793 | |
GGAGTCTGGGCCGTGTCTCAGTCCCAGTGTGGCCGATCACCCTCTCAGGTCGGCTATGTATCGTCGCCTTGGTGAGCCGTTACCCCACCAACTAGCTAATACAACGCAGGTCCATCTGGTAGTGATGCAATTGCACCTTTTAATTGACTATCATGCAATAGTCAATATTATGCGGTATTAGCTATCGTTTCCAATAGTTATCCCCCGCTACCAGGCAGGTTACCTACGCGTTACTCACCCGTTCGCAACTCATCCAGAGAAGCAAGCTCCTCCTTCAGCGTTCTACTTGCATGTATTAGGCACGCCGCCAGCGTTCGTC | |
>denovo2518 | |
GGAGTTTGGGCCGTGTCTCAGTCCCAATGTGGCCGATCACCCTCTCAGGTCGGCTATGCATCACGGCCTTGGTGAGCCGTTACCTCACCAACTAGCTAATGCACCGCGGGTCCATCCATCAGCAGAAGCTTGCGCCTCTTTTCCTCTTCAAACCATGCGGTTCGAAGACCTATGCGGTTTTAGCATCCGTTTCCGAATGTTATCCCCCTCTGATGGGCAGGTTACCCACGTGTTACTCACCCGTTCGCCACTAGATTGACCAGTGCAAGCACCGGTCGCTCTCGTTCGACTTGCATGTATTAGGCACGCCGCCAGCGTTCGTC | |
>denovo271 | |
GGAGTCTGGGCCGTGTCTCAGTCCCAGTGTGGCCGATCACCCTCTCAGGTCGGCTATGTATCGTCGCCTTGGTGAGCCGTTACCCCACCAACTAGCTAATACAACGCAGGTCCATCTGGTAGTGATGCAATTGCACCTTTTAAGCAAATGTCATGCAACATTTACTGTTATGCGGTATTAGCTATCGTTTCCAATAGTTATCCCCCGNTACCAGGCAGGTTACCTACGCGTTACTCACCCGTTCGCAACTCGTCCAGAAGAGCAAGCTCTCCCTTCAGCGTTCTACTTGCATGTATTAGGCACGCCGCCAGCGTTCGTC | |
>denovo3052 | |
GGAGTCTGGTCCG |
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
alpha_diversity <- function(df, group.col, freq.col) { | |
# Returns a variety of diversity indices, including the Gini-Simpson index, | |
# the inverse Simpson index, and the Shannon-Weaver index. The SW index is | |
# calculated using the natural logarithm. | |
# | |
# Arguments: | |
# df: a data frame where the rows are species, with a column containing the | |
# grouping variable and another column containing the proportional | |
# abundances of each species | |
# group: the name of the column defining the grouping variable |
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
# Indicator value functions ----------------------------------------------- | |
#' Returns the indicator value (Dufrene, 1997) for a given row of species counts | |
#' along with a vector of class assignments. | |
#' @param row: vector of counts (usually a row in a counts matrix) | |
#' @param class: which level in the grouping variable to test | |
#' @param classes: factor describing the grouping of the counts vector | |
.indval <- function(row, class, classes) { | |
idxs <- classes == class | |
A.ij <- sum(row[idxs]) / sum(row) |
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
docs: | |
Rscript -e "devtools::document(roclets=c('rd', 'collate', 'namespace', 'vignette'))" | |
gh-pages: | |
git checkout gh-pages | |
git merge master -X theirs -m "merge master" | |
site:docs gh-pages | |
Rscript -e "staticdocs::build_site(site_path='.', launch=FALSE)" | |
git commit -am 'updated docs' |
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
# Using indicspecies with a melted data frame | |
# Their input is actually not hard to work with. First we need to re-create the count matrix. | |
# This creates a data frame with the sample ID and study group as the first two columns, then each column after that is an OTU name | |
# (Replace column names as appropriate) | |
mat <- melted.df %>% reshape2::dcast(SampleID + StudyGroup ~ otu) | |
# Next, we actually convert things into inputs | |
# Hadley's stuff hates rownames, so we have to remake them | |
rownames(mat) = mat$SampleID |
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
# This is the testing function that builds the models | |
testMixedEffects <- function(test.col) { | |
# We return this default in case of error/no fit | |
default <- list(null.model=NA, model=NA) | |
counts <- .mat[, colnames(.mat)==test.col] | |
if (sum(counts > 0)/length(counts) < sparsity) { | |
message(sprintf("%s: too sparse, skipping", test.col)) | |
return(default) | |
} |