Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
vidjil
vidjil
Commits
7cfeaca8
Commit
7cfeaca8
authored
Sep 30, 2016
by
Mikaël Salson
Browse files
should-vdj: Allow more complex ambiguous designations
parent
a7aaee81
Changes
2
Hide whitespace changes
Inline
Side-by-side
algo/tests/should-vdj-to-tap.py
View file @
7cfeaca8
...
...
@@ -109,12 +109,10 @@ def should_pattern_to_regex(p):
return
[]
# Ambiguous/alternate pattern
if
term
.
startswith
(
'
(
'
):
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
)]
term_without_comma
=
term
[
1
:]
return
[
'|'
+
''
.
join
(
process_term
(
term_without_comma
))]
# (such as CDR3 / junction)
if
term
.
startswith
(
'{'
):
...
...
@@ -159,12 +157,21 @@ def should_pattern_to_regex(p):
r
=
[]
p
=
p
.
replace
(
', '
,
','
)
p
=
re
.
sub
(
'\s*,\s*'
,
' ,'
,
p
)
m
=
re
.
search
(
'^(.*)\s*\((.+)\)\s*(.*)$'
,
p
)
if
m
:
# We have parentheses
re1
=
should_pattern_to_regex
(
m
.
group
(
1
)).
pattern
re2
=
'('
+
should_pattern_to_regex
(
m
.
group
(
2
)).
pattern
+
')'
re3
=
should_pattern_to_regex
(
m
.
group
(
3
)).
pattern
regex_pattern
=
'\s*'
.
join
(
x
for
x
in
[
re1
,
re2
,
re3
])
else
:
# We have a parenthesis free expression
for
term
in
p
.
split
():
r
+=
process_term
(
term
)
for
term
in
p
.
split
():
r
+=
process_term
(
term
)
regex_pattern
=
' .*'
.
join
(
r
)
regex_pattern
=
' .*'
.
join
(
r
)
try
:
regex
=
re
.
compile
(
regex_pattern
)
...
...
doc/should-vdj.org
View file @
7cfeaca8
...
...
@@ -128,9 +128,14 @@ TGGGGCCAGGGAACCCTGGTCACCGTCTCCTCAGTT
# TRGJ1*01 or TRGJ1*02
>TRGV5*01 (TRGJ1*01, TRGJ1*02) [TRG]
...
# TRGJ1*01 or TRGJ1*02 but with different deletions
>TRGV4*02 (4/4/4 TRGJ1*01, 4/4/1 TRGJ1*02) [TRG]
#+END_EXAMPLE
* Program-specific information
** Vidjil
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment