Skip to content

Commit 0f4b292

Browse files
committed
script for plotting a single, single cluster fit
1 parent 6cc8d37 commit 0f4b292

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed

bin/plotSingleClusterBindingCurve.py

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#!/usr/bin/env python
2+
#
3+
# will find fmax distribution given the single cluster fits on
4+
# good binders and good fitters.
5+
#
6+
# fmax distribtuion is then enforced for weak binders, allowing
7+
# good measurements even when no reaching saturation.
8+
#
9+
# Median of cluster fits are bootstrapped to obtain errors on
10+
# fit parameters.
11+
#
12+
# Sarah Denny
13+
# July 2015
14+
15+
##### IMPORT #####
16+
import numpy as np
17+
import pandas as pd
18+
import sys
19+
import os
20+
import argparse
21+
import seqfun
22+
import datetime
23+
import IMlibs
24+
import seaborn as sns
25+
import scipy.stats as st
26+
import matplotlib.pyplot as plt
27+
sns.set_style("white", {'xtick.major.size': 4, 'ytick.major.size': 4})
28+
import plotFun
29+
import findFmaxDist
30+
import fitFun
31+
#plt.rc('text', usetex=True)
32+
### MAIN ###
33+
34+
################ Parse input parameters ################
35+
36+
#set up command line argument parser
37+
parser = argparse.ArgumentParser(description='bootstrap fits')
38+
parser.add_argument('-b', '--binding_curves', required=True, metavar=".CPseries.pkl",
39+
help='file containining the binding curve information')
40+
parser.add_argument('-f', '--single_cluster_fits', required=True, metavar=".CPfitted.pkl",
41+
help='file containining the single cluster fits')
42+
parser.add_argument('-c', '--concentrations', required=True, metavar="concentrations.txt",
43+
help='text file giving the associated concentrations')
44+
parser.add_argument('-i', '--cluster', required=True, metavar="clusterID",
45+
help='cluster Id for which to plot')
46+
47+
parser.add_argument('-out', '--out_file',
48+
help='output filename. default is variant number + ".pdf"')
49+
50+
51+
52+
if __name__ == '__main__':
53+
args = parser.parse_args()
54+
55+
variantFilename = args.variant_file
56+
annotatedClusterFile = args.annotated_clusters
57+
bindingCurveFilename = args.binding_curves
58+
singleClusterFilename = args.single_cluster_fits
59+
cluster = args.cluster
60+
61+
# load data
62+
concentrations = np.loadtxt(args.concentrations)
63+
bindingSeries = pd.read_pickle(bindingCurveFilename)
64+
fittedSingles = pd.read_pickle(singleClusterFilename)
65+
66+
67+
# plot
68+
fig = plt.figure(figsize=(4,3))
69+
ax = fig.add_subplot(111)
70+
fitParameters = pd.DataFrame(columns=['fmax', 'dG', 'fmin'])
71+
fitFun.plotFitCurve(concentrations,
72+
bindingSeries.loc[cluster],
73+
fittedSingles.loc[cluster],
74+
fitParameters, ax=ax)
75+
76+
77+
plt.savefig( args.out_file)

0 commit comments

Comments
 (0)