When I want to replicate one of RDKit’s python functions in C++, I go to the
source. RDKit has very readable wrappers that make this a surprisingly nice
approach (many other pieces of software have pretty ugly wrappers, so this is a
major compliment to RDKit).
For this, I think the source is:
https://github.com/rdkit/rdkit/blob/master/Code/GraphMol/Wrap/MolOps.cpp#L483
There is a nice if-else that shows you how to get the behaviors of asMols =
False, then asMols=True. There is obviously a little bit of manipulation to get
the output into python, but hopefully it is clear how one might make a similar
pure C++ function.
-David
> On Apr 11, 2016, at 8:24 AM, Yingfeng Wang <ywang...@gmail.com> wrote:
>
> lgor,
>
> Yes, this version looks good. But, I am wondering whether I can specify
> asMols. I specify asMols in the python version of my tool, so I want to do
> the same thing for getting the same result in my C++ code. Or could you help
> me to confirm that the version you mentioned actually has the same effect as
> asMols = true?
>
> Thanks.
> Yingfeng
>
> On Sun, Apr 10, 2016 at 11:35 PM, Igor Filippov <igor.v.filip...@gmail.com
> <mailto:igor.v.filip...@gmail.com>> wrote:
> Did you want
> std::vector<boost::shared_ptr<ROMol
> <http://rdkit.org/docs/cppapi/classRDKit_1_1ROMol.html>> >
> RDKit::MolOps::getMolFrags ( const ROMol
> <http://rdkit.org/docs/cppapi/classRDKit_1_1ROMol.html> & mol, bool
> sanitizeFrags = true,
> by any chance? This will return a vector of ROMol's which correspond to the
> contiguous fragments.
>
> Igor
>
>
> On Sun, Apr 10, 2016 at 11:04 PM, Yingfeng Wang <ywang...@gmail.com
> <mailto:ywang...@gmail.com>> wrote:
> Greg,
>
> Thanks. In python, I am using GetMolFrags by the following way,
>
> Chem.GetMolFrags(current_modified_mol, asMols=True, sanitizeFrags=False)
>
> However, there is not a version at the link you mentioned allows me to
> specify asMols. Could you please give me more hints?
>
> Thanks.
> Yingfeng
>
> On Sun, Apr 10, 2016 at 10:49 PM, Greg Landrum <greg.land...@gmail.com
> <mailto:greg.land...@gmail.com>> wrote:
>
>
> On Mon, Apr 11, 2016 at 1:35 AM, Yingfeng Wang <ywang...@gmail.com
> <mailto:ywang...@gmail.com>> wrote:
>
> Thanks. Say, the current RWMol object has 10 bonds, so ids of these bonds
> should be from 1-10. Now, I remove one bond. How do I reset all nine bonds
> with ids from 1-9 (if one or two atoms are gone with this bond, I also want
> to reset the ids of these atoms).
>
> You don't need to do that, it happens automatically
>
> In addition, say, there are two fragments after one bond is removed. How do I
> get these two fragments as mols. In python, I can use Chem.GetMolFrags. But
> how do I get my job done in C++?
>
> There are a number of different versions of MolOps::getMolFrags(), pick the
> on that does what you like:
> http://rdkit.org/docs/cppapi/namespaceRDKit_1_1MolOps.html#ad8100d785d32fb3c173b83949766b87b
>
> <http://rdkit.org/docs/cppapi/namespaceRDKit_1_1MolOps.html#ad8100d785d32fb3c173b83949766b87b>
>
> Since the Python and C++ function/method names are often similar to each
> other, a good way to find answers like this is to google for the name of the
> Python function you are looking for and look for the link to the C++
> documentation in the results.
>
> Best,
> -greg
>
>
> ------------------------------------------------------------------------------
> Find and fix application performance issues faster with Applications Manager
> Applications Manager provides deep performance insights into multiple tiers of
> your business applications. It resolves application problems quickly and
> reduces your MTTR. Get your free trial! http://pubads.g.doubleclick.net/
> gampad/clk?id=1444514301&iu=/ca-pub-7940484522588532
> <http://pubads.g.doubleclick.net/gampad/clk?id=1444514301&iu=/ca-pub-7940484522588532>
> _______________________________________________
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> <mailto:Rdkit-discuss@lists.sourceforge.net>
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
> <https://lists.sourceforge.net/lists/listinfo/rdkit-discuss>
>
>
>
> ------------------------------------------------------------------------------
> Find and fix application performance issues faster with Applications Manager
> Applications Manager provides deep performance insights into multiple tiers of
> your business applications. It resolves application problems quickly and
> reduces your MTTR. Get your free trial! http://pubads.g.doubleclick.net/
> gampad/clk?id=1444514301&iu=/ca-pub-7940484522588532_______________________________________________
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial! http://pubads.g.doubleclick.net/
gampad/clk?id=1444514301&iu=/ca-pub-7940484522588532
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss