Skip to content

Instantly share code, notes, and snippets.

@kdm9
Created October 29, 2015 09:40
Show Gist options
  • Save kdm9/19e3df51c6e4f3af642a to your computer and use it in GitHub Desktop.
Save kdm9/19e3df51c6e4f3af642a to your computer and use it in GitHub Desktop.
from frisk.kmerhash import *
import screed
r = screed.open('/home/kevin/ws/seqs/TAIR10_gen/TAIR10.fasta.gz')
for x in r:
seq = x.sequence[:100000]
break
winsz = 3000
ivs = []
for start in range(0, len(seq) - winsz + 1, winsz/2):
winseq = seq[start:start+winsz]
kv = build_kmer_vec(1, 8)
hash_seq(str(winseq), kv)
kf = kmer_freqs(kv)
iv = ivom(kf)
ivs.append(iv.sum() / len(iv))
if start % 10 == 0:
print start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment