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

rdkit version and warning #16

Open
sonjaleo opened this issue Nov 24, 2021 · 5 comments
Open

rdkit version and warning #16

sonjaleo opened this issue Nov 24, 2021 · 5 comments
Assignees

Comments

@sonjaleo
Copy link
Owner

Because of the RDKit version 2020.03.3 used in KinFragLib, a warning is showing up
<frozen importlib._bootstrap>:219: RuntimeWarning: to-Python converter for boost::shared_ptr<RDKit::FilterCatalogEntry const> already registered; second conversion method ignored.
When updating RDKit to the current version, this warning disappears.
Actually, when updating RDKit, there occurs another problem with the pandas DataFrames in notebooks/custom_kinfraglib/1_1_custom_filters_unwanted_substructures.ipynb

I also found this warning in

@dominiquesydow
Copy link
Collaborator

Actually, when updating RDKit, there occurs another problem with the pandas DataFrames in notebooks/custom_kinfraglib/1_1_custom_filters_unwanted_substructures.ipynb

What kind of problem occurs in this case?

@sonjaleo
Copy link
Owner Author

Actually, when updating RDKit, there occurs another problem with the pandas DataFrames in notebooks/custom_kinfraglib/1_1_custom_filters_unwanted_substructures.ipynb

What kind of problem occurs in this case?

It cannot display any pandas DataFrames anymore.
I can check later what kind of error message is shown when trying to access a DataFrame.

@sonjaleo
Copy link
Owner Author

After doing it again and checking the web again, I found that you already had that problem in TeachOpenCadd
https://githubmemory.com/repo/volkamerlab/teachopencadd/issues/131

`---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
~/.local/lib/python3.8/site-packages/IPython/core/formatters.py in call(self, obj)
700 type_pprinters=self.type_printers,
701 deferred_pprinters=self.deferred_printers)
--> 702 printer.pretty(obj)
703 printer.flush()
704 return stream.getvalue()

~/.local/lib/python3.8/site-packages/IPython/lib/pretty.py in pretty(self, obj)
392 if cls is not object
393 and callable(cls.dict.get('repr')):
--> 394 return _repr_pprint(obj, self, cycle)
395
396 return _default_pprint(obj, self, cycle)

~/.local/lib/python3.8/site-packages/IPython/lib/pretty.py in repr_pprint(obj, p, cycle)
698 """A pprint that just redirects to the normal repr function."""
699 # Find newlines and replace them with p.break
()
--> 700 output = repr(obj)
701 lines = output.splitlines()
702 with p.group():

~/anaconda3/envs/kinfraglib/lib/python3.8/site-packages/pandas/core/frame.py in repr(self)
993 else:
994 width = None
--> 995 self.to_string(
996 buf=buf,
997 max_rows=max_rows,

~/anaconda3/envs/kinfraglib/lib/python3.8/site-packages/pandas/core/frame.py in to_string(self, buf, columns, col_space, header, index, na_rep, formatters, float_format, sparsify, index_names, justify, max_rows, min_rows, max_cols, show_dimensions, decimal, line_width, max_colwidth, encoding)
1129 decimal=decimal,
1130 )
-> 1131 return fmt.DataFrameRenderer(formatter).to_string(
1132 buf=buf,
1133 encoding=encoding,

~/anaconda3/envs/kinfraglib/lib/python3.8/site-packages/pandas/io/formats/format.py in to_string(self, buf, encoding, line_width)
1051
1052 string_formatter = StringFormatter(self.fmt, line_width=line_width)
-> 1053 string = string_formatter.to_string()
1054 return save_to_buffer(string, buf=buf, encoding=encoding)
1055

~/anaconda3/envs/kinfraglib/lib/python3.8/site-packages/pandas/io/formats/string.py in to_string(self)
23
24 def to_string(self) -> str:
---> 25 text = self._get_string_representation()
26 if self.fmt.should_show_dimensions:
27 text = "".join([text, self.fmt.dimensions_info])

~/anaconda3/envs/kinfraglib/lib/python3.8/site-packages/pandas/io/formats/string.py in _get_string_representation(self)
38 return self._empty_info_line
39
---> 40 strcols = self._get_strcols()
41
42 if self.line_width is None:

~/anaconda3/envs/kinfraglib/lib/python3.8/site-packages/pandas/io/formats/string.py in _get_strcols(self)
29
30 def _get_strcols(self) -> list[list[str]]:
---> 31 strcols = self.fmt.get_strcols()
32 if self.fmt.is_truncated:
33 strcols = self._insert_dot_separators(strcols)

~/anaconda3/envs/kinfraglib/lib/python3.8/site-packages/pandas/io/formats/format.py in get_strcols(self)
538 Render a DataFrame to a list of columns (as lists of strings).
539 """
--> 540 strcols = self._get_strcols_without_index()
541
542 if self.index:

~/anaconda3/envs/kinfraglib/lib/python3.8/site-packages/pandas/io/formats/format.py in _get_strcols_without_index(self)
802 int(self.col_space.get(c, 0)), *(self.adj.len(x) for x in cheader)
803 )
--> 804 fmt_values = self.format_col(i)
805 fmt_values = _make_fixed_width(
806 fmt_values, self.justify, minimum=header_colwidth, adj=self.adj

~/anaconda3/envs/kinfraglib/lib/python3.8/site-packages/pandas/io/formats/format.py in format_col(self, i)
816 frame = self.tr_frame
817 formatter = self._get_formatter(i)
--> 818 return format_array(
819 frame.iloc[:, i]._values,
820 formatter,

~/anaconda3/envs/kinfraglib/lib/python3.8/site-packages/pandas/io/formats/format.py in format_array(values, formatter, float_format, na_rep, digits, space, justify, decimal, leading_space, quoting)
1238 )
1239
-> 1240 return fmt_obj.get_result()
1241
1242

~/anaconda3/envs/kinfraglib/lib/python3.8/site-packages/pandas/io/formats/format.py in get_result(self)
1269
1270 def get_result(self) -> list[str]:
-> 1271 fmt_values = self._format_strings()
1272 return _make_fixed_width(fmt_values, self.justify)
1273

~/anaconda3/envs/kinfraglib/lib/python3.8/site-packages/pandas/io/formats/format.py in _format_strings(self)
1332 for i, v in enumerate(vals):
1333 if not is_float_type[i] and leading_space:
-> 1334 fmt_values.append(f" {_format(v)}")
1335 elif is_float_type[i]:
1336 fmt_values.append(float_format(v))

~/anaconda3/envs/kinfraglib/lib/python3.8/site-packages/pandas/io/formats/format.py in _format(x)
1312 else:
1313 # object dtype
-> 1314 return str(formatter(x))
1315
1316 vals = extract_array(self.values, extract_numpy=True)

~/anaconda3/envs/kinfraglib/lib/python3.8/site-packages/pandas/io/formats/printing.py in pprint_thing(thing, _nest_lvl, escape_chars, default_escapes, quote_strings, max_seq_items)
231 result = f"'{as_escaped_string(thing)}'"
232 else:
--> 233 result = as_escaped_string(thing)
234
235 return result

~/anaconda3/envs/kinfraglib/lib/python3.8/site-packages/pandas/io/formats/printing.py in as_escaped_string(thing, escape_chars)
207 escape_chars = escape_chars or ()
208
--> 209 result = str(thing)
210 for c in escape_chars:
211 result = result.replace(c, translate[c])

~/anaconda3/envs/kinfraglib/lib/python3.8/site-packages/rdkit/Chem/PandasTools.py in PrintAsBase64PNGString(x, renderer)
381 return svg.toxml()
382 else:
--> 383 data = Draw._moltoimg(x, molSize, highlightAtoms, "", returnPNG=True, kekulize=True)
384 return 'Mol' % _get_image(
385 data)

~/anaconda3/envs/kinfraglib/lib/python3.8/site-packages/rdkit/Chem/Draw/init.py in _moltoimg(mol, sz, highlights, legend, returnPNG, drawOptions, **kwargs)
479 highlightBonds=bondHighlights)
480 else:
--> 481 d2d.DrawMolecule(mc, legend=legend or "", highlightAtoms=highlights or [])
482 d2d.FinishDrawing()
483 if returnPNG:

ValueError: bad query type1`

Did you found a solution for this by now?

@dominiquesydow
Copy link
Collaborator

Can you please provide a minimal example of your problem?

In the issue that you referenced, I think the problem was that some molecules could not be displayed in the grid image, while the rest of the molecules were just fine. We did not fix this; we simply decided to display only those molecules that were not problematic.

@sonjaleo
Copy link
Owner Author

Can you please provide a minimal example of your problem?

In the issue that you referenced, I think the problem was that some molecules could not be displayed in the grid image, while the rest of the molecules were just fine. We did not fix this; we simply decided to display only those molecules that were not problematic.

Just load the environment, update rdkit (I used the newest version 2021.09.2) and then run notebooks/custom_kinfraglib/1_1_custom_filters_unwanted_substructures.ipynb
After trying to display the Brenk structures, it crashes.

You are right, it does not seem to be a problem with only this one structure. I tried it after removing this structure, but the error is still there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants