Module: gmap
In this module are all functions to calculate a Gaussian weighted contact map. For the gaussian weight at a specific position \(x\), use function BioHelpers.modules.gmap.gaussSum()
.
Examples
In the first example we calculate the \(PPV\) of a predicted contact map, compared to a native map. In this example we make no use of the Gaussian weighting.
1import BioHelpers_FABER.gmap as gmap
2import BioHelpers_FABER.bio_mod as bm
3
4predicted_contacts = #List of predicted contacts
5native_contacts = #List of native contacts
6
7#-- Calculation from TP --
8tp = gmap.TP(predicted_contacts, native_contacts)
9all_positive = sum([e[2] for e in predicted_contacts])
10print("PPV", tp/all_positive)
11
12#-- Calculation w/ function --
13print("PPV", gmap.ppv(predicted_contacts, native_contacts))
Members
- BioHelpers_FABER.gmap.ceff(map: list[list[float]]) float
Calculation of the effective contacts
- Parameters:
map (list) – Map with points of the form [x,y,val]
- Returns:
sum over all val
- Return type:
float
- BioHelpers_FABER.gmap.gauss(x: list, center: list, var: float) float
Gauss function at point x with mean center
- Parameters:
x (list) – Point of Gaussian distr.
center (list) – mean point of Gaussian distr.
var (float) – Variance
- Returns:
Value of Gaussian distr.
- Return type:
float
- BioHelpers_FABER.gmap.gaussSum(x: list, con: list, var: float) float
Summation of all Gaussian distributions at point x
- Parameters:
x (list) – Point of summation (e.g. [3,5])
con (list) – List of all contacts
var (float) – Variance of the Gaussian distributions
- Returns:
Summation of all Gaussian distr. at point x
- Return type:
float
- BioHelpers_FABER.gmap.gaussWeightCon(contacts: list, var: float) list
“Intermediate function with only contacts”
- BioHelpers_FABER.gmap.gaussWeightMap(init: list, var: float) list
Create a full Gauss map
- Parameters:
init (list) – Initial contact map of the form [[x1,y1,val],….] and val \(\in [0,1]\)
var (float) – Variance
- Returns:
Full Gaussian contact map, reweighted with the weight function for each contact point.
- Return type:
list
- BioHelpers_FABER.gmap.ppv(c: list, m: list) float
Calculation of the positive predicted value
- Parameters:
c (list) – Predicted Contact map
m (list) – Native Contact map
- Returns:
Ratio(\(PPV\)) \(\frac{TP}{TP+FP}\)
- Return type:
float
- BioHelpers_FABER.gmap.ppv_mat(c: ndarray, m: ndarray, tot=0) float
“Calculation if the positive predicted value for matrices”
- BioHelpers_FABER.gmap.tp(c: list[list[int]], m: list[list[int]]) float
Calculation of True Positive (TP) value
- Parameters:
c (list) – all contacts
m (list) – native contact map as list
- Returns:
\(TP = \sum_{x,y}c(x,y) \times m(x,y)\)
- Return type:
float
- BioHelpers_FABER.gmap.tp_mat(c: ndarray, m: ndarray) float
Calculation of True Positive (TP) value
- Parameters:
c (numpy array) – all contacts
m (numpy array) – native contact map as list
- Returns:
\(TP = \sum_{x,y}c(x,y) \times m(x,y)\)
- Return type:
float
- BioHelpers_FABER.gmap.weightFunction(x: float) float
weightFunction Weight function, here \(f(x) = 1/x\)