Skip to content

Instantly share code, notes, and snippets.

View brantfaircloth's full-sized avatar

Brant Faircloth brantfaircloth

View GitHub Profile
@brantfaircloth
brantfaircloth / newpost.rb
Created October 3, 2010 07:23 — forked from al3x/newpost.rb
start jekyll post from commandline and stage
#!/usr/bin/ruby
# Create new jekyll post and open in textmate
# $ ruby _new.rb This is the title
# The arguments form the title
unless ARGV[0]
raise "Please provide a post title."
end
@brantfaircloth
brantfaircloth / fasta_chunker.py
Created October 3, 2010 23:13
a chunking script for fasta-formatted files
# fasta_chunker.py is a take on the widefinder file-chunking script from
# http://effbot.org/zone/wide-finder.htm, adapted for use with fasta files,
# which present some unique parsing challenges of their own. for more info
# see http://b.atcg.us/blog/2010/10/03/chunking-a-fasta-file.html
def get_chunks(file, mb=1):
size = mb * (1024**2)
f = open(file)
while 1:
start = f.tell()
@brantfaircloth
brantfaircloth / gist:630205
Created October 16, 2010 19:48
installing mira on osx 10.6.x
  1. install xcode

    • probably best to get a free account at developer.apple.com and download the latest version of xcode, versus using version on DVD
  2. install homebrew - the package manager for osx http://github.com/mxcl/homebrew/wiki/installation

  3. install the boost libraries (at the time, this was 1.43.0) brew install boost

  4. install the google-perftools (at the time this was 1.5) brew install google-perftools

@brantfaircloth
brantfaircloth / makefile.diff
Created October 19, 2010 06:04
Make pslCDNAFilter.c compile on OS X
diff --git a/hg/pslCDnaFilter/makefile b/hg/pslCDnaFilter/makefile
index 0837f0c..db7380d 100644
--- a/hg/pslCDnaFilter/makefile
+++ b/hg/pslCDnaFilter/makefile
@@ -23,7 +23,7 @@ polyASizes.o: polyASizes.c polyASizes.h
# create msg from text
%.msg: %.txt
echo '/* GENERATED CODE, DO NOT EDIT */' > [email protected]
- ${STRINGIFY} $< >> [email protected]
+ cat $< >> [email protected]
@brantfaircloth
brantfaircloth / gist:634881
Created October 19, 2010 19:24
Why does Acrobat 9 run mysqld?
ps aux | grep mysql
bcf 21662 0.0 0.1 372396 5656 ?? Ss 12Oct10 0:09.07 /Applications/Adobe Acrobat 7.0 Professional/Adobe Acrobat 7.0 Professional.app/Contents/MacOS/mysqld --skip-networking --socket=/Users/bcf/Library/Caches/Acrobat/7.0/Organizer70 --skip-grant-tables --skip-innodb --myisam-recover --lower_case_table_names=1 --tmpdir=/Users/bcf/Library/Caches/Acrobat/7.0/ --datadir=/Users/bcf/Library/Acrobat User Data/7.0/ --language=/Applications/Adobe Acrobat 7.0 Professional/Adobe Acrobat 7.0 Professional.app/Contents/MacOS/
bcf 2834 0.0 0.1 363180 3280 ?? Ss 8Oct10 0:13.72 /Applications/Adobe Acrobat 7.0 Professional/Adobe Acrobat 7.0 Professional.app/Contents/MacOS/mysqld --skip-networking --socket=/Users/bcf/Library/Caches/Acrobat/7.0/Organizer70 --skip-grant-tables --skip-innodb --myisam-recover --lower_case_table_names=1 --tmpdir=/Users/bcf/Library/Caches/Acrobat/7.0/ --datadir=/Users/bcf/Library/Acrobat User Data/7.0/ --language=/Applications/Adobe Acrobat 7.
@brantfaircloth
brantfaircloth / run_colony2.py
Created October 20, 2010 21:34
Code to run Colony2 from the command-line, bypassing the somewhat flaky R function which seems to mangle paths a lot of the time and does not deal real well with spaces/periods/etc. in filenames.
#!/usr/bin/env python
# encoding: utf-8
"""
run_colony2.py
Created by Brant Faircloth on 20 October 2010 13:55 PDT (-0700).
Copyright (c) 2010 Brant C. Faircloth. All rights reserved.
PURPOSE: to replace the flaky R function for running Colony2 from within R
@brantfaircloth
brantfaircloth / gist:670033
Created November 9, 2010 23:22
Extending the Nextera indexing set

Dependencies

Methods

Note 1: that the index sequences provided in the Nextera kits are edit distance 2 from one another (meaning it takes 2 insertions, deletions, or substitutions to turn one sequence into another). This means that we can determine when there is an error in the index, but we cannot correct the error. We can only begin to correct the error when the edit distance is ≥ 3 [see below].

@brantfaircloth
brantfaircloth / gist:675539
Created November 13, 2010 18:48
Build universal re2 library on OSX
diff -r cb51df6be426 Makefile
--- a/Makefile Mon Oct 11 14:06:17 2010 -0400
+++ b/Makefile Sat Nov 13 10:47:50 2010 -0800
@@ -10,9 +10,9 @@
# LDPCRE=-L/usr/local/lib -lpcre
CC=g++
-CXXFLAGS=-Wall -O3 -g -pthread # can override
+CXXFLAGS=-Wall -O3 -g -pthread -arch i386 -arch x86_64 # can override
RE2_CXXFLAGS=-Wno-sign-compare -c -I. $(CCPCRE) # required
@brantfaircloth
brantfaircloth / chunk_fasta_file.py
Last active September 24, 2015 10:58
chunking a fasta file, part 2
#!/usr/bin/env python
# encoding: utf-8
'''
Created by Brant Faircloth on 11 December 2010 11:28 PST (-0800).
Copyright (c) 2010 Brant C. Faircloth. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@brantfaircloth
brantfaircloth / sw.py
Created December 12, 2010 22:20
Smith-Waterman DNA-DNA Alignment
#!/usr/bin/env python
# encoding: utf-8
"""
sw.py
Created by Brant Faircloth on 12 December 2010 01:34 PST (-0800).
Copyright (c) 2010 Brant C. Faircloth. All rights reserved.
Updated from earlier code (c) 2010 Forrest Bao <http://fsbao.net>