Skip to content

Instantly share code, notes, and snippets.

View brantfaircloth's full-sized avatar

Brant Faircloth brantfaircloth

View GitHub Profile
@brantfaircloth
brantfaircloth / contig_cov.py
Created May 9, 2024 20:04
Contig coverage from PB.cov
#!/usr/bin/env python
# encoding: utf-8
"""
Created by Brant Faircloth on May 9, 2024 at 14:00:38 CDT
Copyright (c) 2024 Brant C. Faircloth. All rights reserved.
Description:
"""
@brantfaircloth
brantfaircloth / bed_from_genbank.py
Created March 29, 2011 23:41
BED file from Genbank (*.gb) file
#!/usr/bin/env python
# encoding: utf-8
"""
bed_from_genbank.py
grab the gene records from a genbank file (edit for other record types).
- requires: biopython
"""
@brantfaircloth
brantfaircloth / gist:895282
Created March 30, 2011 20:55
Substitution models in mrbayes

##GTR lset applyto=() nst=6 # GTR lset applyto=() nst=6 rates=propinv # GTR + I lset applyto=() nst=6 rates=gamma # GTR + gamma lset applyto=() nst=6 rates=invgamma # GTR + I + gamma

##SYM

lset applyto=() nst=6                           # SYM

prset applyto=() statefreqpr=fixed(equal)

@brantfaircloth
brantfaircloth / bulk_sequence_rename.py
Created August 24, 2013 21:08
Bulk sequence renaming with BioPython
from Bio import SeqIO
# create a dict to hold our new GI:names mapping, which looks like so, in
# this case (from sheep)
#
# gi|289623201|gb|CM000885.1| 299839927 chr1
# gi|289623190|gb|CM000894.1| 94216033 chr10
# gi|289623189|gb|CM000895.1| 67137890 chr11
# gi|289623188|gb|CM000896.1| 86457535 chr12
data = {}
@brantfaircloth
brantfaircloth / mult_prod_single_consume.py
Created October 1, 2011 07:06
Python multiprocessing: multiple producers, single consumer
import time
import random
from multiprocessing import Process, Queue, JoinableQueue, cpu_count
""" Adjust time.sleep() values to see action of consumer """
def work(id, jobs, result):
while True:
task = jobs.get()
if task is None:
@brantfaircloth
brantfaircloth / convert-bcl-to-fastq.rst
Created July 16, 2012 23:44
Convert BCL files to fastq

Install dependencies and Casava

The following assumes you are converting BCL files containing PE100 reads with a 10 nt index read. You can allow Casava to demultiplex for you or do it on your own, later. You can adjust values below if you are doing something different (e.g. shorter reads, longer indexes) but be careful.

  • You need a pretty beefy machine. Illumina recommends something with multiple cores and 48 GB RAM, running Centos 5. Centos 6 also works just fine. See their recommendations here:
@brantfaircloth
brantfaircloth / gist:253908
Created December 11, 2009 01:35
median and mode in mysql
@brantfaircloth
brantfaircloth / gist:944741
Created April 27, 2011 17:28
blat blast8 tabular format
text = Query id, Subject id, % identity, alignment length, mismatches, gap openings, q. start, q. end, s. start, s. end, e-value, bit score
csv = "Query id","Subject id","% identity","alignment length","mismatches","gap openings","q. start","q. end","s. start","s. end","e-value","bit score"
@brantfaircloth
brantfaircloth / sphinx_to_github.sh
Created January 23, 2011 02:40
Sphinx documentation to github gh-pages without submodules
# assume the following directory structure where contents of doc/
# and source/ are already checked into repo., with the exception
# of the _build directory (i,e. you can check in _themes or _sources
# or whatever else).
#
# proj/
# source/
# doc/
# remove doc/_build/html if present
@brantfaircloth
brantfaircloth / rnalater.md
Last active April 13, 2021 14:33
Homebrew RNALater

Disclaimer

Before using this for samples that are precious, you should thoroughly test the solution that you make. The best way to do that would be a side-by-side with commercial RNALater.

Source

The following recipe is from the patent. It always pays to read these.

In a beaker, combine 40 ml 0.5 M EDTA, 25 ml 1M Sodium Citrate, 700 gm Ammonium Sulfate