Skip to content

Instantly share code, notes, and snippets.

@jeetsukumaran
jeetsukumaran / vim-plugin-installer.sh
Created September 15, 2010 05:30 — forked from anonymous/vim-plugin-installer.sh
Script to install Vim plugin from its development source
#! /bin/bash
if [[ -z $1 ]]
then
if [[ -z $VIMRUNTIME ]]
then
VIMRUNTIME=$HOME/.vim
fi
else
VIMRUNTIME="$1"
@jeetsukumaran
jeetsukumaran / reduce_to_common_taxa_and_merge.py
Created May 24, 2011 01:48
Using DendroPy to Consolidate Multimarker Data to a Single Combined Dataset Consisting Only of Taxa with Full Representation
#! /usr/bin/env python
###############################################################################
##
## Copyright 2011 Jeet Sukumaran.
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 3 of the License, or
## (at your option) any later version.
@jeetsukumaran
jeetsukumaran / download_wobbegong_gb.py
Created May 24, 2011 01:52
Using DendroPy to Download GenBank Data
#! /usr/bin/env python
from dendropy.interop import ncbi
entrez = ncbi.Entrez(generate_labels=True,
label_num_desc_components=2,
label_separator='_',
exclude_gbnum_from_label=True,
sort_taxa_by_label=True)
@jeetsukumaran
jeetsukumaran / split_nexus_charsets.py
Created June 9, 2011 01:52
Using DendroPy to split a NEXUS character matrix into separate files based on 'charset' statements
#! /usr/bin/env python
import os
import sys
import dendropy
src_filepath = sys.argv[1]
full_data = dendropy.DnaCharacterMatrix.get_from_path(src_filepath, 'nexus')
items = full_data.character_subsets.items()
basename = os.path.splitext(os.path.basename(src_filepath))[0]
@jeetsukumaran
jeetsukumaran / git-makedist
Created July 7, 2011 21:17
BASH script to create distributable archives of a Git repository
#! /bin/bash
compose_name() {
if [[ $(which git 2> /dev/null) ]]
then
STATUS=$(git status 2>/dev/null)
if [[ -z $STATUS ]]
then
return
fi
@jeetsukumaran
jeetsukumaran / create-sate-src-dist.sh
Created July 7, 2011 21:32
Create a SATe Source Distribution Bundle
#! /bin/bash
if [[ -z $1 ]]
then
echo "require version number (e.g. "2.2.4") as argument"
exit
fi
VERSION="$1"
NOW=$(date +"%Y%b%d")
SRC="satesrc-v$VERSION-$NOW"
@jeetsukumaran
jeetsukumaran / vim-conf-makedist.sh
Created July 10, 2011 06:09
Create an Archive of Your Vim Configuration/Setup for Deployment on Other Machines
#! /bin/bash
function usage {
echo "`basename $0` [OPTIONS] [OUTPUT-PREFIX]"
echo "Archives Vim installation."
echo " "
echo "Options:"
echo " --windows ... build distributable for MS Windows system"
echo " -h|--help ... show help"
exit 1
@jeetsukumaran
jeetsukumaran / rijndael.py
Created October 17, 2011 02:54
Pure-Python implementation of Rijndael (AES) cipher.
#############################################################################
# Original code ported from the Java reference code by Bram Cohen, April 2001,
# with the following statement:
#
# this code is public domain, unless someone makes
# an intellectual property claim against the reference
# code, in which case it can be made public domain by
# deleting all the comments and renaming all the variables
#
class Rijndael(object):
@jeetsukumaran
jeetsukumaran / extract-pdf-pages.py
Created March 24, 2012 23:28
PDF Page Extraction/Selection in Python Using PyPDF
#! /usr/bin/env python
###############################################################################
##
## Copyright 2012 Jeet Sukumaran.
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 3 of the License, or
## (at your option) any later version.
@jeetsukumaran
jeetsukumaran / fishers_exact_test.py
Created March 24, 2012 23:36
Pure-Python Implementation of Fisher's Exact Test for a 2x2 Contingency Table
#! /usr/bin/env python
##############################################################################
# Following functions have been taken from the DendroPy library from:
##
## DendroPy Phylogenetic Computing Library.
##
## Copyright 2010 Jeet Sukumaran and Mark T. Holder.
## All rights reserved.
##