Skip to content

Commit

Permalink
headless fragmentor error fixed for small or bondless molecules.
Browse files Browse the repository at this point in the history
fingerprint generation fixed. method renamed.
  • Loading branch information
Ramil Nugmanov committed Nov 24, 2019
1 parent f1718f2 commit 6e14f24
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions CIMtools/preprocessing/fingerprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ def fit(self, x, y=None):
return self

def transform(self, x):
x = self._transform_bitset(x)
x = self.transform_bitset(x)
out = zeros((len(x), 2 ** self.fingerprint_size), dtype=bool8)
for i, j in enumerate(x):
out[i, j] = True
return out

def _transform_bitset(self, x):
def transform_bitset(self, x):
x = iter2array(x, dtype=(MoleculeContainer, CGRContainer))
mask = 2 ** self.fingerprint_size - 1
fp_count = self.bits_count
Expand All @@ -109,7 +109,7 @@ def _transform_bitset(self, x):
for r in range(0, fp_active, 2)] + prev

out = []
for s, row in zip(x, df.itertuples(index=False)):
for s, (_, row) in zip(x, df.iterrows()):
active_bits = set()
# add atomic bits
if isinstance(s, MoleculeContainer):
Expand Down
10 changes: 5 additions & 5 deletions CIMtools/preprocessing/fragmentor.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,14 +345,14 @@ def __parse_header(header):
head_dict = {int(k[:-1]): v for k, v in (i.split() for i in head_dump.splitlines())}
except ValueError as e:
raise ConfigurationError from e
if not head_dict:
raise ConfigurationError('empty header')

return head_dict

def __load_header(self, header):
self.__head_dict = self.__parse_header(header)
self.__head_dump = self.__format_header(self.__head_dict)
head_dict = self.__parse_header(header)
if not head_dict:
raise ConfigurationError('empty header')
self.__head_dict = head_dict
self.__head_dump = self.__format_header(head_dict)

def __prepare_header(self):
if not self.__head_exec:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from wheel.bdist_wheel import bdist_wheel


version = '4.0.0'
version = '4.0.1'

platform = get_platform()
if platform == 'win-amd64':
Expand Down

0 comments on commit 6e14f24

Please sign in to comment.