A collection of functions for Q matrix manipulations.
DC_PyPs project are pure Python implementations of Q-Matrix formalisms for ion channel research. To learn more about kinetic analysis of ion channels see the references below.
CH82: Colquhoun D, Hawkes AG (1982) On the stochastic properties of bursts of single ion channel openings and of clusters of bursts. Phil Trans R Soc Lond B 300, 1-59.
HJC92: Hawkes AG, Jalali A, Colquhoun D (1992) Asymptotic distributions of apparent open times and shut times in a single channel record allowing for the omission of brief events. Phil Trans R Soc Lond B 337, 383-404.
CH95a: Colquhoun D, Hawkes AG (1995a) The principles of the stochastic interpretation of ion channel mechanisms. In: Single-channel recording. 2nd ed. (Eds: Sakmann B, Neher E) Plenum Press, New York, pp. 397-482.
CH95b: Colquhoun D, Hawkes AG (1995b) A Q-Matrix Cookbook. In: Single-channel recording. 2nd ed. (Eds: Sakmann B, Neher E) Plenum Press, New York, pp. 589-633.
CHS96: Colquhoun D, Hawkes AG, Srodzinski K (1996) Joint distributions of apparent open and shut times of single-ion channels and maximum likelihood fitting of mechanisms. Phil Trans R Soc Lond A 354, 2555-2590.
Evaluate H(s) funtion (Eq. 54, HJC92). HAA(s) = QAA + QAF * (s*I - QFF) ^(-1) * (I - exp(-(s*I - QFF) * tau)) * QFA To evaluate HFF(s) exhange A by F and F by A in function call.
Parameters : | s : float
tres : float
QAA : array_like, shape (kA, kA) QFF : array_like, shape (kF, kF) QAF : array_like, shape (kA, kF) QFA : array_like, shape (kF, kA)
kF : int
|
---|---|
Returns : | H : ndarray, shape (kA, kA) |
Evaluate W(s) function (Eq. 52, HJC92). WAA(s) = s * IA - HAA(s) To evaluate WFF(s) exhange A by F and F by A in function call.
Parameters : | s : float
tres : float
QAA : array_like, shape (kA, kA) QFF : array_like, shape (kF, kF) QAF : array_like, shape (kA, kF) QFA : array_like, shape (kF, kA)
kA : int
kF : int
|
---|---|
Returns : | W : ndarray, shape (k2, k2) |
Calculate coefficients for asymptotic eGAF(t) (Eq. 3.2 HJC90): AR(tres) * QAF * exp(QFF * tres)
Parameters : | tres : float
roots : array_like, shape (1, kA)
QAA, QFF, QAF, QFA : array_like
|
---|---|
Returns : | X : array_like, shape(kA, kA, kF) |
Calculate Z constants for the exact open time pdf (Eq. 3.22, HJC90). Exchange A and F for shut time pdf.
Parameters : | t : float
Q : array_like, shape (k, k) kopen : int
QFF, QAF, QFA : array_like
open : bool
|
---|---|
Returns : | eigen : array_like, shape (k,)
Z00, Z10, Z11 : array_like, shape (k, kA, kF)
|
Evaluate the derivative with respect to s of the Laplace transform of the survival function (Eq. 3.6, CHS96) for open states:
For same evaluation for shut states exhange A by F and F by A in function call.
SFF = I - exp(QFF * tres) First evaluate [dVA(s) / ds] * s = 0. dVAds = -inv(QAA) * GAF * SFF * GFA - GAF * SFF * inv(QFF) * GFA + + tres * GAF * expQFF * GFA
Then: DARS = inv(VA) * QAA^(-2) - inv(VA) * dVAds * inv(VA) * inv(QAA) = = inv(VA) * [inv(QAA) - dVAds * inv(VA)] * inv(QAA) where VA = I - GAF * SFF * GFA
Parameters : | tres : float
QAA : array_like, shape (kA, kA) QAF : array_like, shape (kA, kF) QFF : array_like, shape (kF, kF) QFA : array_like, shape (kF, kA)
GAF : array_like, shape (kA, kF) GFA : array_like, shape (kF, kA)
expQFF : array_like, shape(kF, kF) expQAA : array_like, shape(kA, kA)
kA : int
kF : int
|
---|---|
Returns : | DARS : array_like, shape (kA, kA) |
Evaluate the derivative with respect to s of the matrix W(s) at the root s (Eq. 56, HJC92) for open states. For same evaluation for shut states exhange A by F and F by A in function call. W’(s) = I + QAF * [SFF(s) * (s*I - QFF)^(-1) - tau * (I - SFF(s))] * eGFA(s) where SFF(s) = I - exp(-(s*I - QFF) * tau) (Eq. 17, HJC92) and eGFA(s) = (s*I - QFF)^(-1) * QFA (Eq. 4, HJC92).
Parameters : | s : float
tres : float
QAF : array_like, shape (kA, kF) QFF : array_like, shape (kF, kF) QFA : array_like, shape (kF, kA)
kA : int
kF : int
|
---|---|
Returns : | dW : ndarray, shape (kF, kF) |
Calculate transition density eGAF(t) for exact (Eq. 3.2, HJC90) and asymptotic (Eq. 3.24, HJC90) distribution.
Parameters : | t : float
tres : float
roots : array_like, shape (1, kA)
XAF : array_like, shape(kA, kA, kF) eigvals : array_like, shape (1, k)
Z00, Z10, Z11 : array_like, shape (k, kA, kF)
|
---|---|
Returns : | eGAFt : array_like, shape(kA, kA, kF) |
Calculate eGAF, probabilities from transitions from apparently open to shut states regardles of when the transition occurs. Thease are Laplace transform of eGAF(t) when s=0. Used to calculat initial HJC vectors (HJC92). eGAF*(s=0) = (I - GAF * (I - expQFF) * GFA)^-1 * GAF * expQFF To caculate eGFA exhange A by F and F by A in function call.
Parameters : | GAF : array_like, shape (kA, kF) GFA : array_like, shape (kF, kA) kA : int
kF : int
|
---|---|
Returns : | eGAF : array_like, shape (kA, kF) |
Calculate eigenvalues and spectral matrices of a matrix Q.
Parameters : | Q : array_like, shape (k, k) |
---|---|
Returns : | eigvals : ndarray, shape (k,)
A : ndarray, shape (k, k, k)
|
Parameters : | M : array_like, shape (k, k) t : float
|
---|---|
Returns : | expM : ndarray, shape (k, k) |
A component of exact time pdf (Eq. 22, HJC92).
Parameters : | u : float
eigvals : array_like, shape (k,)
Z00 : list of array_likes
|
---|---|
Returns : | f : ndarray |
A component of exact time pdf (Eq. 22, HJC92).
Parameters : | u : float
eigvals : array_like, shape (k,)
Z10, Z11 (or gama10, gama11) : list of array_likes
|
---|---|
Returns : | f : ndarray |
Calculate GBA and GAB matrices (Eq. 1.25, CH82). Calculate also GFA and GAF if kF is given instead of kB.
Parameters : | Q : array_like, shape (k, k) kA : int
kB : int
|
---|---|
Returns : | GAB : ndarray, shape (kA, kB) GBA : ndarray, shape (kB, kA) |
Calculate initial vector for openings.
Parameters : | mec : dcpyps.Mechanism
|
---|---|
Returns : | phi : ndarray, shape (kA) |
Calculate inital vector for shuttings.
Parameters : | mec : dcpyps.Mechanism
|
---|---|
Returns : | phi : ndarray, shape (kF) |
Calculate initial HJC vector for openings by solving phi*(I-eGAF*eGFA)=0 (Eq. 10, HJC92) For shuttings exhange A by F and F by A in function call.
Parameters : | eGAF : array_like, shape (kA, kF) eGFA : array_like, shape (kF, kA) kA : int
kF : int
|
---|---|
Returns : | phi : array_like, shape (kA) |
Calculate initial vector for any subset.
Parameters : | mec : dcpyps.Mechanism
|
---|---|
Returns : | phi : ndarray, shape (kA) |
Calculate ecquilibrium occupancies by adding a column of ones to Q matrix. Pinf = uT * invert((S * transpos(S))).
Parameters : | Q : array_like, shape (k, k) |
---|---|
Returns : | pinf : ndarray, shape (k1) |