hic3defdr.util.scaling module¶
-
hic3defdr.util.scaling.
conditional
(data, dist, fn, n_bins=None)[source]¶ Applies a size factor computing function
fn
todata
conditioning ondist
, optionally binningdist
inton_bins
equal-number bins.If
n_bins
is not None, the final size factors will be interpolated for interaction distances falling between the bins to avoid bin edge effects.Parameters: - data (np.ndarray) – Rows correspond to pixels, columns correspond to replicates.
- dist (np.ndarray) – The distance of each pixel in
data
. - fn (function) – A function that computes a size factor given some data.
- n_bins (int, optional) – Pass an int to bin distance into this many equal-number bins.
-
hic3defdr.util.scaling.
conditional_mor
(data, dist, n_bins=None)[source]¶ Computes size factors for a dataset using median of ratios normalization, conditioning on distance.
Parameters: - data (np.ndarray) – Rows correspond to pixels, columns correspond to replicates.
- dist (np.ndarray) – The distance of each pixel in
data
- n_bins (int, optional) – Pass an int to bin distance into this many equal-number bins.
Returns: Matrix of size factors, per pixel (rows) and per replicate (columns).
Return type: np.ndarray
-
hic3defdr.util.scaling.
conditional_scaling
(data, dist, n_bins=None)[source]¶ Computes size factors for a dataset using simple scaling normalization, conditioning on distance.
Parameters: - data (np.ndarray) – Rows correspond to pixels, columns correspond to replicates.
- dist (np.ndarray) – The distance of each pixel in
data
. - n_bins (int, optional) – Pass an int to bin distance into this many equal-number bins.
Returns: Matrix of size factors, per pixel (rows) and per replicate (columns).
Return type: np.ndarray
-
hic3defdr.util.scaling.
median_of_ratios
(data, filter_zeros=True)[source]¶ Computes size factors for a dataset using the median of ratios method.
Parameters: - data (np.ndarray) – Rows correspond to pixels, columns correspond to replicates.
- filter_zeros (bool) – Pass True to filter out pixels with a zero value in any replicate. Pass False to include all data.
Returns: Vector of size factors, per replicate.
Return type: np.ndarray