Skip to content

Commit

Permalink
Grammar update and minor fixes in translation
Browse files Browse the repository at this point in the history
  • Loading branch information
Old-Shatterhand committed Dec 17, 2024
1 parent 40db564 commit 65c7513
Show file tree
Hide file tree
Showing 9 changed files with 477 additions and 429 deletions.
54 changes: 27 additions & 27 deletions glyles/glycans/mono/reactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"Thr": "N[C@@H](C(=O)O)[C@@H](O)C",
"triN": "N=[N+]=[N-]",
"Troc": "C(=O)OCC(Cl)(Cl)Cl",
"Ts": "S(=O)(=O)c2ccc(C)cc2",
"Ts": "OS(=O)(=O)c2ccc(C)cc2",
"Ulo": "OC(c2ccccc2)(c2ccccc2(Cl))CCN(C)C",

# COH land
Expand Down Expand Up @@ -137,32 +137,32 @@
"tBu": "OC(C)(C)C",

# Methan, Ethan, Propan, ...
"Me": "C" * 1,
"Et": "C" * 2,
"Pr": "C" * 3,
"Prop": "C" * 3,
"Bu": "C" * 4,
"Pe": "C" * 5,
"Hx": "C" * 6,
"Hp": "C" * 7,
"Oc": "C" * 8,
"Nn": "C" * 9,
"Dec": "C" * 10,
"Und": "C" * 11,
"Dod": "C" * 12,
# "Me": "O" + "C" * 1,
# "Et": "O" + "C" * 2,
# "Pr": "O" + "C" * 3,
# "Prop": "O" + "C" * 3,
# "Bu": "O" + "C" * 4,
# "Pe": "O" + "C" * 5,
# "Hx": "O" + "C" * 6,
# "Hp": "O" + "C" * 7,
# "Oc": "O" + "C" * 8,
# "Nn": "O" + "C" * 9,
# "Dec": "O" + "C" * 10,
# "Und": "O" + "C" * 11,
# "Dod": "O" + "C" * 12,
# "Me": "C" * 1,
# "Et": "C" * 2,
# "Pr": "C" * 3,
# "Prop": "C" * 3,
# "Bu": "C" * 4,
# "Pe": "C" * 5,
# "Hx": "C" * 6,
# "Hp": "C" * 7,
# "Oc": "C" * 8,
# "Nn": "C" * 9,
# "Dec": "C" * 10,
# "Und": "C" * 11,
# "Dod": "C" * 12,
"Me": "O" + "C" * 1,
"Et": "O" + "C" * 2,
"Pr": "O" + "C" * 3,
"Prop": "O" + "C" * 3,
"Bu": "O" + "C" * 4,
"Pe": "O" + "C" * 5,
"Hx": "O" + "C" * 6,
"Hp": "O" + "C" * 7,
"Oc": "O" + "C" * 8,
"Nn": "O" + "C" * 9,
"Dec": "O" + "C" * 10,
"Und": "O" + "C" * 11,
"Dod": "O" + "C" * 12,
# ... and their acids
"But": "OC(=O)" + "C" * 2,
"Vl": "OC(=O)" + "C" * 4,
Expand Down
3 changes: 2 additions & 1 deletion glyles/glycans/poly/walker.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ def __add_edge(self, parent, child, con) -> bool:
con = con[0] + bond + con[1:]
con = "(" + con + ")"
self.g.add_edge(parent, child, type=con)
return "?" not in con
# Identify standard and narrow wildcard connections
return "?" not in con and "/" not in con

def build_recipe(self, node):
recipe = []
Expand Down
6 changes: 4 additions & 2 deletions glyles/grammar/Glycan.g4
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ modi:
| HEADD DASH
| DASH END;
qnum:
QMARK | NUM;
QMARK | NUM (SLASH NUM)*;
typi:
TYPE | QMARK;
bridge:
Expand Down Expand Up @@ -67,7 +67,7 @@ FG:
| 'MOM' | 'Mon' | 'Myr' | 'NAP' | 'Ner' | 'Nno' | 'Non' | 'Oco' | 'Ole' | 'oNB' | 'Orn' | 'Pam' | 'Pic' | 'Piv'
| 'PMB' | 'PMP' | 'Poc' | 'Pro' | 'Pyr' | 'Ser' | 'Sin' | 'Ste' | 'TBS' | 'tBu' | 'TCA' | 'TES' | 'TFA' | 'THP'
| 'Thr' | 'Tig' | 'TMS' | 'Udo' | 'Ulo' | 'ulo' | 'Und' | 'Vac' | 'Ac' | 'Al' | 'Am' | 'Bn' | 'Br' | 'Bu' | 'Bz'
| 'Cl' | 'Cm' | 'DD' | 'DL' | 'en' | 'Et' | 'Fo' | 'Gc' | 'Hp' | 'Hx' | 'LD' | 'LL' | 'Me' | 'N3' | 'Nn' | 'Ns'
| 'Cl' | 'Cm' | 'DD' | 'DL' | 'en' | 'Et' | 'Fo' | 'Gc' | 'Hp' | 'Hx' | 'LD' | 'LL' | 'Me' | 'Nn' | 'Ns'
| 'Oc' | 'Pe' | 'Ph' | 'Pp' | 'Pr' | 'Tf' | 'Tr' | 'Ts' | 'Vl' | 'A' | 'F' | 'I' | 'S';
ANHYDRO:
'Anhydro';
Expand Down Expand Up @@ -117,6 +117,8 @@ EQ:
'=';
I:
'i';
SLASH:
'/';
QMARK:
'?';

Expand Down
4 changes: 3 additions & 1 deletion glyles/grammar/Glycan.interp

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions glyles/grammar/Glycan.tokens
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ E=29
T=30
EQ=31
I=32
QMARK=33
SLASH=33
QMARK=34
'#'=1
' '=2
'C'=4
Expand All @@ -55,4 +56,5 @@ QMARK=33
't'=30
'='=31
'i'=32
'?'=33
'/'=33
'?'=34
5 changes: 4 additions & 1 deletion glyles/grammar/GlycanLexer.interp

Large diffs are not rendered by default.

610 changes: 306 additions & 304 deletions glyles/grammar/GlycanLexer.py

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions glyles/grammar/GlycanLexer.tokens
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ E=29
T=30
EQ=31
I=32
QMARK=33
SLASH=33
QMARK=34
'#'=1
' '=2
'C'=4
Expand All @@ -55,4 +56,5 @@ QMARK=33
't'=30
'='=31
'i'=32
'?'=33
'/'=33
'?'=34
Loading

0 comments on commit 65c7513

Please sign in to comment.