forked from CHPGenetics/GMM-Demux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck_multi_comp.py
36 lines (24 loc) · 1.06 KB
/
check_multi_comp.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import pandas as pd
from sys import argv
import numpy as np
def get_HTO_cell_idx(high_array, threshold):
high_idx = np.argwhere(high_array > threshold)
return high_idx
def compute_confidence(high_array, low_array, high_ary_idx, all_ary_idx):
product = np.full(len(high_array[0]), 1.0)
for idx in all_ary_idx:
if idx in high_ary_idx:
product = product * high_array[idx]
else:
product = product * low_array[idx]
return product
def get_shared_cell_idx(high_array, low_array, high_ary_idx, all_ary_idx, threshold):
product = compute_confidence(high_array, low_array, high_ary_idx, all_ary_idx)
residual_idx = np.argwhere(product > threshold)
return residual_idx
def get_HTO_cell_num(high_array, threshold):
high_idx = get_HTO_cell_idx(high_array, threshold)
return len(high_idx)
def get_shared_cell_num(high_array, low_array, high_ary_idx, all_ary_idx, threshold):
residual_idx = get_shared_cell_idx(high_array, low_array, high_ary_idx, all_ary_idx, threshold)
return len(residual_idx)