Skip to content

Instantly share code, notes, and snippets.

@timeu
Created January 22, 2016 09:08
Show Gist options
  • Save timeu/3ffb904a6e6954244d4d to your computer and use it in GitHub Desktop.
Save timeu/3ffb904a6e6954244d4d to your computer and use it in GitHub Desktop.
h5 = h5py.File('my_file','r')
snps = h5['snps']
start = 0
end = END_OF_CHROMOSOME
# how many SNPs you want
chunk_size = 1000
for i in xrange(start,end,chunk_size):
stop_ix = min(i+chunk_size,end)
# this will return an array of 1000 snps
chunked_snps = snps[i:stop_ix]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment