Commit 5b6fe331 authored by Mathieu Giraud's avatar Mathieu Giraud

should-vdj-to-tap.py: accepts ambiguous/alternate patterns

parent ee75cf5f
...@@ -91,6 +91,7 @@ def should_pattern_to_regex(p): ...@@ -91,6 +91,7 @@ def should_pattern_to_regex(p):
TRDV2*02 14/TCCCGGCCT/0 TRDD3*01_3/CCACGGC/4_TRAJ29*01 TRDV2*02 14/TCCCGGCCT/0 TRDD3*01_3/CCACGGC/4_TRAJ29*01
TRDD2 18//4 TRAJ29 TRA+D # comments comments ... TRDD2 18//4 TRAJ29 TRA+D # comments comments ...
TRGV11 2/5/0 TRGJ1 TRGV11 2/5/0 TRGJ1
IGHV3-48 0/AA/6 IGHD5-12 (2//7, 3//6, 4//5) IGHJ4*02
''' '''
...@@ -100,6 +101,14 @@ def should_pattern_to_regex(p): ...@@ -100,6 +101,14 @@ def should_pattern_to_regex(p):
if term.startswith('#'): if term.startswith('#'):
return [] return []
# Ambiguous/alternate pattern
if term.startswith('('):
choices = []
term_without_par = term[1:-1]
for t in term_without_par.split(','):
choices += process_term(t)
return ['(%s)' % '|'.join(choices)]
# (such as CDR3 / junction) # (such as CDR3 / junction)
if term.startswith('{'): if term.startswith('{'):
term = term.replace('*','[*]').replace('!','#') term = term.replace('*','[*]').replace('!','#')
...@@ -143,6 +152,7 @@ def should_pattern_to_regex(p): ...@@ -143,6 +152,7 @@ def should_pattern_to_regex(p):
r = [] r = []
p = p.replace(', ', ',')
for term in p.split(): for term in p.split():
r += process_term(term) r += process_term(term)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment