Skip to Content
Python APIUtilitiesloops_to_beddb

loops_to_beddb

chr3d.utils.loops_to_beddb( loops_csv: str, peaks_path: str, output_bedpe: str, output_bedpedb: str, assembly: str = "hg38", p_value_col: str = "p_adj_fdr_bh", significant_col: str = "significant_fdr_bh", canonical_chroms_only: bool = True, max_score: float = 300.0, chromsizes_path: str = None, skip_verify: bool = False, ) -> Dict[str, Any]

Convert significant-loops CSV + narrowPeak → BEDPE → bedpedb (HiGlass).

One-call wrapper that chains csv_to_bedpe, bedpe_to_bedpedb, and optionally verify_positions.

Parameters

ParameterTypeDescription
loops_csvstrPath to significant loops CSV file
peaks_pathstrPath to narrowPeak file
output_bedpestrPath for intermediate BEDPE output
output_bedpedbstrPath for final bedpedb (HiGlass SQLite) output
assemblystrGenome assembly name (default: "hg38")
p_value_colstrColumn name for p-values in loops CSV (default: "p_adj_fdr_bh")
significant_colstrColumn name for significance flag in loops CSV (default: "significant_fdr_bh")
canonical_chroms_onlyboolKeep only canonical chromosomes (default: True)
max_scorefloatMaximum -log10(p) score (default: 300)
chromsizes_pathstrPath to chromosome sizes file (needed for verification)
skip_verifyboolSkip position verification step (default: False)

Returns:

Dict[str, Any] — Combined statistics from all conversion steps, plus "verification_passed" key if verification was run.

Example:

from chr3d.utils import loops_to_beddb stats = loops_to_beddb( loops_csv="significant_loops.csv", peaks_path="peaks.narrowPeak", output_bedpe="loops.bedpe", output_bedpedb="loops.bedpedb", chromsizes_path="hg38.chrom.sizes", ) print(f"Final loops: {stats['n_final']}") print(f"Verification: {stats['verification_passed']}")
Last updated on