Error in motif calculation
KeremKurban opened this issue · 2 comments
KeremKurban commented
I was running the notebook DotMotif-Search-in-Pinky100.ipynb and the following cell gives error.
motif = Motif("""
A -> B [spine_vol_um3 > 0.25]
B -> C
C -> A
""")
Output:
UnexpectedCharacters Traceback (most recent call last)
[<ipython-input-9-eaabd7ae9c73>](https://localhost:8080/#) in <cell line: 1>()
----> 1 motif = Motif("""
2 A -> B [spine_vol_um3 > 0.25]
3 B -> C
4 C -> A
5 """)
7 frames
[/usr/local/lib/python3.10/dist-packages/lark/parsers/xearley.py](https://localhost:8080/#) in scan(i, to_scan)
116 if not next_set and not delayed_matches and not next_to_scan:
117 considered_rules = list(sorted(to_scan, key=lambda key: key.rule.origin.name))
--> 118 raise UnexpectedCharacters(stream, i, text_line, text_column, {item.expect.name for item in to_scan},
119 set(to_scan), state=frozenset(i.s for i in to_scan),
120 considered_rules=considered_rules
UnexpectedCharacters: No terminal matches '_' in the current parser context, at line 2 col 14
A -> B [spine_vol_um3 > 0.25]
^
Expected one of:
* IN
* OPERATOR
* __ANON_5
* __ANON_6
* CONTAINS
Removing [spine_vol_um3 > 0.25] fixes the issue . Perhaps a recent update havent been tested for such filtering ?
j6k4m8 commented
thanks for reporting — this appears to be due to a recent change to improve handling of weird attribute names; it's possible you could quote the name for now but I will push a fix to the notebook shortly!
j6k4m8 commented
I've fixed the notebook linked in the readme; the correct motif is:
A -> B as AB
B -> C
C -> A
AB.spine_vol_um3 > 0.25