prihoda / AbNumber

Convenience Python APIs for antibody numbering using ANARCI
MIT License
80 stars 11 forks source link

how to get v_identity, j_identity against with germline ? #14

Open 0x1orz opened 1 year ago

0x1orz commented 1 year ago

how to get v_identity, j_identity against with germline , of which a output of anarci if assign_germline ?

prihoda commented 1 year ago

Hi @sheljoy, something like this might work:

chain = Chain(seq, 'imgt')

v_germline_chains, j_germline_chains = chain.find_human_germlines(limit=1)
top_v, top_j = v_germline_chains[0], j_germline_chains[0]

num_v_matches = sum(top_v.positions.get(pos) == aa for pos, aa in chain)
num_j_matches = sum(top_j.positions.get(pos) == aa for pos, aa in chain)

v_identity = num_v_matches / len(top_v)
j_identity = num_j_matches / len(top_j)
full_identity = (num_v_matches + num_j_matches) / len(chain)