Skip to content

Commit

Permalink
consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
safiyecelik committed May 13, 2024
1 parent 1ef7ee1 commit 20d0094
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions proxbias/scPerturb_processing_plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()}
Expand All @@ -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
Expand Down

0 comments on commit 20d0094

Please sign in to comment.