In [ ]:
import os, sys
import numpy as np
import cPickle
import matplotlib
import matplotlib.pyplot as plt
%matplotlib inline
fig = plt.figure()
ax = fig.add_subplot(1,1,1)

In [2]:
# Load the pickle into a data structure
dataDir = '/home/user/results'
fh = open(os.path.join(dataDir, 'my_anno_samples_variant_count.pickle'), 'r')
annoVarCount = cPickle.load(fh)
fh.close()

In [ ]:
# Use the data structure to create a histogram with title, and mean +/- std deviation values
histValues = plt.hist(annoVarCount.values(), 50);
myMean = np.mean(annoVarCount.values())
myStd = np.std(annoVarCount.values())
plt.title('Annotated Variant Counts, n={0}\nMean: {1}+/-{2}'.format(len(annoVarCount.keys()), '%0.0f' %myMean, '%0.0f' %myStd ))
plt.xlabel("SNVs per Sample")
ax = plt.subplot(1,1,1)
plt.ylabel("Count")
ax.set_yticks([0,1,2,3]) # you will need to customize these values to your graph
plt.xticks(np.arange(200, 900, 100)) # you will need to customize these values to your graph
plt.tight_layout()
#plt.show()
plt.savefig('/home/user/results/anno_sample_variant_count.jpg', dpi=300)