Skip to content

Commit

Permalink
Update Manual, version
Browse files Browse the repository at this point in the history
  • Loading branch information
rfd1 committed Mar 15, 2023
1 parent 56a2f5c commit 51bfdf9
Show file tree
Hide file tree
Showing 20 changed files with 63 additions and 44 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@ archive/

# python
__pycache__
venv*
venv*

#pycharm
.idea/
Binary file modified doc/manual.pdf
Binary file not shown.
4 changes: 2 additions & 2 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
author = 'Robert F. DeJaco'

# The short X.Y version
version = 'v2.2.0'
version = 'v3.0.0'
# The full version, including alpha/beta/rc tags
release = 'v2.2.0'
release = 'v3.0.0'


# -- General configuration ---------------------------------------------------
Expand Down
Binary file modified out/figure2.pdf
Binary file not shown.
Binary file modified out/figure4.pdf
Binary file not shown.
Binary file modified out/figure5.pdf
Binary file not shown.
Binary file modified out/figure6.pdf
Binary file not shown.
Binary file modified out/figure7.pdf
Binary file not shown.
Binary file modified out/figure8.pdf
Binary file not shown.
Binary file modified out/figure9.pdf
Binary file not shown.
Binary file modified out/figureS1.pdf
Binary file not shown.
Binary file modified out/figureS2.pdf
Binary file not shown.
Binary file modified out/figureS3.pdf
Binary file not shown.
Binary file modified out/figureS4.pdf
Binary file not shown.
Binary file modified out/figureS5.pdf
Binary file not shown.
65 changes: 37 additions & 28 deletions src/get_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,29 @@ def get_C(file_name):
Parameters
----------
file_name : str
CSV file formatted like a 96-well plate. The top left corner looks like
+-----+---+---+
| Row| 1 | 2 |
+=====+===+===+
| A | . | . |
+-----+---+---+
| B | . | . |
+-----+---+---+
| C | . | . |
+-----+---+---+
The values are concentrations of dye in units of mol/L
CSV file containing values of
concentrations of dye in units of :math:`\\mu` mol/L.
Formatted like a 96-well plate:
+-----+---+---+---+---+---+---+---+---+---+---+---+---+
| Row| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10| 11| 12|
+=====+===+===+===+===+===+===+===+===+===+===+===+===+
| A | . | . | . | . | . | . | . | . | . | . | . | . |
+-----+---+---+---+---+---+---+---+---+---+---+---+---+
| B | . | . | . | . | . | . | . | . | . | . | . | . |
+-----+---+---+---+---+---+---+---+---+---+---+---+---+
| C | . | . | . | . | . | . | . | . | . | . | . | . |
+-----+---+---+---+---+---+---+---+---+---+---+---+---+
| D | . | . | . | . | . | . | . | . | . | . | . | . |
+-----+---+---+---+---+---+---+---+---+---+---+---+---+
| E | . | . | . | . | . | . | . | . | . | . | . | . |
+-----+---+---+---+---+---+---+---+---+---+---+---+---+
| F | . | . | . | . | . | . | . | . | . | . | . | . |
+-----+---+---+---+---+---+---+---+---+---+---+---+---+
| G | . | . | . | . | . | . | . | . | . | . | . | . |
+-----+---+---+---+---+---+---+---+---+---+---+---+---+
| H | . | . | . | . | . | . | . | . | . | . | . | . |
+-----+---+---+---+---+---+---+---+---+---+---+---+---+
Returns
Expand All @@ -84,15 +93,15 @@ class RawData:
Attributes
----------
F : np.ndarray
Fluorescence data, :math:`F_d^{t\\ell}` (see Equation 11 of main text)
Fluorescence data, :math:`F_d^{t,l}` (see Eq. 11)
C : np.ndarray
Dye concentrations, :math:`C` (see Equation 10 of main text)
Dye concentrations, :math:`C` (see Eq. 10)
B : float
DNA concentration, :math:`B_d` in mol/L
t : str
Type of DNA, :math:`t`, :code:`"SS"` or :code:`"DS"` or :code:`"None"`.
l : str
Replicate name, :math:`\\ell` is A, B, or C
Replicate name, :math:`l` is :code:`"A"`, :code:`"B"`, or code:`"C"`.
N : int
number of nucleobases per single strand
Expand Down Expand Up @@ -140,32 +149,32 @@ class CombinedData:
Attributes
----------
F : np.ndarray
Fluorescence data, :math:`\\mathbf{F}_{\\mathbf{D}}^t` in Equation (16a)
Fluorescence data, :math:`\\mathbf{F}_{\\mathbf{D}}^t` in Equation (13a)
C : np.ndarray
Dye concentrations, :math:`\\mathbf{C}_{\\mathbf{D}}^t` in Equation (16a)
Dye concentrations, :math:`\\mathbf{C}_{\\mathbf{D}}^t` in Equation (13a)
D : float
DNA concentration, :math:`\\mathbf{D}` in Equation (16a)
DNA concentration, :math:`\\mathbf{D}` in Equation (13a)
t : str
Type of DNA, :math:`t`, :code:`"SS"` or :code:`"DS"`
N : int
number of nucleobases per single strand, :math:`N`
M_tls : np.array
:math:`\\mathbf{M}^\\mathrm{TLS}`, set externally, defaults to np.array([])
:math:`\\mathbf{M}^\\mathrm{TLS}` in Equation (18a), set externally, defaults to np.array([])
C_hat : np.array
:math:`\\widehat{\\mathbf{C}}`, set externally, defaults to np.array([])
:math:`\\widehat{\\mathbf{C}}` in Equation (18a), set externally, defaults to np.array([])
V_M : np.array
:math:`V(\\mathbf{M})` (see Section S1.2), defaults to np.array([])
:math:`V(\\mathbf{M})` (see section S1.3 in supporting material), defaults to np.array([])
V_C : np.array
:math:`V(\\mathbf{C})` (see Section S1.2), defaults to np.array([])
:math:`V(\\mathbf{C})` (see section S1.3 in supporting material), defaults to np.array([])
M_std : np.array
:math:`\\sqrt{V(\\mathbf{M})}` (see Section S1.2), defaults to np.array([])
:math:`\\sqrt{V(\\mathbf{M})}`, defaults to np.array([])
C_std : np.array
:math:`\\sqrt{V(\\mathbf{C})}` (see Section S1.2), defaults to np.array([])
:math:`\\sqrt{V(\\mathbf{C})}`, defaults to np.array([])
"""
def __init__(self, *replicates: typing.Tuple[RawData]) -> None:
"""Combine replicate :math:`F` and :math:`C`
"""Combine replicate :math:`F_d^{t,l}` and :math:`C`
Parameters
----------
Expand Down Expand Up @@ -227,7 +236,7 @@ def make_subset(self, F_min):
self.C = self.C[wells]

i_T = 0
while (np.mean(self.F[i_T, :]) < F_min):
while np.mean(self.F[i_T, :]) < F_min:
i_T += 1

self.F = self.F[i_T:, :]
Expand Down
8 changes: 4 additions & 4 deletions src/noise_removal.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def compute_M_LS(F, C):
Returns
-------
np.array
:math:`\\mathbf{M}^\\mathrm{LS}`, see Equation (17)
:math:`\\mathbf{M}^\\mathrm{LS}`, see Eq. 17.
"""
return F@C/np.inner(C, C)
Expand All @@ -30,7 +30,7 @@ def compute_c_plus(F, C, M_minus, rho_squared):
Returns
-------
np.ndarray
:math:`\\mathbf{c}_+` by Equation (S3a)
:math:`\\mathbf{c}_+` by Eq. S3a (see supporting material).
"""
return (C*rho_squared + F.T@M_minus)/(rho_squared + np.inner(M_minus, M_minus))

Expand All @@ -48,13 +48,13 @@ def compute_M_plus(F, c_plus):
Returns
-------
np.array
:math:`\\mathbf{M}_{+}` by Equation (S3b)
:math:`\\mathbf{M}_{+}` by Eq. S3b (see supporting material).
"""
return F@c_plus/np.inner(c_plus, c_plus)


def predictor_corrector(F, C, rho_squared, maxiter=100000, print_iter=True):
"""Solve Equation (18) with predictor--corrector algorithm
"""Solve Eqs. 18 with predictor--corrector algorithm
Parameters
----------
Expand Down
20 changes: 13 additions & 7 deletions src/parameter_extraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@ def calculate_relative_brightness(f_SS, f_DS):
-------
np.array
Relative brightness, :math:`\\mathbf{f}^\\mathrm{DS}_j/\\mathbf{f}^\\mathrm{SS}_j` for each :math:`j` associated with SS.
(see Eq. 24).
"""
m = f_SS.shape[0]
return f_DS[-m:]/f_SS


def calculate_relative_brightness_err(SS_M1, SS_M2, DS_M1, DS_M2, SS_V_M1, SS_V_M2, DS_V_M1, DS_V_M2) -> np.array:
"""Estimate error in relative brightness, Equation (24).
"""Estimate error in relative brightness (Eq. 24).
Parameters
----------
Expand Down Expand Up @@ -78,6 +79,11 @@ def calculate_relative_brightness_err(SS_M1, SS_M2, DS_M1, DS_M2, SS_V_M1, SS_V_

class Parameters:
"""Stores multiple instances of CombinedData for one DNA type
Notes
-----
:math:`\\mathbf{M}^\\mathrm{TLS}` and :math:`\\widehat{\\mathbf{C}}`
are defined in Eq. 18a.
Attributes
----------
Expand All @@ -101,7 +107,7 @@ class Parameters:
V_M1 : np.array
:math:`V(\\mathbf{M})` associated with :math:`\\mathbf{D}=1`
V_M2 : np.array
:math:`V(mathbf{M})` associated with :math:`\\mathbf{D}=2`.
:math:`V(\\mathbf{M})` associated with :math:`\\mathbf{D}=2`.
Several high temperatures are removed to reflect smaller temperature range associated with :math:`\\mathbf{D}=1`
dT : float
Change in temperature from one cycle to next, :math:`\\Delta T`
Expand Down Expand Up @@ -146,7 +152,7 @@ def __init__(self, cls1: CombinedData, cls2: CombinedData):
assert self.N == cls2.N, "Cannot combine different DNA lengths"

def get_K(self) -> np.array:
"""Get :math:`\\mathbf{K}` from vectorized version of Equation (21)
"""Get :math:`\\mathbf{K}` from vectorized version of Eq. 21.
Returns
-------
Expand Down Expand Up @@ -178,7 +184,7 @@ def get_K_std(self) -> np.array:
return np.sqrt((DM*DM*(4*self.V_M1+ 2*self.V_M2) + DH*DH*(self.V_M1+ self.V_M2))/8/DM/DM/DM/DM)

def get_f(self) -> np.array:
"""Get :math:`\\mathbf{f}` from vectorized version of Equation (23)
"""Get :math:`\\mathbf{f}` from vectorized version of Eq. 23.
Returns
-------
Expand Down Expand Up @@ -228,7 +234,7 @@ def get_f_std(self) -> np.array:
)

def get_dg(self) -> np.array:
"""Get free energy of dye binding, :math:`\\Delta g`, vectorized version of Equation (25).
"""Get free energy of dye binding, :math:`\\Delta g`, vectorized version of Eq. 25.
Returns
-------
Expand All @@ -239,7 +245,7 @@ def get_dg(self) -> np.array:
return -R_kJ_molK * self.T * np.log(K/C_REF/self.N)

def get_dh(self) -> np.array:
"""Get differential enthalpy of binding, :math:`\\Delta h` as the vectorized version of Equation (26).
"""Get differential enthalpy of binding, :math:`\\Delta h` as the vectorized version of Eq. 26.
Returns
-------
Expand Down Expand Up @@ -297,7 +303,7 @@ def get_dh_std(self) -> np.array:
)

def get_theta_b_all_1(self, n):
"""Returns :math:`\\theta_{b,j,1}` in Equation (S6a) pointwise in :math:`j`
"""Returns :math:`\\theta_{b,j,1}` from Eq. S5 pointwise in :math:`j`
The index :math:`b` is the total number of wells.
Returns
Expand Down
2 changes: 1 addition & 1 deletion src/plot_noise_removal.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def plot_error_C(ax, C, Chat, Chat_std=None, **kwargs):

def plot_Chat_vs_C(Cs, C_hats, C_stds, fname):
"""Plot comparison between :math:`\\mathbf{C}` and :math:`\\widehat{\\mathbf{C}}`.
Used to plot figure 5
Used to plot Fig. 6
Parameters
----------
Expand Down
3 changes: 2 additions & 1 deletion src/plot_raw_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ def plot_linemap(
cls: RawData,
ax, colorbar=False, get_ticks=False, ordered_by_row=True
):
"""Plot F vs C for various temperatures (colors)
"""Plot :math:`F_d^t\\left(T_j, C_i\\right)` vs :math:`C_i`
for various temperatures :math:`T_j` (colors)
Parameters
----------
Expand Down

0 comments on commit 51bfdf9

Please sign in to comment.