From 06bd68be3562df51bb09d9c2eb82f74ca38e88b6 Mon Sep 17 00:00:00 2001 From: ayelet peres Date: Mon, 1 Dec 2025 08:37:29 -0500 Subject: [PATCH] add support for multi-locus TRA/TRD detection in getLocus function --- changeo/Gene.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/changeo/Gene.py b/changeo/Gene.py index b8bb1e3..491baf2 100644 --- a/changeo/Gene.py +++ b/changeo/Gene.py @@ -18,6 +18,7 @@ gene_regex = re.compile(r'((IG[HLK]|TR[ABGD])([VDJ][A-R0-9]+[-/\w]*))') family_regex = re.compile(r'((IG[HLK]|TR[ABGD])([VDJ][A-R0-9]+))') locus_regex = re.compile(r'(IG[HLK]|TR[ABGD])') +multi_locus_tra_trd = re.compile(r'TRAV\d+(?:-\d+)?/DV\d+') v_allele_regex = re.compile(r'((IG[HLK]|TR[ABGD])V[A-R0-9]+[-/\w]*[-\*][\.\w]+)') d_allele_regex = re.compile(r'((IG[HLK]|TR[ABGD])D[A-R0-9]+[-/\w]*[-\*][\.\w]+)') @@ -115,6 +116,12 @@ def getLocus(gene, action='first'): str: String of the first locus call when action is 'first'. tuple: Tuple of locus calls for 'set' or 'list' actions. """ + if multi_locus_tra_trd.search(gene): + dual = ['TRA', 'TRD'] + if action == 'first': + return 'TRA/TRD' + elif action in ('set', 'list'): + return tuple(dual) return parseGeneCall(gene, locus_regex, action=action)