Skip to content

Instantly share code, notes, and snippets.

View crosenth's full-sized avatar

Chris Rosenthal crosenth

View GitHub Profile
@crosenth
crosenth / lineages.py
Last active September 9, 2017 00:18
Building ncbi lineages
#!/usr/bin/env python3
'''
Generates full lineages for taxons in an ncbi nodes.dmp file
and optionally expands "no rank" ranks.
'''
import argparse
import sys
def get_args():
@crosenth
crosenth / hgrep
Last active June 28, 2017 22:12
header grep - Always print the first line of a file before grep
#!/usr/bin/env bash
csvfile=${@: -1}
head --lines 1 $csvfile && grep "$@"
@crosenth
crosenth / contributors
Last active September 20, 2016 21:23
contributors
contributors = env.Command(
source='.git/logs/HEAD',
target='contributors.txt',
action=('git log --all --format="%cN <%cE>" | sort | uniq > $TARGET'))
@crosenth
crosenth / pyscript
Last active January 23, 2020 18:39
#!/usr/bin/env python3
import argparse
import sys
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument('arg1')
parser.add_argument('--option1')
@crosenth
crosenth / sconstruct
Last active December 10, 2015 20:18
SConstruct template
"""
Short description here
"""
import os
from bioscons.fileutils import Targets
from bioscons.slurm import SlurmEnvironment
from SCons.Script import ARGUMENTS, Variables, Decider
@crosenth
crosenth / subcommand
Created January 8, 2013 19:14
Ungapatchka subcommand template
"""
Short description here
"""
import sys
from ungapatchka.utils import Opener
def build_parser(parser):
parser.add_argument('in',