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)¶
Replicate the awk normalization exactly:
- norm_reads = reads[sample] / sample_scale
/ mean( reads[neighbor] / neighbor_scale )
where the mean is over the top n_nbr neighbors.
- Parameters:
config – configuration dictionary
console – Rich console for logging
- 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 …
norm_dist is present but unused — only neighbor_id and neighbor_scale are needed.
- Returns:
{sample_id: [(neighbor_id, neighbor_scale), …]} sample_scales : {sample_id: sample_scale}
- Return type:
neighbors
- Parameters:
neighbors_file (Path)