Skip to content

Instantly share code, notes, and snippets.

View grabear's full-sized avatar
👨‍🔬
Working hard!

Rob Gilmore grabear

👨‍🔬
Working hard!
View GitHub Profile
@sdhutchins
sdhutchins / mygene_example.py
Last active January 26, 2017 19:34
MyGeneExample - Gene list to DataFrame to CSV file
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 13 18:18:52 2017
@author: sdhutchins
"""
#------------------------------------------------------------------------------
# Modules Used
#------------------------------------------------------------------------------
@walterst
walterst / create_consensus_taxonomy.py
Created July 8, 2015 18:41
See help text below about usage. Script was created to create consensus taxonomy strings for all sequence taxa strings in the Silva 119 release.
#!/usr/bin/env python
# USAGE
# python create_consensus_taxonomy.py X Y Z A
# where X is the taxonomy mapping file for all NR seqs, Y is the representative
# file (i.e. one of the rep_set/ files with the 119 release), Z is the OTU
# mapping file created from running pick_otus.py, and A is the output
# consensus mapping file
from sys import argv
@walterst
walterst / create_majority_taxonomy.py
Created July 8, 2015 18:43
See help text below about usage. Script was created to create 90% majority taxonomy strings for all sequence taxa strings in the Silva 119 release.
#!/usr/bin/env python
# USAGE
# python create_majority_taxonomy.py X Y Z A
# where X is the taxonomy mapping file for all NR seqs, Y is the representative
# file (i.e. one of the rep_set/ files with the 119 release), Z is the OTU
# mapping file created from running pick_otus.py, and A is the output
# consensus mapping file
from sys import argv
@grabear
grabear / Adventuring_Gear.csv
Last active June 26, 2019 18:27
LST file parser
Equipment_Name RANGE TYPE OUTPUTNAME WT CRITMULT Equipment_Name CONTAINS COST PROFICIENCY SORTKEY CRITRANGE DESC SPROP DAMAGE SIZE KEY SOURCEPAGE QUALITY
Backpack Goods.Container.General.Resizable 2 Backpack UNLIM|Any 2 Backpack Backpack p.158
Barrel Goods.Container.General 30 Barrel UNLIM|Any 2 Barrel Barrel p.158
Basket Goods.Container.General 1 Basket UNLIM|Any 0.4 Basket Basket p.158
Bedroll Goods.General.Resizable 5 Bedroll 0.1 Bedroll Bedroll p.158
Bell Goods.General 0 Bell 1 Bell Bell p.158
Blanket, Winter Goods.General.Resizable Winter Blanket 3 Blanket, Winter 0.5 Blanket, Winter Blanket (Winter) p.158
Block and Tackle Goods.General 5 Block and Tackle 5 Block and Tackle Block and Tackle p.158
Bottle Goods.Container.General 1 Bottle 1.5|Liquid=3 2 Bottle Bottle (Glass) p.158
Bucket Goods.Container.General 2 Bucket UNLIM|Any 0.5 Bucket Bucket p.158
@demisx
demisx / syntax.css
Last active February 20, 2020 04:32
Syntax highlighter CSS file
.highlight { background: #ffffff; }
.highlight .c { color: #999988; font-style: italic } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { font-weight: bold } /* Keyword */
.highlight .o { font-weight: bold } /* Operator */
.highlight .cm { color: #999988; font-style: italic } /* Comment.Multiline */
.highlight .cp { color: #999999; font-weight: bold } /* Comment.Preproc */
.highlight .c1 { color: #999988; font-style: italic } /* Comment.Single */
.highlight .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
@grabear
grabear / SILVA_walkthrough.R
Last active September 18, 2020 13:01
Parsing .biom files with SILVA formatted annotations using phyloseq
# This functionality has been tested and a PR has been pulled with phyloseq here:
# https://github.com/joey711/phyloseq/pull/854
#
# While the function has been vetted, the maintainers are very busy and the PR has not
# yet been added to the main package. Below i've added some detail to explain how to parse
# your silva data. It's quite easy....
source("parse_silva_taxonomy_128")
@multidis
multidis / list_as_fun_args.r
Created December 16, 2013 22:21
Passing lists as function arguments in R. Frequently helps reduce code repetition (e.g. if/else calls of different functions with mostly the same arguments). NOTE: always consider a closure function as FP alternative to this method of dealing with repetitive code elements.
## regular case
foo <- function(a, b, c) a + b - c ## does something
foo2 <- function(b, c) b + c ## also some function
foo(a=1, b=2, c=5)
foo2(b=2, c=5) ## repeating list of multiple arguments
## passing a list
arg.list <- list(b=2, c=5)
do.call(foo, c(list(a=1), arg.list))
do.call(foo2, arg.list)
@jhcepas
jhcepas / Newick2JSON.py
Last active May 6, 2022 19:37
Converts a newick file into JSON format for d3/TreeWidget javascript component
import sys
from ete2 import Tree
import random
def get_json(node):
# Read ETE tag for duplication or speciation events
if not hasattr(node, 'evoltype'):
dup = random.sample(['N','Y'], 1)[0]
elif node.evoltype == "S":
dup = "N"
@Liam0205
Liam0205 / install_vim.sh
Created November 2, 2018 03:17
Compile and install VIM on CentOS 6.x without root.
#!/bin/bash
git clone https://github.com/vim/vim.git --depth=1
cd vim
make -p $HOME/local/bin
./configure --prefix=$HOME/local/vim --enable-multibyte --with-tlib=tinfo --enable-pythoninterp --enable-rubyinterp --with-ruby-command=/usr/bin/ruby --with-features=huge
make -j24
make install
cd $HOME/local/bin
for file in $(ls $HOME/local/vim/bin); do ln -sf $HOME/local/vim/bin/$file $file; done
@hugorodgerbrown
hugorodgerbrown / md_to_rst.sh
Last active March 26, 2023 16:57
Shell script for converting a batch of *.md files into *.rst using pandoc.
# This script was created to convert a directory full
# of markdown files into rst equivalents. It uses
# pandoc to do the conversion.
#
# 1. Install pandoc from http://johnmacfarlane.net/pandoc/
# 2. Copy this script into the directory containing the .md files
# 3. Ensure that the script has execute permissions
# 4. Run the script
#
# By default this will keep the original .md file