Skip to content

Instantly share code, notes, and snippets.

@chapmanb
Created June 24, 2010 19:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chapmanb/451826 to your computer and use it in GitHub Desktop.
Save chapmanb/451826 to your computer and use it in GitHub Desktop.
def _index_bfast(ref_file):
"""Indexes bfast in color and nucleotide space for longer reads.
This preps for 40+bp sized reads, which is bfast's strength.
"""
dir_name = "bfast"
window_size = 14
bfast_nt_masks = [
"1111111111111111111111",
"1111101110111010100101011011111",
"1011110101101001011000011010001111111",
"10111001101001100100111101010001011111",
"11111011011101111011111111",
"111111100101001000101111101110111",
"11110101110010100010101101010111111",
"111101101011011001100000101101001011101",
"1111011010001000110101100101100110100111",
"1111010010110110101110010110111011",
]
bfast_color_masks = [
"1111111111111111111111",
"111110100111110011111111111",
"10111111011001100011111000111111",
"1111111100101111000001100011111011",
"111111110001111110011111111",
"11111011010011000011000110011111111",
"1111111111110011101111111",
"111011000011111111001111011111",
"1110110001011010011100101111101111",
"111111001000110001011100110001100011111",
]
local_ref = os.path.split(ref_file)[-1]
if not exists(dir_name):
run("mkdir %s" % dir_name)
with cd(dir_name):
run("ln -s %s" % os.path.join(os.pardir, ref_file))
# nucleotide space
run("bfast fasta2brg -f %s -A 0" % local_ref)
for i, mask in enumerate(bfast_nt_masks):
run("bfast index -d 1 -n 4 -f %s -A 0 -m %s -w %s -i %s" %
(local_ref, mask, window_size, i + 1))
# colorspace
run("bfast fasta2brg -f %s -A 1" % local_ref)
for i, mask in enumerate(bfast_color_masks):
run("bfast index -d 1 -n 4 -f %s -A 1 -m %s -w %s -i %s" %
(local_ref, mask, window_size, i + 1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment