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
# Modified from https://forum.qiime2.org/t/exporting-otu-table-from-phyloseq-into-either-biom-or-text-format/19103/6 | |
# to be directly exportable to a BIOM file using the official 'biom' command-line tool. The file-format requirements for | |
# a text table to be converted are listed here: | |
# https://forum.qiime2.org/t/csv-to-a-qiime2-readable-format/2284/7 | |
# This version concatenates the taxonomy ranks into a single string that is added to the OTU table as a 'taxonomy' column. | |
# The resulting TSV table can be converted to a BIOM-format file with the following command (outside of R): | |
# #biom convert -i otu_table_biom.tsv -o otu_table.biom --to-hdf5 --header-key taxonomy | |
library(phyloseq) | |
library(readr) | |
library(tidyr) |
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
class Fastspar < Formula | |
desc " Rapid and scalable correlation estimation for compositional data" | |
homepage "https://github.com/scwatts/fastspar" | |
url "https://github.com/scwatts/fastspar/archive/v0.0.5.tar.gz" | |
sha256 "c4cc7682720f566da7587e555b58a688671a97235d00c33d042a7f2cd6cef20a" | |
head "https://github.com/scwatts/fastspar.git" | |
depends_on "armadillo" => :run | |
depends_on "gsl" => :run | |
depends_on "gnu-getopt" => :run |
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
# NOTE: This was done on RHEL 7.3 with JAGS v4.3.0 and rjags v4-6. It should be fairly portable, but YMMV. | |
# Step 1: create an MKL environment variable for use in the --with-blas option for the JAGS configure script | |
# the below was taken from Martyn Plummer's "Building a portable R binary with Intel tools" | |
# https://martynplummer.files.wordpress.com/2014/10/r-intel-fedora.pdf | |
# I set MKL_LIB_PATH by looking at MKL_LIBS | |
export MKL="-Wl,--start-group ${MKL_LIB_PATH}/libmkl_gf_lp64.a \ | |
> ${MKL_LIB_PATH}/libmkl_gnu_thread.a \ | |
> ${MKL_LIB_PATH}/libmkl_core.a \ |
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
# Original discussion | |
# https://stackoverflow.com/questions/952914/making-a-flat-list-out-of-list-of-lists-in-python | |
# vanilla python list comprehension | |
flatten = lambda lst: [item for sublist in lst for item in sublist] | |
# with itertools | |
flatten_chain = lambda lst: list(itertools.chain(*lst)) | |
# with itertools >= 2.6 |
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
# based on the following: | |
# http://saintgimp.org/2013/01/22/merging-two-git-repositories-into-one-repository-without-losing-file-history/ | |
# http://blog.caplin.com/2013/09/18/merging-two-git-repositories/ | |
git clone repo_main | |
git clone repo_sub | |
cd repo_main | |
git remote add repo_sub ../repo_sub | |
git fetch repo_sub |
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
import json | |
import sys | |
def otu_name(biom_row): | |
""" | |
Determine a simple Genus-species identifier for an OTU, if possible. | |
If OTU is not identified to the species level, name it as Unclassified (familly/genus/etc...) | |
""" | |
tax = biom_row['metadata']['taxonomy'] | |
for i, lvl in enumerate(tax): |
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
➜ ~ brew install https://raw.github.com/iMichka/homebrew-science/8614633a8927be14b7e00d48a75acb66af3fc83e/insighttoolkit.rb --with-python | |
######################################################################## 100.0% | |
==> Installing dependencies for insighttoolkit: vtk | |
==> Installing insighttoolkit dependency: vtk | |
==> Downloading http://www.vtk.org/files/release/6.0/vtk-6.0.0.tar.gz | |
######################################################################## 100.0% | |
==> cmake -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/vtk/6.0.0 -DCMAKE_BUILD_TYPE=None -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_VERBOSE_MAKEFILE=ON -Wno-dev -DVTK_REQUIRED_OBJCXX_FLAGS='' -DVT | |
==> make | |
==> make install | |
==> Caveats |
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
from itertools import chain, izip | |
ileave = lambda *iters: list(chain(*izip(*iters))) | |
# full method with doctests | |
def interleave(*iters): | |
""" | |
Given two or more iterables, return a list containing | |
the elements of the input list interleaved. | |