Skip to content

Instantly share code, notes, and snippets.

View ngcrawford's full-sized avatar

Nick Crawford ngcrawford

View GitHub Profile
@ngcrawford
ngcrawford / topology_test.py
Created October 6, 2011 15:51
Dendropy Tree/Subtree test
def topology_test(tree, query_tree, symmetric_distance=False):
"""Given a tree and a query tree this function tests if the query tree is present or identical to the
tree. If 'symmetric_distance' is set to True the symmetric distance of the query tree to the relavent taxa in the
tree is returned.
Both trees should be tree objects and contain idential taxon labels.
Examples:
--------
@ngcrawford
ngcrawford / interleave_fastq.py
Last active March 8, 2021 19:15
Interleave paired end fastq files
#!/usr/bin/env python
# encoding: utf-8
import sys
import argparse
def interface():
parser = argparse.ArgumentParser()
parser.add_argument('--rm-short-reads',
@ngcrawford
ngcrawford / multiprocessing_template.py
Created March 29, 2012 12:49
Template for multiprocessing large files line by line
#!/usr/bin/env python
# encoding: utf-8
import multiprocessing
from textwrap import dedent
from itertools import izip_longest
def process_chunk(d):
"""Replace this with your own function
that processes data one line at a
@ngcrawford
ngcrawford / addReadGroup2BAMs.py
Created April 17, 2012 16:29
Script to add a @rg tags to SAM or BAM alignments
import os
import sys
import glob
import pysam
import argparse
import multiprocessing
def get_args():
'''Parse sys.argv'''
parser = argparse.ArgumentParser()
@ngcrawford
ngcrawford / removeFaFromFasta.py
Last active October 7, 2015 19:57
Script to filter contigs/chrms from fasta file
#!/usr/bin/env python
# encoding: utf-8
"""
removeFaFromFasta.py
Created by Nick Crawford on 2012-31-07.
The author may be contacted at ngcrawford@gmail.com
@ngcrawford
ngcrawford / PyMC_Tutorial_Example.ipynb
Last active December 10, 2015 09:29
Simple iPython notebook conversion of the PyMC introductory tutorial: http://pymc-devs.github.com/pymc/tutorial.html
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ngcrawford
ngcrawford / parallelize_jobs.py
Last active December 10, 2015 17:58
Quickie script to parallelize_jobs across cores on one processor using python's multiprocessing module. Essentially it's a poor man's version of GNU parallel.
import os
import sys
import shlex
import argparse
import multiprocessing
from subprocess import Popen, PIPE
def get_args():
"""Processes arguements"""
parser = argparse.ArgumentParser()
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ngcrawford
ngcrawford / INSTRUCTIONS.md
Last active December 20, 2015 04:58
Python script for running multiple bowtie2 jobs with a variety of input fastq and read groups.
  1. Modify the sample_info.txt appropriately. I'd recommend doing this in excel and exporting the sheet as a CSV file. The first lane is a header and cannot be changed.
  2. Run the bowtie2 commands with python run_bowtie2.py
require 'formula'
class Openblas64Julia < Formula
homepage 'http://xianyi.github.com/OpenBLAS/'
# Maintainers, remember to update the LAPACK url in OpenblasLapack above.
# See the "LAPACK_URL" in the openblas Makefile for the right version.
url 'http://github.com/xianyi/OpenBLAS/zipball/v0.2.8'
sha1 'c62ab98dae8ac6d49c367235033180ef72dd7bbd'
head "https://github.com/xianyi/OpenBLAS.git", :branch => "develop"