Completed
Push — master ( 0dd2b7...930115 )
by Rich
25:35 queued 23:48
created

adjacency_matrix()   A

Complexity

Conditions 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1.125

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 6
ccs 1
cts 2
cp 0.5
rs 9.4285
cc 1
crap 1.125
1
#! /usr/bin/env python
2
#
3
# Copyright (C) 2016 Rich Lewis <[email protected]>
4
# License: 3-clause BSD
5
6 1
"""
7
# skchem.features.descriptors.fundamentals
8
9
Fundamental representations for descriptors.
10
"""
11
12
13 1
from rdkit.Chem import rdmolops
0 ignored issues
show
Configuration introduced by
The import rdkit.Chem could not be resolved.

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
14 1
import numpy as np
0 ignored issues
show
Configuration introduced by
The import numpy could not be resolved.

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
15
16 1
from .caching import cache
0 ignored issues
show
Configuration introduced by
Unable to import 'caching' (invalid syntax (<string>, line 95))

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
17 1
from ...core import Mol
18
19
20 1
@cache
21 1
def atom_props(mol, prop_name='unweighted', c_scaled=False):
22
23
    """ Atom based properties."""
24
25 1
    if prop_name == 'unweighted':
26
        return np.ones(len(mol.atoms))
27
    else:
28 1
        props = getattr(mol.atoms, prop_name)
29 1
        if c_scaled:
30 1
            props /= getattr(Mol.from_smiles('CC').atoms[0], prop_name)
0 ignored issues
show
Bug introduced by
The Class Mol does not seem to have a member named from_smiles.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
31 1
        return props
32
33
34
35
36 1
@cache
37
def distance_matrix(mol):
38
39
    """ The topological distance matrix. """
40
41 1
    return rdmolops.GetDistanceMatrix(mol)
42
43
44 1
@cache
45
def adjacency_matrix(mol):
46
47
    """ The topological adjacency matrix. """
48
49
    return rdmolops.GetAdjacencyMatrix(mol)
50
51
52 1
@cache
53
def bond_order_adjacency_matrix(mol):
54
55
    """ The bond order scaled topological adjacency matrix. """
56
    return rdmolops.GetAdjacencyMatrix(mol, useBO=1)
57
58
59
# probably this anymore (props, degrees)
60 1
@cache
61
def degrees(mol):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
62
63
    return mol.atoms.degree
64
65
66 1
@cache
67 1
def geometric_matrix(mol, conformer=-1):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
68
    return rdmolops.Get3DDistanceMatrix(mol, confId=conformer)
69
70
71 1
@cache
72 1
def molecular_matrix(mol, conformer=-1):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
73
    return mol.conformers[conformer].positions
74
75
76 1
__all__ = ['distance_matrix', 'adjacency_matrix',
77
           'bond_order_adjacency_matrix', 'degrees', 'geometric_matrix',
78
           'molecular_matrix']
0 ignored issues
show
Coding Style introduced by
Final newline missing
Loading history...