Diploid Copy Number Estimation¶
Computes per-sample diploid copy number by normalizing each sample’s read counts relative to its nearest neighbors, accounting for sample-specific sequencing depth.
- grid.utils.compute_dipcn.compute_diploid_genotypes(config, console)¶
Compute diploid copy number estimates.
Two modes depending on config:
Mode 1 — GC normalize enabled (
gc_normalize: run: True):Writes corrected_rpk_ratio directly from the GC normalization output to the diploid genotypes file. No neighbor normalization applied. This gives the best correlation with Bionano optical mapping (r=0.986).
Mode 2 — GC normalize disabled (
gc_normalize: run: False):Replicates Mukamel’s awk normalization exactly:
norm_reads = reads[sample] / sample_scale / mean( reads[neighbor] / neighbor_scale )
where the mean is over the top n_nbr neighbors.
- Return type:
None
- grid.utils.compute_dipcn.load_neighbors(neighbors_file)¶
Parse the gzipped neighbors file.
- Each line format:
sample_id sample_scale nbr1_id nbr1_scale nbr1_norm_dist nbr2_id …
- Returns:
{sample_id: [(neighbor_id, neighbor_scale), …]} sample_scales : {sample_id: sample_scale}
- Return type:
neighbors
- Parameters:
neighbors_file (Path)