Re: [Rdkit-discuss] GetMol and GetMolFrags in C++

2016-04-11 Thread Yingfeng Wang
David,

Yes, it is very clear. I am confident to use the version Igor suggested now.

Thanks.

Yingfeng

On Mon, Apr 11, 2016 at 8:36 AM, David Hall  wrote:

> 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  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  > wrote:
>
>> Did you want
>> std::vector > >
>> RDKit::MolOps::getMolFrags ( const ROMol
>>  &  *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 
>> 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 
>>> wrote:
>>>


 On Mon, Apr 11, 2016 at 1:35 AM, Yingfeng Wang 
 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

 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=/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=/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 

Re: [Rdkit-discuss] GetMol and GetMolFrags in C++

2016-04-11 Thread David Hall
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  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  > wrote:
> Did you want
> std::vector> > 
> RDKit::MolOps::getMolFrags ( const ROMol 
>  &  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  > 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  > wrote:
> 
> 
> On Mon, Apr 11, 2016 at 1:35 AM, Yingfeng Wang  > 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
>  
> 
> 
> 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=/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=/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 

Re: [Rdkit-discuss] GetMol and GetMolFrags in C++

2016-04-11 Thread Yingfeng Wang
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 
wrote:

> Did you want
> std::vector> >
> RDKit::MolOps::getMolFrags ( const ROMol
>  &  *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 
> 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 
>> wrote:
>>
>>>
>>>
>>> On Mon, Apr 11, 2016 at 1:35 AM, Yingfeng Wang 
>>> 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
>>>
>>> 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=/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=/ca-pub-7940484522588532___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] GetMol and GetMolFrags in C++

2016-04-10 Thread Igor Filippov
Did you want
std::vector> >
RDKit::MolOps::getMolFrags ( const ROMol
 &  *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  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 
> wrote:
>
>>
>>
>> On Mon, Apr 11, 2016 at 1:35 AM, Yingfeng Wang 
>> 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
>>
>> 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=/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=/ca-pub-7940484522588532___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] GetMol and GetMolFrags in C++

2016-04-10 Thread Yingfeng Wang
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 
wrote:

>
>
> On Mon, Apr 11, 2016 at 1:35 AM, Yingfeng Wang  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
>
> 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=/ca-pub-7940484522588532___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] GetMol and GetMolFrags in C++

2016-04-10 Thread Greg Landrum
On Mon, Apr 11, 2016 at 1:35 AM, Yingfeng Wang  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

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=/ca-pub-7940484522588532___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] GetMol and GetMolFrags in C++

2016-04-10 Thread Yingfeng Wang
Brian,

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). 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++?

Again, thank you very much!

Yingfeng

On Sun, Apr 10, 2016 at 6:31 PM, Brian Kelley  wrote:

> In C++ you don't have to, RWMol can be sent to any function that takes an
> ROMol.
>
> Actually, this is true now in Python as well.
>
> In C++ if you really need to copy the molecule:
>
> ROMol mol = new ROMol( *rwmol );
>
> But you really don't have to.
>
> 
> Brian Kelley
>
> > On Apr 10, 2016, at 6:27 PM, Yingfeng Wang  wrote:
> >
> > In python, I have GetMol() for Chem.EditableMol. I can also use
> Chem.GetMolFrags(...). Could you please help me to know how to get similar
> functions in C++?
> >
> > For example, I remove two bonds in an RWMol object, how do I use
> GetMol() and GetMolFrags(...) in C++?
> >
> > Thanks.
> >
> > Yingfeng
> >
> --
> > 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=/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=/ca-pub-7940484522588532___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] GetMol and GetMolFrags in C++

2016-04-10 Thread Brian Kelley
In C++ you don't have to, RWMol can be sent to any function that takes an ROMol.

Actually, this is true now in Python as well.

In C++ if you really need to copy the molecule:

ROMol mol = new ROMol( *rwmol );

But you really don't have to.


Brian Kelley

> On Apr 10, 2016, at 6:27 PM, Yingfeng Wang  wrote:
> 
> In python, I have GetMol() for Chem.EditableMol. I can also use 
> Chem.GetMolFrags(...). Could you please help me to know how to get similar 
> functions in C++?
> 
> For example, I remove two bonds in an RWMol object, how do I use GetMol() and 
> GetMolFrags(...) in C++?
> 
> Thanks.
> 
> Yingfeng
> --
> 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=/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=/ca-pub-7940484522588532
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


[Rdkit-discuss] GetMol and GetMolFrags in C++

2016-04-10 Thread Yingfeng Wang
In python, I have GetMol() for Chem.EditableMol. I can also use
Chem.GetMolFrags(...). Could you please help me to know how to get similar
functions in C++?

For example, I remove two bonds in an RWMol object, how do I use GetMol()
and GetMolFrags(...) in C++?

Thanks.

Yingfeng
--
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=/ca-pub-7940484522588532___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss