1 | #! /usr/bin/env python |
||
2 | # |
||
3 | # Copyright (C) 2015-2016 Rich Lewis <[email protected]> |
||
4 | # License: 3-clause BSD |
||
5 | |||
6 | 1 | """ |
|
7 | ## skchem.descriptors.atom |
||
8 | |||
9 | Module specifying atom based descriptor generators. |
||
10 | """ |
||
11 | |||
12 | 1 | import functools |
|
13 | 1 | from abc import ABCMeta |
|
14 | |||
15 | 1 | import pandas as pd |
|
0 ignored issues
–
show
|
|||
16 | 1 | import numpy as np |
|
0 ignored issues
–
show
The import
numpy could not be resolved.
This can be caused by one of the following: 1. Missing DependenciesThis 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 filesThis error could also result from missing ![]() |
|||
17 | |||
18 | 1 | from rdkit import Chem |
|
0 ignored issues
–
show
The import
rdkit could not be resolved.
This can be caused by one of the following: 1. Missing DependenciesThis 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 filesThis error could also result from missing ![]() |
|||
19 | 1 | from rdkit.Chem import Crippen |
|
0 ignored issues
–
show
The import
rdkit.Chem could not be resolved.
This can be caused by one of the following: 1. Missing DependenciesThis 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 filesThis error could also result from missing ![]() |
|||
20 | 1 | from rdkit.Chem import Lipinski |
|
0 ignored issues
–
show
The import
rdkit.Chem could not be resolved.
This can be caused by one of the following: 1. Missing DependenciesThis 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 filesThis error could also result from missing ![]() |
|||
21 | 1 | from rdkit.Chem import rdMolDescriptors, rdPartialCharges |
|
0 ignored issues
–
show
The import
rdkit.Chem could not be resolved.
This can be caused by one of the following: 1. Missing DependenciesThis 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 filesThis error could also result from missing ![]() |
|||
22 | 1 | from rdkit.Chem.rdchem import HybridizationType |
|
0 ignored issues
–
show
The import
rdkit.Chem.rdchem could not be resolved.
This can be caused by one of the following: 1. Missing DependenciesThis 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 filesThis error could also result from missing ![]() |
|||
23 | |||
24 | 1 | from ..core import Mol |
|
25 | 1 | from ..resource import PERIODIC_TABLE, ORGANIC |
|
26 | 1 | from ..base import AtomTransformer, Featurizer |
|
27 | 1 | from ..utils import nanarray |
|
28 | |||
29 | |||
30 | 1 | def element(a): |
|
0 ignored issues
–
show
The name
a does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() |
|||
31 | |||
32 | """ Return the element """ |
||
33 | |||
34 | 1 | return a.GetSymbol() |
|
35 | |||
36 | |||
37 | 1 | def is_element(a, symbol='C'): |
|
0 ignored issues
–
show
The name
a does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() |
|||
38 | |||
39 | """ Is the atom of a given element """ |
||
40 | 1 | return element(a) == symbol |
|
41 | |||
42 | 1 | element_features = {'is_{}'.format(e): functools.partial(is_element, symbol=e) |
|
0 ignored issues
–
show
The name
element_features does not conform to the constant naming conventions ((([A-Z_][A-Z0-9_]*)|(__.*__))$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() |
|||
43 | for e in ORGANIC} |
||
44 | |||
45 | |||
46 | 1 | def is_h_acceptor(a): |
|
0 ignored issues
–
show
The name
a does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() |
|||
47 | |||
48 | """ Is an H acceptor? """ |
||
49 | |||
50 | 1 | m = a.GetOwningMol() |
|
0 ignored issues
–
show
The name
m does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() |
|||
51 | 1 | idx = a.GetIdx() |
|
52 | 1 | return idx in [i[0] for i in Lipinski._HAcceptors(m)] |
|
0 ignored issues
–
show
It seems like
_HAcceptors was declared protected and should not be accessed from this context.
Prefixing a member variable class MyParent:
def __init__(self):
self._x = 1;
self.y = 2;
class MyChild(MyParent):
def some_method(self):
return self._x # Ok, since accessed from a child class
class AnotherClass:
def some_method(self, instance_of_my_child):
return instance_of_my_child._x # Would be flagged as AnotherClass is not
# a child class of MyParent
![]() |
|||
53 | |||
54 | |||
55 | 1 | def is_h_donor(a): |
|
0 ignored issues
–
show
The name
a does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() |
|||
56 | |||
57 | """ Is an H donor? """ |
||
58 | |||
59 | 1 | m = a.GetOwningMol() |
|
0 ignored issues
–
show
The name
m does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() |
|||
60 | 1 | idx = a.GetIdx() |
|
61 | 1 | return idx in [i[0] for i in Lipinski._HDonors(m)] |
|
0 ignored issues
–
show
It seems like
_HDonors was declared protected and should not be accessed from this context.
Prefixing a member variable class MyParent:
def __init__(self):
self._x = 1;
self.y = 2;
class MyChild(MyParent):
def some_method(self):
return self._x # Ok, since accessed from a child class
class AnotherClass:
def some_method(self, instance_of_my_child):
return instance_of_my_child._x # Would be flagged as AnotherClass is not
# a child class of MyParent
![]() |
|||
62 | |||
63 | |||
64 | 1 | def is_hetero(a): |
|
0 ignored issues
–
show
The name
a does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() |
|||
65 | |||
66 | """ Is a heteroatom? """ |
||
67 | |||
68 | 1 | m = a.GetOwningMol() |
|
0 ignored issues
–
show
The name
m does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() |
|||
69 | 1 | idx = a.GetIdx() |
|
70 | 1 | return idx in [i[0] for i in Lipinski._Heteroatoms(m)] |
|
0 ignored issues
–
show
It seems like
_Heteroatoms was declared protected and should not be accessed from this context.
Prefixing a member variable class MyParent:
def __init__(self):
self._x = 1;
self.y = 2;
class MyChild(MyParent):
def some_method(self):
return self._x # Ok, since accessed from a child class
class AnotherClass:
def some_method(self, instance_of_my_child):
return instance_of_my_child._x # Would be flagged as AnotherClass is not
# a child class of MyParent
![]() |
|||
71 | |||
72 | |||
73 | 1 | def atomic_number(a): |
|
0 ignored issues
–
show
The name
a does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() |
|||
74 | |||
75 | """ Atomic number of atom """ |
||
76 | |||
77 | 1 | return a.GetAtomicNum() |
|
78 | |||
79 | |||
80 | 1 | def atomic_mass(a): |
|
0 ignored issues
–
show
The name
a does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() |
|||
81 | |||
82 | """ Atomic mass of atom """ |
||
83 | |||
84 | 1 | return a.atomic_mass |
|
85 | |||
86 | |||
87 | 1 | def explicit_valence(a): |
|
0 ignored issues
–
show
The name
a does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() |
|||
88 | |||
89 | """ Explicit valence of atom """ |
||
90 | 1 | return a.GetExplicitValence() |
|
91 | |||
92 | |||
93 | 1 | def implicit_valence(a): |
|
0 ignored issues
–
show
The name
a does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() |
|||
94 | |||
95 | """ Implicit valence of atom """ |
||
96 | |||
97 | 1 | return a.GetImplicitValence() |
|
98 | |||
99 | |||
100 | 1 | def valence(a): |
|
0 ignored issues
–
show
The name
a does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() |
|||
101 | |||
102 | """ returns the valence of the atom """ |
||
103 | |||
104 | 1 | return explicit_valence(a) + implicit_valence(a) |
|
105 | |||
106 | |||
107 | 1 | def formal_charge(a): |
|
0 ignored issues
–
show
The name
a does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() |
|||
108 | |||
109 | """ Formal charge of atom """ |
||
110 | |||
111 | 1 | return a.GetFormalCharge() |
|
112 | |||
113 | |||
114 | 1 | def is_aromatic(a): |
|
0 ignored issues
–
show
The name
a does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() |
|||
115 | |||
116 | """ Boolean if atom is aromatic""" |
||
117 | |||
118 | 1 | return a.GetIsAromatic() |
|
119 | |||
120 | |||
121 | 1 | def num_implicit_hydrogens(a): |
|
0 ignored issues
–
show
The name
a does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() |
|||
122 | |||
123 | """ Number of implicit hydrogens """ |
||
124 | |||
125 | 1 | return a.GetNumImplicitHs() |
|
126 | |||
127 | |||
128 | 1 | def num_explicit_hydrogens(a): |
|
0 ignored issues
–
show
The name
a does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() |
|||
129 | |||
130 | """ Number of explicit hydrodgens """ |
||
131 | |||
132 | 1 | return a.GetNumExplicitHs() |
|
133 | |||
134 | |||
135 | 1 | def num_hydrogens(a): |
|
0 ignored issues
–
show
The name
a does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() |
|||
136 | |||
137 | """ Number of hydrogens """ |
||
138 | |||
139 | 1 | return num_implicit_hydrogens(a) + num_explicit_hydrogens(a) |
|
140 | |||
141 | |||
142 | 1 | def is_in_ring(a): |
|
0 ignored issues
–
show
The name
a does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() |
|||
143 | |||
144 | """ Whether the atom is in a ring """ |
||
145 | |||
146 | 1 | return a.IsInRing() |
|
147 | |||
148 | |||
149 | 1 | def crippen_log_p_contrib(a): |
|
0 ignored issues
–
show
The name
a does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() |
|||
150 | |||
151 | """ Hacky way of getting logP contribution. """ |
||
152 | |||
153 | 1 | idx = a.GetIdx() |
|
154 | 1 | m = a.GetOwningMol() |
|
0 ignored issues
–
show
The name
m does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() |
|||
155 | 1 | return Crippen._GetAtomContribs(m)[idx][0] |
|
0 ignored issues
–
show
It seems like
_GetAtomContribs was declared protected and should not be accessed from this context.
Prefixing a member variable class MyParent:
def __init__(self):
self._x = 1;
self.y = 2;
class MyChild(MyParent):
def some_method(self):
return self._x # Ok, since accessed from a child class
class AnotherClass:
def some_method(self, instance_of_my_child):
return instance_of_my_child._x # Would be flagged as AnotherClass is not
# a child class of MyParent
![]() |
|||
156 | |||
157 | |||
158 | 1 | def crippen_molar_refractivity_contrib(a): |
|
0 ignored issues
–
show
The name
crippen_molar_refractivity_contrib does not conform to the function naming conventions ([a-z_][a-z0-9_]{2,30}$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() The name
a does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() |
|||
159 | |||
160 | """ Hacky way of getting molar refractivity contribution. """ |
||
161 | |||
162 | 1 | idx = a.GetIdx() |
|
163 | 1 | m = a.GetOwningMol() |
|
0 ignored issues
–
show
The name
m does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() |
|||
164 | 1 | return Crippen._GetAtomContribs(m)[idx][1] |
|
0 ignored issues
–
show
It seems like
_GetAtomContribs was declared protected and should not be accessed from this context.
Prefixing a member variable class MyParent:
def __init__(self):
self._x = 1;
self.y = 2;
class MyChild(MyParent):
def some_method(self):
return self._x # Ok, since accessed from a child class
class AnotherClass:
def some_method(self, instance_of_my_child):
return instance_of_my_child._x # Would be flagged as AnotherClass is not
# a child class of MyParent
![]() |
|||
165 | |||
166 | |||
167 | 1 | def tpsa_contrib(a): |
|
0 ignored issues
–
show
The name
a does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() |
|||
168 | |||
169 | """ Hacky way of getting total polar surface area contribution. """ |
||
170 | |||
171 | 1 | idx = a.GetIdx() |
|
172 | 1 | m = a.GetOwningMol() |
|
0 ignored issues
–
show
The name
m does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() |
|||
173 | 1 | return rdMolDescriptors._CalcTPSAContribs(m)[idx] |
|
0 ignored issues
–
show
It seems like
_CalcTPSAContribs was declared protected and should not be accessed from this context.
Prefixing a member variable class MyParent:
def __init__(self):
self._x = 1;
self.y = 2;
class MyChild(MyParent):
def some_method(self):
return self._x # Ok, since accessed from a child class
class AnotherClass:
def some_method(self, instance_of_my_child):
return instance_of_my_child._x # Would be flagged as AnotherClass is not
# a child class of MyParent
![]() |
|||
174 | |||
175 | |||
176 | 1 | def labute_asa_contrib(a): |
|
0 ignored issues
–
show
The name
a does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() |
|||
177 | |||
178 | """ Hacky way of getting accessible surface area contribution. """ |
||
179 | |||
180 | 1 | idx = a.GetIdx() |
|
181 | 1 | m = a.GetOwningMol() |
|
0 ignored issues
–
show
The name
m does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() |
|||
182 | 1 | return rdMolDescriptors._CalcLabuteASAContribs(m)[0][idx] |
|
0 ignored issues
–
show
It seems like
_CalcLabuteASAContribs was declared protected and should not be accessed from this context.
Prefixing a member variable class MyParent:
def __init__(self):
self._x = 1;
self.y = 2;
class MyChild(MyParent):
def some_method(self):
return self._x # Ok, since accessed from a child class
class AnotherClass:
def some_method(self, instance_of_my_child):
return instance_of_my_child._x # Would be flagged as AnotherClass is not
# a child class of MyParent
![]() |
|||
183 | |||
184 | |||
185 | 1 | def gasteiger_charge(a, force_calc=False): |
|
0 ignored issues
–
show
The name
a does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() |
|||
186 | |||
187 | """ Hacky way of getting gasteiger charge """ |
||
188 | |||
189 | 1 | res = a.props.get('_GasteigerCharge', None) |
|
190 | 1 | if res and not force_calc: |
|
191 | return float(res) |
||
192 | else: |
||
193 | 1 | m = a.GetOwningMol() |
|
0 ignored issues
–
show
The name
m does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() |
|||
194 | 1 | rdPartialCharges.ComputeGasteigerCharges(m) |
|
195 | 1 | return float(a.props['_GasteigerCharge']) |
|
196 | |||
197 | |||
198 | 1 | def pauling_electronegativity(a): |
|
0 ignored issues
–
show
The name
a does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() 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. ![]() |
|||
199 | |||
200 | 1 | return a.pauling_electronegativity |
|
201 | |||
202 | |||
203 | 1 | def first_ionization(a): |
|
0 ignored issues
–
show
The name
a does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() 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. ![]() |
|||
204 | |||
205 | 1 | return PERIODIC_TABLE.loc[a.atomic_number, 'first_ionisation_energy'] |
|
206 | |||
207 | |||
208 | 1 | def group(a): |
|
0 ignored issues
–
show
The name
a does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() 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. ![]() |
|||
209 | |||
210 | 1 | return PERIODIC_TABLE.loc[a.atomic_number, 'group'] |
|
211 | |||
212 | |||
213 | 1 | def period(a): |
|
0 ignored issues
–
show
The name
a does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() 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. ![]() |
|||
214 | |||
215 | 1 | return PERIODIC_TABLE.loc[a.atomic_number, 'period'] |
|
216 | |||
217 | |||
218 | 1 | def is_hybridized(a, hybrid_type=HybridizationType.SP3): |
|
0 ignored issues
–
show
The name
a does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() |
|||
219 | |||
220 | """ Hybridized as type hybrid_type, default SP3 """ |
||
221 | |||
222 | 1 | return str(a.GetHybridization()) == str(hybrid_type) |
|
223 | |||
224 | 1 | hybridization_features = {'is_' + n + '_hybridized': functools.partial( |
|
0 ignored issues
–
show
The name
hybridization_features does not conform to the constant naming conventions ((([A-Z_][A-Z0-9_]*)|(__.*__))$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() |
|||
225 | is_hybridized, hybrid_type=n) |
||
226 | for n in HybridizationType.names} |
||
227 | |||
228 | 1 | ATOM_FEATURES = { |
|
229 | 'atomic_number': atomic_number, |
||
230 | 'atomic_mass': atomic_mass, |
||
231 | 'formal_charge': formal_charge, |
||
232 | 'gasteiger_charge': gasteiger_charge, |
||
233 | 'pauling_electronegativity': pauling_electronegativity, |
||
234 | 'first_ionisation': first_ionization, |
||
235 | 'group': group, |
||
236 | 'period': period, |
||
237 | 'valence': valence, |
||
238 | 'is_aromatic': is_aromatic, |
||
239 | 'num_hydrogens': num_hydrogens, |
||
240 | 'is_in_ring': is_in_ring, |
||
241 | 'log_p_contrib': crippen_log_p_contrib, |
||
242 | 'molar_refractivity_contrib': crippen_molar_refractivity_contrib, |
||
243 | 'is_h_acceptor': is_h_acceptor, |
||
244 | 'is_h_donor': is_h_donor, |
||
245 | 'is_heteroatom': is_hetero, |
||
246 | 'total_polar_surface_area_contrib': tpsa_contrib, |
||
247 | 'total_labute_accessible_surface_area': labute_asa_contrib, |
||
248 | } |
||
249 | 1 | ATOM_FEATURES.update(element_features) |
|
250 | 1 | ATOM_FEATURES.update(hybridization_features) |
|
251 | |||
252 | |||
253 | 1 | class AtomFeaturizer(AtomTransformer, Featurizer): |
|
0 ignored issues
–
show
This class 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. ![]() |
|||
254 | |||
255 | 1 | def __init__(self, features='all', n_jobs=1, verbose=True): |
|
256 | 1 | self._features = None |
|
257 | 1 | self.features = features |
|
258 | |||
259 | 1 | super(AtomFeaturizer, self).__init__(n_jobs=n_jobs, verbose=verbose) |
|
260 | |||
261 | 1 | @property |
|
262 | def name(self): |
||
0 ignored issues
–
show
This method 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. ![]() This method could be written as a function/class method.
If a method does not access any attributes of the class, it could also be implemented as a function or static method. This can help improve readability. For example class Foo:
def some_method(self, x, y):
return x + y;
could be written as class Foo:
@classmethod
def some_method(cls, x, y):
return x + y;
![]() |
|||
263 | return 'atom_feat' |
||
264 | |||
265 | 1 | @property |
|
266 | def features(self): |
||
0 ignored issues
–
show
This method 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. ![]() |
|||
267 | 1 | return self._features |
|
268 | |||
269 | 1 | View Code Duplication | @features.setter |
0 ignored issues
–
show
|
|||
270 | def features(self, features): |
||
0 ignored issues
–
show
This method 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. ![]() |
|||
271 | 1 | if isinstance(features, str): |
|
272 | 1 | if features == 'all': |
|
273 | 1 | features = ATOM_FEATURES |
|
274 | else: |
||
275 | features = {features: ATOM_FEATURES[features]} |
||
276 | elif isinstance(features, list): |
||
277 | features = {feature: ATOM_FEATURES[feature] |
||
278 | for feature in features} |
||
279 | elif isinstance(features, (dict, pd.Series)): |
||
280 | features = features |
||
281 | else: |
||
282 | raise NotImplementedError('Cannot use features {}'.format( |
||
283 | features)) |
||
284 | |||
285 | 1 | self._features = pd.Series(features) |
|
286 | 1 | self._features.index.name = 'atom_features' |
|
287 | |||
288 | 1 | @property |
|
289 | def minor_axis(self): |
||
290 | 1 | return self.features.index |
|
291 | |||
292 | 1 | def _transform_atom(self, atom): |
|
293 | 1 | return self.features.apply(lambda f: f(atom)).values |
|
0 ignored issues
–
show
|
|||
294 | |||
295 | 1 | def _transform_mol(self, mol): |
|
296 | 1 | return np.array([self.transform(a) for a in mol.atoms]) |
|
297 | |||
298 | |||
299 | 1 | class DistanceTransformer(AtomTransformer, Featurizer): |
|
300 | |||
301 | """ Base class implementing Distance Matrix transformers. |
||
302 | |||
303 | Concrete classes inheriting from this should implement `_transform_mol`. |
||
304 | """ |
||
305 | |||
306 | 1 | __metaclass__ = ABCMeta |
|
307 | |||
308 | 1 | @property |
|
309 | def minor_axis(self): |
||
310 | return pd.RangeIndex(self.max_atoms, name='atom_idx') |
||
311 | |||
312 | 1 | def _transform_atom(self, atom): |
|
313 | return NotImplemented |
||
314 | |||
315 | 1 | def transform(self, mols): |
|
316 | res = super(DistanceTransformer, self).transform(mols) |
||
317 | if isinstance(mols, Mol): |
||
318 | res = res.iloc[:len(mols.atoms), :len(mols.atoms)] |
||
319 | return res |
||
320 | |||
321 | |||
322 | 1 | View Code Duplication | class SpacialDistanceTransformer(DistanceTransformer): |
0 ignored issues
–
show
|
|||
323 | |||
324 | """ Transformer class for generating 3D distance matrices. """ |
||
325 | |||
326 | # TODO: handle multiple conformers |
||
0 ignored issues
–
show
|
|||
327 | |||
328 | 1 | def __init__(self, n_jobs=1, verbose=True): |
|
329 | |||
330 | """ Initialize a SpacialDistanceTransformer. |
||
331 | |||
332 | Args: |
||
333 | n_jobs (int): |
||
334 | The number of processes to run the featurizer in. |
||
335 | verbose (bool): |
||
336 | Whether to output a progress bar. |
||
337 | """ |
||
338 | super(SpacialDistanceTransformer, self).__init__(n_jobs=n_jobs, |
||
339 | verbose=verbose) |
||
340 | |||
341 | 1 | @property |
|
342 | def name(self): |
||
0 ignored issues
–
show
This method 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. ![]() This method could be written as a function/class method.
If a method does not access any attributes of the class, it could also be implemented as a function or static method. This can help improve readability. For example class Foo:
def some_method(self, x, y):
return x + y;
could be written as class Foo:
@classmethod
def some_method(cls, x, y):
return x + y;
![]() |
|||
343 | return 'spacial_dist' |
||
344 | |||
345 | 1 | def _transform_mol(self, mol): |
|
346 | res = nanarray((len(mol.atoms), self.max_atoms)) |
||
347 | res[:, :len(mol.atoms)] = Chem.Get3DDistanceMatrix(mol) |
||
348 | return res |
||
349 | |||
350 | |||
351 | 1 | View Code Duplication | class GraphDistanceTransformer(DistanceTransformer): |
0 ignored issues
–
show
|
|||
352 | |||
353 | """ Transformer class for generating Graph distance matrices. """ |
||
354 | |||
355 | 1 | def __init__(self, n_jobs=1, verbose=True): |
|
356 | |||
357 | """ Initialize a GraphDistanceTransformer. |
||
358 | |||
359 | Args: |
||
360 | n_jobs (int): |
||
361 | The number of processes to run the featurizer in. |
||
362 | verbose (bool): |
||
363 | Whether to output a progress bar. |
||
364 | """ |
||
365 | |||
366 | super(GraphDistanceTransformer, self).__init__(n_jobs=n_jobs, |
||
367 | verbose=verbose) |
||
368 | |||
369 | 1 | @property |
|
370 | def name(self): |
||
0 ignored issues
–
show
This method 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. ![]() This method could be written as a function/class method.
If a method does not access any attributes of the class, it could also be implemented as a function or static method. This can help improve readability. For example class Foo:
def some_method(self, x, y):
return x + y;
could be written as class Foo:
@classmethod
def some_method(cls, x, y):
return x + y;
![]() |
|||
371 | return 'graph_dist' |
||
372 | |||
373 | 1 | def _transform_mol(self, mol): |
|
374 | res = nanarray((len(mol.atoms), self.max_atoms)) |
||
375 | res[:len(mol.atoms), :len(mol.atoms)] = Chem.GetDistanceMatrix(mol) |
||
376 | return res |
||
377 |
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.
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.