Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixdocs #43

Merged
merged 3 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@ jobs:
- name: Run docs
run: |
mkdir -p docs/source/_static
sphinx-build -E -b html docs/source/ docs/build/html
sphinx-build -WnE -b html docs/source/ docs/build/html
13 changes: 10 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,17 @@ Martini 3 Benzene
# Draw molecule at different resolutions
ax, pos = draw_molecule(mol_graph)

Resources
=========
Installation
============

- here go some resources
The easiest ways to install **cgsmiles** is using pip:

.. code:: bash

pip install git+https://github.com/gruenewald-lab/CGsmiles.git

In the future we will also distribute it through the Pypi
package index but that is currently not supported.

Related Tools
=============
Expand Down
6 changes: 3 additions & 3 deletions cgsmiles/cgsmiles_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ def find_open_bonds(molecule, target_nodes=None):

Parameters
----------
molecule: nx.Graph
target_nodes: list[abc.hashable]
molecule: networkx.Graph
target_nodes: list[collections.abc.Hashable]
a list of node keys matching molecule

Return
Expand Down Expand Up @@ -85,7 +85,7 @@ def read_fragment_cgsmiles(cgsmiles_str,

Returns
-------
nx.Graph
networkx.Graph
the graph of the molecular fragment
"""
mol_graph = read_cgsmiles(cgsmiles_str)
Expand Down
4 changes: 2 additions & 2 deletions cgsmiles/dialects.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ def _parse_dialect_string(string_iterable,

Parameters
----------
string_iterable: iter
string_iterable: :type data: iter
the string or iter object that contains the string
dialect_signature: cls.inspec.Signature
dialect_signature: inspect.Signature
a signature defineing args, kwargs, default values
and types
arg_to_fullname: dict
Expand Down
8 changes: 4 additions & 4 deletions cgsmiles/drawing.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ def draw_molecule(graph,

Parameters
----------
ax: :class:`matplotlib.pyplot.axis`
ax: matplotlib.axes.Axes
mpl axis object
layout_method:
layout_method: str
choice of vespr, vespr_refined, circular
(default: 'vespr_refined')
pos: dict
Expand All @@ -106,7 +106,7 @@ def draw_molecule(graph,
draw an outline around each node
use_weights: bool
color nodes according to weight attribute (default: False)
align_with: str or np.ndarray
align_with: str or :class:`numpy.ndarray`
align the longest distance in molecule with one of x, y, diag
or a custom axis as numpy 2D array
fontsize: float
Expand All @@ -124,7 +124,7 @@ def draw_molecule(graph,

Returns
-------
:class:`matplotlib.pyplot.axis`
matplotlib.axes.Axes
the updated axis object
dict
a dict of positions
Expand Down
18 changes: 9 additions & 9 deletions cgsmiles/drawing_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ def make_edge(p0, p1, bond_order, spacing=0.1, sep=0.0):

Parameters
----------
p0: np.ndarray(2)
p1: np.ndarray(2)
p0: :class:`numpy.ndarray` of shape 2
p1: :class:`numpy.ndarray` of shape 2
bond_order: int
spacing: float
sep: float
Expand Down Expand Up @@ -74,9 +74,9 @@ def make_graph_edges(graph, pos, spacing=0.1, sep=0.2):

Parameters
----------
graph: nx.Graph
graph: networkx.Graph
Graph with bond oder attribute
pos: np.ndarray((2, len(graph)))
pos: :class:`numpy.ndarray` of shape ((2, len(graph)))
2D positions for the nodes
spacing: float
distance between pos and start of edge
Expand Down Expand Up @@ -124,9 +124,9 @@ def make_mapped_edges(graph, plain_edges):

Parameters
----------
graph: nx.Graph
graph: networkx.Graph
graph of the molecule with 'fragid' attribute
plain_edges: dict[frozenset([abc.hashable])]
plain_edges: dict[frozenset([collections.abc.Hashable])]
dict of edge coordinates indexed by node keys

Returns
Expand Down Expand Up @@ -168,9 +168,9 @@ def make_node_pies(graph,

Parameters
----------
graph: nx.Graph
graph: networkx.Graph
graph of the molecule
pos: dict[np.array]
pos: dict[:class:`numpy.ndarray`]
dict of 2D node positions
cgmapping: bool
if the drawing includes a cgmapping;
Expand All @@ -189,7 +189,7 @@ def make_node_pies(graph,

Yields
------
np.array, dict
:class:`numpy.ndarray`, dict
array slices and keyword arguments to be given
to mpl.Pie class
"""
Expand Down
12 changes: 6 additions & 6 deletions cgsmiles/graph_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ def vespr_layout(graph, default_bond=1, align_with=None):

Parameters
----------
graph: nx.Graph
graph: networkx.Graph
the molecule to draw
default_bond: float
the default bond length
align_with: np.ndarray
align_with: :class:`numpy.ndarray`
axis to align longest axis with

Returns
Expand Down Expand Up @@ -73,11 +73,11 @@ def circular_layout(graph, radius, align_with=None):

Parameters
----------
graph: nx.Graph
graph: networkx.Graph
the molecule to draw
radius: float
the radius of the circle
align_with: np.ndarray
align_with: :class:`numpy.ndarray`
axis to align longest axis with

Returns
Expand Down Expand Up @@ -116,11 +116,11 @@ def vespr_refined_layout(graph,

Parameters
----------
graph: nx.Graph
graph: networkx.Graph
the molecule to draw
default_bond: float
the default bond length
align_with: np.ndarray
align_with: :class:`numpy.ndarray`
axis to align longest axis with
default_angle: float
the default angle in degrees
Expand Down
26 changes: 13 additions & 13 deletions cgsmiles/graph_layout_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ def rotate_subgraph(graph, anchor, reference, target, points, angle=120):

Parameters
----------
graph: nx.Graph
graph: networkx.Graph
the graph
target: tuple(abc.hashable, abc.hashable)
target: tuple(collections.abc.Hashable, collections.abc.Hashable)
the target edge
points: dict[abc.hashable: np.array]
points: dict[collections.abc.Hashable: :class:`numpy.ndarray`]
the dict of 2D positions
angle: float
the angle to rotate by
Expand Down Expand Up @@ -86,11 +86,11 @@ def find_triplets(graph):

Parameters
----------
graph: nx.Graph
graph: networkx.Graph

Returns
-------
tuple([abc.hashable,abc.hashable,abc.hashable])
tuple([collections.abc.Hashable,collections.abc.Hashable,collections.abc.Hashable])
the node keys corresponding to the triplet
the central node is the common one.
"""
Expand All @@ -115,11 +115,11 @@ def assign_angles(graph, default_angle=120):

Parameters
----------
graph: nx.Graph
graph: networkx.Graph

Returns
-------
tuple([[abc.hashable,abc.hashable,abc.hashable,int])
tuple([[collections.abc.Hashable,collections.abc.Hashable,collections.abc.Hashable,int])
tuple with node keys corresponding to the angle
and the reference angle value
"""
Expand Down Expand Up @@ -161,14 +161,14 @@ def assign_bonds(graph, pos, default_bond=None):

Parameters
----------
graph: nx.Graph
pos: np.ndarray((n,2))
graph: networkx.Graph
pos: :class:`numpy.ndarray` of shape ((n,2))
default_bond: float
default bond distance

Returns
-------
tuple([abc.hashable, abc.hashable, float])
tuple([collections.abc.Hashable, collections.abc.Hashable, float])
tuple of node keys and distance
"""
bonds = []
Expand Down Expand Up @@ -235,7 +235,7 @@ def _optimize_geometry_2D(positions,

Parameters
----------
positions: np.ndarray((n, 2))
positions: :class:`numpy.ndarray` of shape ((n, 2))
the inital positions
atom_to_idx: dict
dict mapping node keys to indices in the position
Expand All @@ -254,7 +254,7 @@ def _optimize_geometry_2D(positions,

Returns
-------
np.ndarray((n, 2)), float
:class:`numpy.ndarray` of shape ((n, 2)), float
the optimized positions and final energy
"""
def target_function(positions):
Expand Down Expand Up @@ -319,7 +319,7 @@ def _generate_circle_coordinates(radius, num_points, center=(0, 0)):

Returns
-------
np.ndarray((num_points, 2))
:class:`numpy.ndarray` of shape ((num_points, 2))
array of the point coordinates
"""
# Generate angles in clockwise order (start at 0 and go to -2π)
Expand Down
12 changes: 6 additions & 6 deletions cgsmiles/graph_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def merge_graphs(source_graph, target_graph, max_node=None):

Parameters
----------
molecule: Molecule
molecule: networkx.Graph
The molecule to merge at the end.

Returns
Expand Down Expand Up @@ -66,9 +66,9 @@ def sort_nodes_by_attr(graph,

Parameters
----------
graph: :class:`nx.Graph`
graph: networkx.Graph
the graph to sort nodes of
sort_attr: `abc.hashable`
sort_attr: collections.abc.Hashable
the attribute to use for sorting
relative_attr: tuple(str, bool)
a list of attributes that are sensetive
Expand All @@ -80,7 +80,7 @@ def sort_nodes_by_attr(graph,

Returns
-------
nx.Graph
networkx.Graph
graph with nodes sorted in correct order
"""
fragids = nx.get_node_attributes(graph, sort_attr)
Expand Down Expand Up @@ -154,9 +154,9 @@ def set_atom_names_atomistic(molecule, meta_graph=None):

Parameters
----------
molecule: nx.Graph
molecule: networkx.Graph
the molecule for which to adjust the atomnames
meta_graph: nx.Graph
meta_graph: networkx.Graph
optional; get the fragments from the meta_graph
attributes which is faster in some cases
"""
Expand Down
8 changes: 4 additions & 4 deletions cgsmiles/linalg_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ def u_vect(vect):

Parameters
----------
vect: np.array
vect: :class:`numpy.ndarray`

Returns
-----------
np.array
:class:`numpy.ndarray`
"""
u_vect = vect/np.linalg.norm(vect)
return u_vect
Expand All @@ -24,8 +24,8 @@ def vector_angle_degrees(v1, v2):

Parameters
----------
v1: np.array
v2: np.array
v1: :class:`numpy.ndarray`
v2: :class:`numpy.ndarray`

Returns
---------
Expand Down
10 changes: 5 additions & 5 deletions cgsmiles/pysmiles_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def compute_mass(input_molecule):

Parameters
----------
molecule: nx.Graph
molecule: networkx.Graph
molecule which must have element specified per node

Returns
Expand Down Expand Up @@ -61,9 +61,9 @@ def rebuild_h_atoms(mol_graph,

Parameters
----------
mol_graph: :class:`nx.Graph`
mol_graph: networkx.Graph
graph describing the full molecule without hydrogen atoms
copy_attrs: list[abc.hashable]
copy_attrs: list[collections.abc.Hashable]
a list of attributes to copy from the parent node to the
hydrogen atom
keep_bonding: bool
Expand Down Expand Up @@ -110,7 +110,7 @@ def annotate_ez_isomers_cgsmiles(molecule):

Parameters
----------
molecule: nx.Graph
molecule: networkx.Graph
The molecule of interest, which must of ez_isomer_pairs
and ez_isomer_class set as node attributes
"""
Expand Down Expand Up @@ -147,7 +147,7 @@ def read_fragment_smiles(smiles_str,

Returns
-------
nx.Graph
networkx.Graph
the graph of the molecular fragment
"""
if smiles_str == 'H':
Expand Down
Loading
Loading