How to do it…

  1. Let's start with the usual imports:
%matplotlib inlinefrom collections import defaultdictimport gzipimport numpy as npimport matplotlib.pylab as plt
  1. Let's load the data that we saved on the first recipe:
num_parents = 8dp_2L = np.load(gzip.open('DP_2L.npy.gz', 'rb'))print(dp_2L.shape)
  1. And let's print median DP for the whole chromosome arm, and a part of it in the middle for all parents:
for i in range(num_parents):    print(np.median(dp_2L[:,i]), np.median(dp_2L[50000:150000,i]))

Interestingly, the median for the whole chromosome sometimes does not hold for that big region in the middle, so let's dig further.

  1. We will print the median DP for 200,000 kbp windows across the chromosome arm. Let's start with the window code: ...

Get Bioinformatics with Python Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.