Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
# Conflicts:
#	pyproject.toml
  • Loading branch information
Old-Shatterhand committed Oct 16, 2024
2 parents c4d1afe + 46d6a97 commit af33f3f
Show file tree
Hide file tree
Showing 31 changed files with 2,217 additions and 1,256 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
- main
- auto_test
- dev
- dev_1.0_grammar
pull_request:
branches:
- main
Expand All @@ -22,22 +23,22 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v3
with:
python-version: 3.7
python-version: 3.9
- name: Install poetry
uses: abatilo/[email protected]
with:
poetry-version: 1.1.12
- name: Install dependencies
run: |
poetry install --no-dev
poetry update --no-dev
poetry run python -m pip install pytest-cov
- name: Run tests
run: |
cd tests
poetry run python -m pytest --cov=../glyles/ --cov-report=xml -m "not todo and not slow"
poetry run python -m pytest --cov=../glyles/ --cov-report=xml -m "not todo"
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion examples/filtering.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -467,4 +467,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}
41 changes: 1 addition & 40 deletions examples/visualization.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -77,45 +77,6 @@
"Image(glycan.save_dot(\"files/viz_2.dot\", horizontal=True).create_png())"
]
},
{
"cell_type": "markdown",
"source": [
"## SNFG Visualization\n",
"\n",
"GlyLES can also be used to visualize glycans using the symbols from the SNFG standard.\n",
"\n",
"To better fit the visualization to your needs, there are some parameter, you can tune to adapt the visualization to your needs. This includes width and height of the whole image, border-size of the symbols, and line width of the edges between the symbols."
],
"metadata": {
"collapsed": false,
"pycharm": {
"name": "#%% md\n"
}
}
},
{
"cell_type": "code",
"execution_count": 3,
"outputs": [
{
"data": {
"text/plain": "<PIL.Image.Image image mode=RGB size=1500x450>",
"image/png": "iVBORw0KGgoAAAANSUhEUgAABdwAAAHCCAIAAAB6xJzLAAAeHklEQVR4nO3d3ZaiShKAUZx13v+VnQssGv8QkcyIzNz7YlafHguxqkH4KsDL9XqdAAAAAKjrf9ErAAAAADAiUQYAAAAggCgDAAAAEECUAQAAAAggygAAAAAEEGUAAAAAAogyAAAAAAFEGQAAAIAAogwAAABAAFEGAAAAIIAoAwAAABBAlAEAAAAIIMoAAAAABBBlAAAAAAKIMgAAAAABRBkAAACAAKIMAAAAQABRBgAAACCAKAMAAAAQQJQBAAAACCDKAAAAAAQQZQAAAAACiDIAAAAAAUQZAAAAgAD/Ra8AAAAADORyuUSvwmvX6zV6FYZjUgYAAAAggEkZAAAAqC3VVErW2Z3+mZQBAAAACCDKAAAAAAQQZQAAAAACiDIAAAAAAUQZAAAAgACiDAAAAEAAUQYAAAAggCgDAAAAEECUAQAAAAggygAAAAAEEGUAAAAAAogyAAAAAAFEGQAAAIAAogwAAABAAFEGAAAAIIAoAwAAABBAlAEAAAAI8F/0CgAAAEBXLpfL/Ifr9Rq7JiRnUgYAAABOMxeZOccsdQZeMikDAAAApzEdw36iDAAAAJzJ5Uvs5PIlAAAAONP1enX5EnuIMgAAAHCay+WixbCTKAMAAACnWc/IuHyJbe4pAwAAAGfSYtjJpAwAAABAAJMyAAAAUJBbzPCOKAMAAACnkWDYT5QBAACAg3YmmPVdZlQbFqIMAAAA7HIgwcAGUQYAAABekGAoTZQBAAAACYYAogwAAADDkWDIQJQBAACgcxIMOYkyAAAAdEWCoRWiDAAAAA2TYGiXKAMAAEAzJBh6IsoAAACQlARD30QZAAAAUpBgGI0oAwAAQAAJBkQZAAAAipNg4JkoAwAAwMkkGNhDlAEAAOAnEgwcI8oAAADwBQkGziLKAAAA8JYEA+WIMgAAANxIMFCTKAMAADAoCSbQvu89nRNlAIDadp4D1OesA/bY2IRtRMlJMJCN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AAAQQJQBAAAACCDKAAAB8txWxg1lAIAoogwAAABAAFEGAIiRYVjGmAwAEEiUAQAAAAggygAAYWKHZYzJAACxRBkAIF79LpPhHsMAwOBEGQAgUuygijEZACCQKAMABKt/EZMLlwCADEQZACBezS6jyAAASYgyAEAKdbqMIgMA5CHKAABZLF2mRJpZFqvIAABJiDIAQCJLMTm3yyxLU2QAgDxEGQAgl3WX+T3NrBeiyAAAqfwXvQIAAI/+rmO6TP/uAvP1QtZBR44BABISZQCApJ7TzN/fv/2S58kaOQYASEuUAUZW5dN3gd+s08xs5zVNcgx84n0QIJgoAwA0YF1YLu+rjBADADTk4tgFAAAAoD6fvgQAAAAQQJQBAAAACCDKAAAAAAQQZQAAAAACiDIAAAAAAXwkNsB3ls/i9el1AADAL0zKAHxhLjJzjlnqzGUlcuUAAICmmJQBOGIZk3mZaQAAAD4SZQC+tg4x7/4GAABgm8uXAL62nou5Xq8PUzMAAAB7iDIAPzEjAwAAHHNxIgHwlYdPX1pPx9ijAgAA+4kyAAAAAAFcvgQAAAAQQJQBAAAACCDKAAAAAAQQZQAAAAACiDIAAAAAAUQZAAAAgACiDAAAAEAAUQYAAAAggCgDAAAAEECUAQAAAAjwf1DDU1LMf0mEAAAAAElFTkSuQmCC\n"
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"display(glycan.create_snfg_img(\"files/viz_snfg.png\", width=300, height=100))"
],
"metadata": {
"collapsed": false,
"pycharm": {
"name": "#%%\n"
}
}
},
{
"cell_type": "markdown",
"source": [
Expand Down Expand Up @@ -182,4 +143,4 @@
},
"nbformat": 4,
"nbformat_minor": 1
}
}
5 changes: 2 additions & 3 deletions glyles/__main__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import os
import sys
import argparse
import pkg_resources


from glyles import convert
from glyles.version import __version__


def parse_args(args):
Expand Down Expand Up @@ -40,7 +39,7 @@ def parse_args(args):
"-v",
"--version",
action="version",
version=f"%(prog)s {pkg_resources.get_distribution('glyles').version}"
version=f"%(prog)s {__version__}"
)
return vars(parser.parse_args(args))

Expand Down
3 changes: 3 additions & 0 deletions glyles/glycans/factory/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
from glyles.glycans.utils import Config, Enantiomer, Lactole
from glyles.grammar.GlycanLexer import GlycanLexer

if not hasattr(GlycanLexer, "MOD"):
GlycanLexer.MOD = GlycanLexer.QMARK + 1


class MonomerFactory:
"""
Expand Down
6 changes: 3 additions & 3 deletions glyles/glycans/factory/factory_o.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def check_for_acid(start, structure, adjacency, a_type):
Returns:
bool flag indicating if the carbon atom has an acid group
"""
oxys = [int(x) for x in np.where((adjacency[start] != 0) & (a_type == 8))[0]]
oxys = [int(x) for x in np.where(np.array(adjacency[start] != 0) & (a_type == 8))[0]]
if len(oxys) != 2:
return False
if (structure.GetBondBetweenAtoms(int(start), oxys[0]).GetBondType() == BondType.SINGLE and
Expand All @@ -216,7 +216,7 @@ def check_for_acid(start, structure, adjacency, a_type):


def check_for_co_double(carbon, structure, adjacency, a_type):
oxys = [int(x) for x in np.where((adjacency[carbon] != 0) & (a_type == 8))[0]]
oxys = [int(x) for x in np.where(np.array(adjacency[carbon] != 0) & (a_type == 8))[0]]
return sum(structure.GetBondBetweenAtoms(int(carbon), o).GetBondType() == BondType.DOUBLE for o in oxys) == 1


Expand All @@ -232,4 +232,4 @@ def check_for_aldehyd(start, adjacency, a_type):
Returns:
bool flag indicating if the carbon atom has an aldehyd group
"""
return len(np.where((adjacency[start] == 1) & (a_type == 8))[0]) != 0
return len(np.where(np.array(adjacency[start] == 1) & (a_type == 8))[0]) != 0
37 changes: 16 additions & 21 deletions glyles/glycans/mono/enum_c.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ def enumerate_carbon(monomer):

# then iterate over all those carbons and enumerate them beginning at C1
for c_id in range(1, next_c_id):
c_index = int(np.where(monomer.x[:, 1] == c_id)[0])
candidates = np.where((monomer.adjacency[c_index, :] != 0) & (monomer.x[:, 1] == 0))[0]
c_index = np.where(monomer.x[:, 1] == c_id)[0].item()
candidates = np.where(np.array(monomer.adjacency[c_index, :] != 0) & (monomer.x[:, 1] == 0))[0]
if candidates.size != 0:
for candidate in list(candidates):
if sum(monomer.adjacency[candidate, :]) > 1:
Expand All @@ -51,7 +51,7 @@ def enumerate_side_chain(monomer, parent, atom, next_c_id):
next_c_id += 1

# identify children
candidates = np.where((monomer.adjacency[atom, :] != 0) & (monomer.x[:, 1] == 0))[0].tolist()
candidates = np.where(np.array(monomer.adjacency[atom, :] != 0) & (monomer.x[:, 1] == 0))[0].tolist()
if parent in candidates:
candidates.remove(parent)

Expand Down Expand Up @@ -85,10 +85,10 @@ def enumerate_c_atoms(monomer, c_atoms, ringo):
stack = stack[:-1]
c_tree.add_node(c_id, p_id)

children = np.where((monomer.adjacency[c_id, :] == 1) & (monomer.x[:, 0] == 6) & (monomer.x[:, 3] == 1))[0]
children = np.where(np.array(monomer.adjacency[c_id, :] == 1) & (monomer.x[:, 0] == 6) & (monomer.x[:, 3] == 1))[0]
for c in children:
if int(c) not in c_tree.nodes:
stack.append((c_id, int(c)))
if c.item() not in c_tree.nodes:
stack.append((c_id, c.item()))

# find the deepest node and rehang the tree to this node
deepest_id, _ = c_tree.deepest_node()
Expand All @@ -100,14 +100,9 @@ def enumerate_c_atoms(monomer, c_atoms, ringo):
start, end = longest_c_chain[0], longest_c_chain[-1]

# check conditions
"""start_o_conn, end_o_conn = \
np.argwhere((monomer.adjacency[start, :] == 1) & np.in1d(monomer.x[:, 0], [7, 8]) & (monomer.x[:, 2] != 1) &
(monomer.x[:, 3] == 1)).squeeze().size > 0, \
np.argwhere((monomer.adjacency[end, :] == 1) & np.in1d(monomer.x[:, 0], [7, 8]) & (monomer.x[:, 2] != 1) &
(monomer.x[:, 3] == 1)).squeeze().size > 0"""
start_o_conn = np.argwhere((monomer.adjacency[start, :] == 1) & np.in1d(monomer.x[:, 0], [7, 8]) &
start_o_conn = np.argwhere(np.array(monomer.adjacency[start, :] == 1) & np.isin(monomer.x[:, 0], [7, 8]) &
(monomer.x[:, 2] != 1)).squeeze().size > 0
end_o_conn = np.argwhere((monomer.adjacency[end, :] == 1) & np.in1d(monomer.x[:, 0], [7, 8]) &
end_o_conn = np.argwhere(np.array(monomer.adjacency[end, :] == 1) & np.isin(monomer.x[:, 0], [7, 8]) &
(monomer.x[:, 2] != 1)).squeeze().size > 0

# decide on c1
Expand Down Expand Up @@ -168,19 +163,19 @@ def equidistant(monomer, start, end):
Bool indicating that the start id is the C1 atom
"""
# determine first carbon atom in the ring
c_start_candidates = np.where((monomer.adjacency[start, :] == 1) &
c_start_candidates = np.where(np.array(monomer.adjacency[start, :] == 1) &
(monomer.x[:, 0] == 6) & (monomer.x[:, 2] & 0b1))[0]
c_end_candidates = np.where((monomer.adjacency[end, :] == 1) & (monomer.x[:, 0] == 6) & (monomer.x[:, 2] & 0b1))[0]
c_end_candidates = np.where(np.array(monomer.adjacency[end, :] == 1) & (monomer.x[:, 0] == 6) & (monomer.x[:, 2] & 0b1))[0]

if c_start_candidates.size == 1 and c_end_candidates.size == 1:
start_ring_c = int(c_start_candidates)
end_ring_c = int(c_end_candidates)
start_ring_c = c_start_candidates.item()
end_ring_c = c_end_candidates.item()

# check if those ring carbons have an attached oxygen
start_ring_c_o_candidates = np.where((monomer.adjacency[start_ring_c, :] == 1) &
np.in1d(monomer.x[:, 0], [7, 8]) & (monomer.x[:, 2] != 1))[0]
end_ring_c_o_candidates = np.where((monomer.adjacency[end_ring_c, :] == 1) &
np.in1d(monomer.x[:, 0], [7, 8]) & (monomer.x[:, 2] != 1))[0]
start_ring_c_o_candidates = np.where(np.array(monomer.adjacency[start_ring_c, :] == 1) &
np.isin(monomer.x[:, 0], [7, 8]) & (monomer.x[:, 2] != 1))[0]
end_ring_c_o_candidates = np.where(np.array(monomer.adjacency[end_ring_c, :] == 1) &
np.isin(monomer.x[:, 0], [7, 8]) & (monomer.x[:, 2] != 1))[0]

if start_ring_c_o_candidates.size == 1 and end_ring_c_o_candidates.size == 1:
raise UnreachableError("C1 atom cannot be detected")
Expand Down
Loading

0 comments on commit af33f3f

Please sign in to comment.