Hi all,
I'm trying to generate an SVG from reaction SMARTS. The code looks like this:
QByteArray ChemicalReactionsCalculation::toSvg(const QString &reaction, int
width, int height)
{
try
{
std::string text = reaction.toStdString();
std::unique_ptr<RDKit::ChemicalReaction>
rxn(RDKit::RxnSmartsToChemicalReaction(text));
if (rxn)
{
RDKit::MolDraw2DSVG drawer(width, height);
drawer.drawReaction(*rxn);
drawer.finishDrawing();
auto svg = drawer.getDrawingText();
return QByteArray::fromStdString(svg);
}
}
catch (const std::exception &e)
{
qWarning() << "Exception in ChemicalReactionsCalculation::toSvg on" <<
reaction << ":" << e.what();
}
return QByteArray();
}
This works fine for most reaction SMARTS strings, but throws an exception at
"drawer.drawReaction" when the SMARTS string has a combination of Boolean
operators in it. For example, "[n&H1:1]>>[o:1]" works fine, as does
"[c,n:1]>>[O:1]", but doing "[c,n&H1:1]>>[o:1]" fails (as does the equivalent
"[c,nH1:1]>>[o:1]"):
Exception in ChemicalReactionsCalculation::toSvg on "[c,n&H1:1]>>[o:1]" : bad
query type1
This happens for pretty much any combination of "," and "&" operators inside
the square brackets. Any ideas?
Regards,
Mark
Dr Mark Mackey
Chief Scientific Officer
Cresset
New Cambridge House, Bassingbourn Road, Litlington, Cambridgeshire, SG8 0SS, UK
Tel: +44 (0)1223 858890 Mobile: +44 (0)7595099165
Email: [email protected]<mailto:[email protected]> Web:
www.cresset-group.com<http://www.cresset-group.com/>
This email has been sent from Cresset BioMolecular Discovery Limited,
registered in England and Wales, Company Number: 04151475. The information in
this email and any attachments are confidential and may be privileged. It is
intended solely for the addressee and access to this email by anyone else is
unauthorised. If an addressing or transmission error has misdirected this
email, please notify the author by replying to this email. If you are not the
intended recipient you must not use, disclose, distribute, store or copy the
information in any medium. Although this e-mail and any attachments are
believed to be free from any virus or other defect which might affect any
system into which they are opened or received, it is the responsibility of the
recipient to check that they are virus-free and that they will in no way affect
systems and data. No responsibility is accepted by Cresset BioMolecular
Discovery Limited for any loss or damage arising in any way from their receipt,
opening or use. Privacy notice<https://www.cresset-group.com/privacy/>
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss