Repository: pckroon/pysmiles

Issue:
`[se]` and `[as]` are not properly recognized
While `se` and `as` can appear as aromatics if they are placed inside square brackets, however it seems this library fails to parse them

Comments:

Patch:
diff --git a/pysmiles/smiles_helper.py b/pysmiles/smiles_helper.py
index fb59432..86b05e3 100644
--- a/pysmiles/smiles_helper.py
+++ b/pysmiles/smiles_helper.py
@@ -27,7 +27,7 @@ import networkx as nx
 LOGGER = logging.getLogger(__name__)
 
 ISOTOPE_PATTERN = r'(?P<isotope>[\d]+)?'
-ELEMENT_PATTERN = r'(?P<element>b|c|n|o|s|p|\*|[A-Z][a-z]{0,2})'
+ELEMENT_PATTERN = r'(?P<element>b|c|n|o|s|p|as|se|\*|[A-Z][a-z]{0,2})'
 STEREO_PATTERN = r'(?P<stereo>@|@@|@TH[1-2]|@AL[1-2]|@SP[1-3]|@OH[\d]{1,2}|'\
                   r'@TB[\d]{1,2})?'
 HCOUNT_PATTERN = r'(?P<hcount>H[\d]?)?'


Test patch:
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
index 33e1666..aa08857 100644
--- a/.github/workflows/test.yaml
+++ b/.github/workflows/test.yaml
@@ -19,7 +19,7 @@ jobs:
 
     strategy:
       matrix:
-       py_version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
+       py_version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
 
     steps:
     - uses: actions/checkout@v2
diff --git a/tests/test_read_smiles.py b/tests/test_read_smiles.py
index d85e718..73196d3 100644
--- a/tests/test_read_smiles.py
+++ b/tests/test_read_smiles.py
@@ -427,6 +427,52 @@ from pysmiles.testhelper import assertEqualGraphs, make_mol
          (4, 8, {'order': 1})],
         True
     ),
+    (
+        'c1[asH]ccc1',
+        [(0, {'charge': 0, 'element': 'C', 'aromatic': True}),
+         (1, {'charge': 0, 'element': 'As', 'aromatic': True}),
+         (2, {'charge': 0, 'element': 'C', 'aromatic': True}),
+         (3, {'charge': 0, 'element': 'C', 'aromatic': True}),
+         (4, {'charge': 0, 'element': 'C', 'aromatic': True}),
+         (5, {'charge': 0, 'element': 'H', 'aromatic': False}),
+         (6, {'charge': 0, 'element': 'H', 'aromatic': False}),
+         (7, {'charge': 0, 'element': 'H', 'aromatic': False}),
+         (8, {'charge': 0, 'element': 'H', 'aromatic': False}),
+         (9, {'charge': 0, 'element': 'H', 'aromatic': False})],
+        [(0, 1, {'order': 1.5}),
+         (0, 4, {'order': 1.5}),
+         (0, 5, {'order': 1}),
+         (1, 2, {'order': 1.5}),
+         (2, 3, {'order': 1.5}),
+         (2, 6, {'order': 1}),
+         (3, 4, {'order': 1.5}),
+         (3, 7, {'order': 1}),
+         (4, 8, {'order': 1}),
+         (1, 9, {'order': 1}),],
+        True
+    ),
+    (
+        'c1[se]ccc1',
+        [(0, {'charge': 0, 'element': 'C', 'aromatic': True}),
+         (1, {'charge': 0, 'element': 'Se', 'aromatic': True}),
+         (2, {'charge': 0, 'element': 'C', 'aromatic': True}),
+         (3, {'charge': 0, 'element': 'C', 'aromatic': True}),
+         (4, {'charge': 0, 'element': 'C', 'aromatic': True}),
+         (5, {'charge': 0, 'element': 'H', 'aromatic': False}),
+         (6, {'charge': 0, 'element': 'H', 'aromatic': False}),
+         (7, {'charge': 0, 'element': 'H', 'aromatic': False}),
+         (8, {'charge': 0, 'element': 'H', 'aromatic': False})],
+        [(0, 1, {'order': 1.5}),
+         (0, 4, {'order': 1.5}),
+         (0, 5, {'order': 1}),
+         (1, 2, {'order': 1.5}),
+         (2, 3, {'order': 1.5}),
+         (2, 6, {'order': 1}),
+         (3, 4, {'order': 1.5}),
+         (3, 7, {'order': 1}),
+         (4, 8, {'order': 1})],
+        True
+    ),
     (
         '[O-]C(O)CN',
         [(0, {'charge': -1, 'element': 'O', 'aromatic': False}),