arcfish.tl.LoopCaller#
- class arcfish.tl.LoopCaller(fdr_cutoff: float = 0.1, pval_cutoff: float = 1e-05, cut_lo: float = 100000.0, cut_up: float = 1000000.0, gap: float = 50000.0, outer_cut: float = 50000.0, ltclass: ~arcfish.tools.loop.LoopTestAbstract = <class 'arcfish.tools.loop.AxisWiseF'>)#
Class for chromatin loop calling.
- Parameters:
fdr_cutoff (float) – FDR cut-off for chromatin loops, by default 0.1.
pval_cutoff (float) – P-value cut-off to filter loop summits, by default 1e-5.
cut_lo (float, optional) – Minimum loop size (1D genomic distance between the first locus and the second locus), by default 1e5.
cut_up (float, optional) – Maximum loop size, by default 1e6.
gap (float, optional) – Loop candidates gap away from each other are considered candidates for the same summit, by default 50e3.
outer_cut (float, optional) – Loci with 1D genomic distance within outer_cut from the target locus is included in the local background, by default 50e3. Must be larger than 25kb, which is the exclusion cutoff.
ltclass (LoopTestAbstract) – Test method used, by default
AxisWiseF.
- __init__(fdr_cutoff: float = 0.1, pval_cutoff: float = 1e-05, cut_lo: float = 100000.0, cut_up: float = 1000000.0, gap: float = 50000.0, outer_cut: float = 50000.0, ltclass: ~arcfish.tools.loop.LoopTestAbstract = <class 'arcfish.tools.loop.AxisWiseF'>)#
Methods
__init__([fdr_cutoff, pval_cutoff, cut_lo, ...])call_loops(adata)Call chromatin loops from a single chromosome.
spread_label(candidates, d1d)Group loop candidates.
to_bedpe(result, adata)Convert loop calling result to a data frame with columns c1, s1, e1, c2, s2, e2, stat, pval, fdr, candidate, label, summit.
Attributes
FDR cut-off for chromatin loops.
Loop candidates gap away from each other are considered candidates for the same summit.
Loop size considered.
Loci with 1D genomic distance within outer_cut from the target locus is included in the local background.
P-value cut-off to filter loop summits.
- property gap: int#
Loop candidates gap away from each other are considered candidates for the same summit.
- Type:
- property outer_cut: int#
Loci with 1D genomic distance within outer_cut from the target locus is included in the local background.
- Type:
- call_loops(adata: AnnData) dict#
Call chromatin loops from a single chromosome.
- Parameters:
adata (AnnData) – adata of a single chromosome, created by
arcfish.pp.FOF_CT_Loader.create_adata().- Returns:
A dictionary with keys stat, pval, fdr, candidate, label, summit. Values are (p,p) matrices. Might also contain other values depending on the test class used.
- Return type:
- spread_label(candidates: ndarray, d1d: ndarray) ndarray#
Group loop candidates. Each group corresponds to one summit.
- Parameters:
candidates ((p,p) np.ndarray) – Boolean matrix with candidate entries being True.
d1d ((p,) np.ndarray) – Array of 1D genomic locations of imaging loci.
- Returns:
Integer valued matrix. Entries with the same value define the same loop summit.
- Return type:
(p, p) np.ndarray
- to_bedpe(result: dict, adata: AnnData) DataFrame#
Convert loop calling result to a data frame with columns c1, s1, e1, c2, s2, e2, stat, pval, fdr, candidate, label, summit. c1, s1, e1 are the chromosome, starting position, and ending position of the first locus of the pair, c2, s2, e2 are the values for the second locus. stat, pval, fdr are test results for the pair. Candidate is boolean valued, label is integer valued, and summit is boolean valued.
- Parameters:
result (dict) – Output from
LoopCaller.loops_from_single_chr().adata (AnnData) – adata of a single chromosome, created by
arcfish.pp.FOF_CT_Loader.create_adata().
- Returns:
Output dataframe in bedpe format.
- Return type:
pd.DataFrame