From 20d009488c0eb67d757184e0795cffef986c1967 Mon Sep 17 00:00:00 2001 From: Safiye Celik Date: Mon, 13 May 2024 08:46:18 -0400 Subject: [PATCH] consistency --- proxbias/scPerturb_processing_plotting.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/proxbias/scPerturb_processing_plotting.py b/proxbias/scPerturb_processing_plotting.py index b4fb073..438f062 100644 --- a/proxbias/scPerturb_processing_plotting.py +++ b/proxbias/scPerturb_processing_plotting.py @@ -66,11 +66,11 @@ def _compute_chromosomal_loss( sorted_genes_on_chr = {} start_block_of_chr = {} + block_size_of_chr = {} for c in set(map(lambda chr_arm: chr_arm[0], pert_gene_chr_arm.values())): sorted_genes_on_chr[c] = list(avar[avar.chromosome == c].sort_values("start").index) start_block_of_chr[c] = anndat.uns["cnv"]["chr_pos"][c] - - block_size_dict = {chr_: len(genes) // blocksize for chr_, genes in sorted_genes_on_chr.items()} + block_size_of_chr = len(sorted_genes_on_chr[c]) // blocksize ko_gene_ixs_dict = {ko_gene: anndat.obs.gene == ko_gene for ko_gene in pert_genes} ko_gene_sum_dict = {ko_gene: sum(ixs) for ko_gene, ixs in ko_gene_ixs_dict.items()} @@ -93,7 +93,7 @@ def _compute_chromosomal_loss( # get block position of the gene in the chromosome aff_gene_blocknum_ = aff_gene_ordpos // blocksize # get total number of blocks in the chromosome - total_chr_blocks = block_size_dict[aff_chr] + total_chr_blocks = block_size_of_chr[aff_chr] # get start block of the chromosome gene is in aff_chr_startblocknum = start_block_of_chr[aff_chr] # get end block of the chromosome gene is in