[Rdkit-discuss] SmilesWriter doesn't always produce id

2015-04-21 Thread Michał Nowotka
Hi,

Imagine I have two rdkit mol objects, one from SD and one from SMILES:

import os
import StringIO
from rdkit.Chem import SDMolSupplier
from rdkit.Chem import SmilesMolSupplier
from rdkit.Chem import SmilesWriter

mol = '''
  MJ150413

  6  6  0  0  0  0  0  0  0  0999 V2000
0.71441.23750. C   0  0  0  0  0  0  0  0  0  0  0  0
1.42890.82500. C   0  0  0  0  0  0  0  0  0  0  0  0
1.4289   -0.0. C   0  0  0  0  0  0  0  0  0  0  0  0
0.7144   -0.41250. C   0  0  0  0  0  0  0  0  0  0  0  0
0.0.0. C   0  0  0  0  0  0  0  0  0  0  0  0
0.0.82500. C   0  0  0  0  0  0  0  0  0  0  0  0
  1  2  2  0  0  0  0
  2  3  1  0  0  0  0
  3  4  2  0  0  0  0
  4  5  1  0  0  0  0
  5  6  2  0  0  0  0
  1  6  1  0  0  0  0
M  END
 '''

suppl = SDMolSupplier()
suppl.SetData(mol)
fromSD = suppl.next()

suppl = SmilesMolSupplier()
suppl.SetData('C', titleLine=False)
fromSMILES = suppl.next()


Now I want to convert them to SMILES. For the mol from SD, the
identifier is missing:

sio = StringIO.StringIO()
w = SmilesWriter(sio, delimiter=' ', nameHeader='Name',
includeHeader=True, isomericSmiles=False, kekuleSmiles=False)
w.write(fromSD)
w.flush()
print sio.getvalue()

>>> SMILES Name
>>> c1c1

but for mol from SMILES it's fine:

w.write(fromSMILES)
w.flush()
print sio.getvalue()

>>> SMILES Name
>>> c1c1
>>> C 1


Is that a bug or an expected behavior? Is it possible to get
identifiers for both mols?


Kind regards,

Michał Nowotka

--
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] SmilesWriter doesn't always produce id

2015-04-21 Thread Greg Landrum
Michal,

What do you expect to get for the molecule from the CTAB? In the example
below, it does not have anything in the first line, which is the one that's
used to populate the _Name attribute.

-greg


On Tue, Apr 21, 2015 at 4:32 PM, Michał Nowotka  wrote:

> Hi,
>
> Imagine I have two rdkit mol objects, one from SD and one from SMILES:
>
> import os
> import StringIO
> from rdkit.Chem import SDMolSupplier
> from rdkit.Chem import SmilesMolSupplier
> from rdkit.Chem import SmilesWriter
>
> mol = '''
>   MJ150413
>
>   6  6  0  0  0  0  0  0  0  0999 V2000
> 0.71441.23750. C   0  0  0  0  0  0  0  0  0  0  0  0
> 1.42890.82500. C   0  0  0  0  0  0  0  0  0  0  0  0
> 1.4289   -0.0. C   0  0  0  0  0  0  0  0  0  0  0  0
> 0.7144   -0.41250. C   0  0  0  0  0  0  0  0  0  0  0  0
> 0.0.0. C   0  0  0  0  0  0  0  0  0  0  0  0
> 0.0.82500. C   0  0  0  0  0  0  0  0  0  0  0  0
>   1  2  2  0  0  0  0
>   2  3  1  0  0  0  0
>   3  4  2  0  0  0  0
>   4  5  1  0  0  0  0
>   5  6  2  0  0  0  0
>   1  6  1  0  0  0  0
> M  END
>  '''
>
> suppl = SDMolSupplier()
> suppl.SetData(mol)
> fromSD = suppl.next()
>
> suppl = SmilesMolSupplier()
> suppl.SetData('C', titleLine=False)
> fromSMILES = suppl.next()
>
>
> Now I want to convert them to SMILES. For the mol from SD, the
> identifier is missing:
>
> sio = StringIO.StringIO()
> w = SmilesWriter(sio, delimiter=' ', nameHeader='Name',
> includeHeader=True, isomericSmiles=False, kekuleSmiles=False)
> w.write(fromSD)
> w.flush()
> print sio.getvalue()
>
> >>> SMILES Name
> >>> c1c1
>
> but for mol from SMILES it's fine:
>
> w.write(fromSMILES)
> w.flush()
> print sio.getvalue()
>
> >>> SMILES Name
> >>> c1c1
> >>> C 1
>
>
> Is that a bug or an expected behavior? Is it possible to get
> identifiers for both mols?
>
>
> Kind regards,
>
> Michał Nowotka
>
>
> --
> BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
> Develop your own process in accordance with the BPMN 2 standard
> Learn Process modeling best practices with Bonita BPM through live
> exercises
> http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual-
> event?utm_
> source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
> ___
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
--
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] SmilesWriter doesn't always produce id

2015-04-21 Thread Michał Nowotka
Hi Greg,

I would expect to have:

SMILES Name
c1c1 0


instead of

SMILES Name
c1c1

Note, that for SMILES there is also no place to specify a name but if
I create a mol object from SMILES I will get the desired output.

On Tue, Apr 21, 2015 at 4:20 PM, Greg Landrum  wrote:
> Michal,
>
> What do you expect to get for the molecule from the CTAB? In the example
> below, it does not have anything in the first line, which is the one that's
> used to populate the _Name attribute.
>
> -greg
>
>
> On Tue, Apr 21, 2015 at 4:32 PM, Michał Nowotka  wrote:
>>
>> Hi,
>>
>> Imagine I have two rdkit mol objects, one from SD and one from SMILES:
>>
>> import os
>> import StringIO
>> from rdkit.Chem import SDMolSupplier
>> from rdkit.Chem import SmilesMolSupplier
>> from rdkit.Chem import SmilesWriter
>>
>> mol = '''
>>   MJ150413
>>
>>   6  6  0  0  0  0  0  0  0  0999 V2000
>> 0.71441.23750. C   0  0  0  0  0  0  0  0  0  0  0  0
>> 1.42890.82500. C   0  0  0  0  0  0  0  0  0  0  0  0
>> 1.4289   -0.0. C   0  0  0  0  0  0  0  0  0  0  0  0
>> 0.7144   -0.41250. C   0  0  0  0  0  0  0  0  0  0  0  0
>> 0.0.0. C   0  0  0  0  0  0  0  0  0  0  0  0
>> 0.0.82500. C   0  0  0  0  0  0  0  0  0  0  0  0
>>   1  2  2  0  0  0  0
>>   2  3  1  0  0  0  0
>>   3  4  2  0  0  0  0
>>   4  5  1  0  0  0  0
>>   5  6  2  0  0  0  0
>>   1  6  1  0  0  0  0
>> M  END
>>  '''
>>
>> suppl = SDMolSupplier()
>> suppl.SetData(mol)
>> fromSD = suppl.next()
>>
>> suppl = SmilesMolSupplier()
>> suppl.SetData('C', titleLine=False)
>> fromSMILES = suppl.next()
>>
>>
>> Now I want to convert them to SMILES. For the mol from SD, the
>> identifier is missing:
>>
>> sio = StringIO.StringIO()
>> w = SmilesWriter(sio, delimiter=' ', nameHeader='Name',
>> includeHeader=True, isomericSmiles=False, kekuleSmiles=False)
>> w.write(fromSD)
>> w.flush()
>> print sio.getvalue()
>>
>> >>> SMILES Name
>> >>> c1c1
>>
>> but for mol from SMILES it's fine:
>>
>> w.write(fromSMILES)
>> w.flush()
>> print sio.getvalue()
>>
>> >>> SMILES Name
>> >>> c1c1
>> >>> C 1
>>
>>
>> Is that a bug or an expected behavior? Is it possible to get
>> identifiers for both mols?
>>
>>
>> Kind regards,
>>
>> Michał Nowotka
>>
>>
>> --
>> BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
>> Develop your own process in accordance with the BPMN 2 standard
>> Learn Process modeling best practices with Bonita BPM through live
>> exercises
>> http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual-
>> event?utm_
>> source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
>> ___
>> Rdkit-discuss mailing list
>> Rdkit-discuss@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
>

--
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


[Rdkit-discuss] Python GetShortestPath()?

2015-04-21 Thread James Davidson
Dear All,

I might be having a 'moment' here, but for the life of me I can't seem to find 
the equivalent of RDKit::MolOps::getShortestPath exposed in python(?).
I want to pass in two atom ids, and get back a list of atom ids in the shortest 
path.  I could possibly try to roll my own by using GetDistanceMatrix() and 
GetAdjacencyMatrix(), but I think I may struggle(!).

So, any pointer to GetShortestPath() greatly appreciated!

Kind regards

James

__
PLEASE READ: This email is confidential and may be privileged. It is intended 
for the named addressee(s) only and access to it by anyone else is 
unauthorised. If you are not an addressee, any disclosure or copying of the 
contents of this email or any action taken (or not taken) in reliance on it is 
unauthorised and may be unlawful. If you have received this email in error, 
please notify the sender or postmas...@vernalis.com. Email is not a secure 
method of communication and the Company cannot accept responsibility for the 
accuracy or completeness of this message or any attachment(s). Please check 
this email for virus infection for which the Company accepts no responsibility. 
If verification of this email is sought then please request a hard copy. Unless 
otherwise stated, any views or opinions presented are solely those of the 
author and do not represent those of the Company.

The Vernalis Group of Companies
100 Berkshire Place
Wharfedale Road
Winnersh, Berkshire
RG41 5RD, England
Tel: +44 (0)118 938 

To access trading company registration and address details, please go to the 
Vernalis website at www.vernalis.com and click on the "Company address and 
registration details" link at the bottom of the page..
__--
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] Python GetShortestPath()?

2015-04-21 Thread Nicholas Firth
Dear James,

I tried to be helpful and show you how I do it with GetAdjacencyMatrix, however 
I ran into my old friend the segmentation fault 11 as there is still some weird 
error with this function.

Here's what I have though, should work for you.


>>> from rdkit import Chem
>>> m = 
>>> Chem.MolFromSmiles('CC[C@H](CO)NC1=NC(=C2C(=N1)N(C=N2)C(C)C)NCC3=CC=CC=C3')
>>> atomIdx1 = 0
>>> atomIdx2 = 10
>>> print(Chem.GetAdjacencyMatrix(m)[atomIdx1][atomIdx2])
Segmentation fault: 11



Best,
Nick

Nicholas C. Firth | PhD Student | Cancer Therapeutics
The Institute of Cancer Research | 15 Cotswold Road | Belmont | Sutton | Surrey 
| SM2 5NG
T 020 8722 4033 | E nicholas.fi...@icr.ac.uk | W www.icr.ac.uk | Twitter 
@ICRnews


From: James Davidson [j.david...@vernalis.com]
Sent: 21 April 2015 17:06
To: rdkit-discuss@lists.sourceforge.net
Subject: [Rdkit-discuss] Python GetShortestPath()?

Dear All,

I might be having a ‘moment’ here, but for the life of me I can’t seem to find 
the equivalent of RDKit::MolOps::getShortestPath exposed in python(?).
I want to pass in two atom ids, and get back a list of atom ids in the shortest 
path.  I could possibly try to roll my own by using GetDistanceMatrix() and 
GetAdjacencyMatrix(), but I think I may struggle(!).

So, any pointer to GetShortestPath() greatly appreciated!

Kind regards

James

__
PLEASE READ: This email is confidential and may be privileged. It is intended 
for the named addressee(s) only and access to it by anyone else is 
unauthorised. If you are not an addressee, any disclosure or copying of the 
contents of this email or any action taken (or not taken) in reliance on it is 
unauthorised and may be unlawful. If you have received this email in error, 
please notify the sender or postmas...@vernalis.com. Email is not a secure 
method of communication and the Company cannot accept responsibility for the 
accuracy or completeness of this message or any attachment(s). Please check 
this email for virus infection for which the Company accepts no responsibility. 
If verification of this email is sought then please request a hard copy. Unless 
otherwise stated, any views or opinions presented are solely those of the 
author and do not represent those of the Company.

The Vernalis Group of Companies
100 Berkshire Place
Wharfedale Road
Winnersh, Berkshire
RG41 5RD, England
Tel: +44 (0)118 938 

To access trading company registration and address details, please go to the 
Vernalis website at www.vernalis.com and click on the "Company address and 
registration details" link at the bottom of the page..
__

The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company 
Limited by Guarantee, Registered in England under Company No. 534147 with its 
Registered Office at 123 Old Brompton Road, London SW7 3RP.

This e-mail message is confidential and for use by the addressee only.  If the 
message is received by anyone other than the addressee, please return the 
message to the sender by replying to it and then delete the message from your 
computer and network.

--
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] Python GetShortestPath()?

2015-04-21 Thread James Davidson
Hi Nick,

Well on the plus side I don't get a segfault(!)
On the minus side - unfortunately I think this approach only gives the length 
of the shortest path, rather than a list of the atom ids in the shortest path.

Kind regards

James

> -Original Message-
> From: Nicholas Firth [mailto:nicholas.fi...@icr.ac.uk]
> Sent: 21 April 2015 17:44
> To: James Davidson; rdkit-discuss@lists.sourceforge.net
> Subject: RE: Python GetShortestPath()?
> 
> Dear James,
> 
> I tried to be helpful and show you how I do it with GetAdjacencyMatrix,
> however I ran into my old friend the segmentation fault 11 as there is still
> some weird error with this function.
> 
> Here's what I have though, should work for you.
> 
> 
> >>> from rdkit import Chem
> >>> m =
> >>>
> Chem.MolFromSmiles('CC[C@H](CO)NC1=NC(=C2C(=N1)N(C=N2)C(C)C)NCC
> 3=CC=
> >>> CC=C3')
> >>> atomIdx1 = 0
> >>> atomIdx2 = 10
> >>> print(Chem.GetAdjacencyMatrix(m)[atomIdx1][atomIdx2])
> Segmentation fault: 11
> 
> 
> 
> Best,
> Nick
> 
> Nicholas C. Firth | PhD Student | Cancer Therapeutics The Institute of Cancer
> Research | 15 Cotswold Road | Belmont | Sutton | Surrey | SM2 5NG T 020
> 8722 4033 | E nicholas.fi...@icr.ac.uk | W www.icr.ac.uk | Twitter @ICRnews
> 
> 
> From: James Davidson [j.david...@vernalis.com]
> Sent: 21 April 2015 17:06
> To: rdkit-discuss@lists.sourceforge.net
> Subject: [Rdkit-discuss] Python GetShortestPath()?
> 
> Dear All,
> 
> I might be having a 'moment' here, but for the life of me I can't seem to find
> the equivalent of RDKit::MolOps::getShortestPath exposed in python(?).
> I want to pass in two atom ids, and get back a list of atom ids in the 
> shortest
> path.  I could possibly try to roll my own by using GetDistanceMatrix() and
> GetAdjacencyMatrix(), but I think I may struggle(!).
> 
> So, any pointer to GetShortestPath() greatly appreciated!
> 
> Kind regards
> 
> James
> 
> __
> 
> PLEASE READ: This email is confidential and may be privileged. It is intended
> for the named addressee(s) only and access to it by anyone else is
> unauthorised. If you are not an addressee, any disclosure or copying of the
> contents of this email or any action taken (or not taken) in reliance on it is
> unauthorised and may be unlawful. If you have received this email in error,
> please notify the sender or postmas...@vernalis.com. Email is not a secure
> method of communication and the Company cannot accept responsibility for
> the accuracy or completeness of this message or any attachment(s). Please
> check this email for virus infection for which the Company accepts no
> responsibility. If verification of this email is sought then please request a 
> hard
> copy. Unless otherwise stated, any views or opinions presented are solely
> those of the author and do not represent those of the Company.
> 
> The Vernalis Group of Companies
> 100 Berkshire Place
> Wharfedale Road
> Winnersh, Berkshire
> RG41 5RD, England
> Tel: +44 (0)118 938 
> 
> To access trading company registration and address details, please go to the
> Vernalis website at www.vernalis.com and click on the "Company address
> and registration details" link at the bottom of the page..
> __
> 
> 
> The Institute of Cancer Research: Royal Cancer Hospital, a charitable
> Company Limited by Guarantee, Registered in England under Company No.
> 534147 with its Registered Office at 123 Old Brompton Road, London SW7
> 3RP.
> 
> This e-mail message is confidential and for use by the addressee only.  If the
> message is received by anyone other than the addressee, please return the
> message to the sender by replying to it and then delete the message from
> your computer and network.

__
PLEASE READ: This email is confidential and may be privileged. It is intended 
for the named addressee(s) only and access to it by anyone else is 
unauthorised. If you are not an addressee, any disclosure or copying of the 
contents of this email or any action taken (or not taken) in reliance on it is 
unauthorised and may be unlawful. If you have received this email in error, 
please notify the sender or postmas...@vernalis.com. Email is not a secure 
method of communication and the Company cannot accept responsibility for the 
accuracy or completeness of this message or any attachment(s). Please check 
this email for virus infection for which the Company accepts no responsibility. 
If verification of this email is sought then please request a hard copy. Unless 
otherwise stated, any views or opinions presented are solely those of the 
author and do not represent those of the Company.

The Vernalis Group of Companies
100 Berkshire Place
Wharfedale Road
Winnersh, Berkshire
RG41 5RD, England
Tel: +44 (0)118 938 

To access trading company registra

Re: [Rdkit-discuss] Python GetShortestPath()?

2015-04-21 Thread Nicholas Firth
Ahh apologise, I misunderstood the question! I thought it seemed a bit simple!

Best,
Nick

Nicholas C. Firth | PhD Student | Cancer Therapeutics
The Institute of Cancer Research | 15 Cotswold Road | Belmont | Sutton | Surrey 
| SM2 5NG
T 020 8722 4033 | E nicholas.fi...@icr.ac.uk | 
W www.icr.ac.uk | Twitter 
@ICRnews
Facebook 
www.facebook.com/theinstituteofcancerresearch
Making the discoveries that defeat cancer

[cid:image001.gif@01CE053D.51D3C4E0]

On 21 Apr 2015, at 18:08, James Davidson 
mailto:j.david...@vernalis.com>> wrote:

Hi Nick,

Well on the plus side I don't get a segfault(!)
On the minus side - unfortunately I think this approach only gives the length 
of the shortest path, rather than a list of the atom ids in the shortest path.

Kind regards

James

-Original Message-
From: Nicholas Firth [mailto:nicholas.fi...@icr.ac.uk]
Sent: 21 April 2015 17:44
To: James Davidson; 
rdkit-discuss@lists.sourceforge.net
Subject: RE: Python GetShortestPath()?

Dear James,

I tried to be helpful and show you how I do it with GetAdjacencyMatrix,
however I ran into my old friend the segmentation fault 11 as there is still
some weird error with this function.

Here's what I have though, should work for you.


from rdkit import Chem
m =

Chem.MolFromSmiles('CC[C@H](CO)NC1=NC(=C2C(=N1)N(C=N2)C(C)C)NCC
3=CC=
CC=C3')
atomIdx1 = 0
atomIdx2 = 10
print(Chem.GetAdjacencyMatrix(m)[atomIdx1][atomIdx2])
Segmentation fault: 11



Best,
Nick

Nicholas C. Firth | PhD Student | Cancer Therapeutics The Institute of Cancer
Research | 15 Cotswold Road | Belmont | Sutton | Surrey | SM2 5NG T 020
8722 4033 | E nicholas.fi...@icr.ac.uk | W 
www.icr.ac.uk | Twitter @ICRnews


From: James Davidson [j.david...@vernalis.com]
Sent: 21 April 2015 17:06
To: 
rdkit-discuss@lists.sourceforge.net
Subject: [Rdkit-discuss] Python GetShortestPath()?

Dear All,

I might be having a 'moment' here, but for the life of me I can't seem to find
the equivalent of RDKit::MolOps::getShortestPath exposed in python(?).
I want to pass in two atom ids, and get back a list of atom ids in the shortest
path.  I could possibly try to roll my own by using GetDistanceMatrix() and
GetAdjacencyMatrix(), but I think I may struggle(!).

So, any pointer to GetShortestPath() greatly appreciated!

Kind regards

James

__

PLEASE READ: This email is confidential and may be privileged. It is intended
for the named addressee(s) only and access to it by anyone else is
unauthorised. If you are not an addressee, any disclosure or copying of the
contents of this email or any action taken (or not taken) in reliance on it is
unauthorised and may be unlawful. If you have received this email in error,
please notify the sender or 
postmas...@vernalis.com. Email is not a secure
method of communication and the Company cannot accept responsibility for
the accuracy or completeness of this message or any attachment(s). Please
check this email for virus infection for which the Company accepts no
responsibility. If verification of this email is sought then please request a 
hard
copy. Unless otherwise stated, any views or opinions presented are solely
those of the author and do not represent those of the Company.

The Vernalis Group of Companies
100 Berkshire Place
Wharfedale Road
Winnersh, Berkshire
RG41 5RD, England
Tel: +44 (0)118 938 

To access trading company registration and address details, please go to the
Vernalis website at www.vernalis.com and click on the 
"Company address
and registration details" link at the bottom of the page..
__


The Institute of Cancer Research: Royal Cancer Hospital, a charitable
Company Limited by Guarantee, Registered in England under Company No.
534147 with its Registered Office at 123 Old Brompton Road, London SW7
3RP.

This e-mail message is confidential and for use by the addressee only.  If the
message is received by anyone other than the addressee, please return the
message to the sender by replying to it and then delete the message from
your computer and network.

__
PLEASE READ: This email is confidential and may be privileged. It is intended 
for the named addressee(s) only and access to it by anyone else is 
unauthorised. If you are not an addressee, any disclosure or copying of the 
contents of this email or any action taken (or not taken) in reliance on it is 
unauthorised and may be unlawful. If you ha

Re: [Rdkit-discuss] Python GetShortestPath()?

2015-04-21 Thread Greg Landrum
On Tue, Apr 21, 2015 at 6:06 PM, James Davidson 
wrote:

>
>
> I might be having a ‘moment’ here, but for the life of me I can’t seem to
> find the equivalent of RDKit::MolOps::getShortestPath exposed in python(?).
>
>
I read this email and thought "of course it's there". But, after looking
for a bit I realized that it didn't seem to be... what an odd oversight!
Fortunately, a bit further down in my inbox there was a pull request from
Paolo with the implementation, so the only think I had to do was click
"accept pull request" and things were back to being as they should be.
Thanks Paolo!
:-)

I want to pass in two atom ids, and get back a list of atom ids in the
> shortest path.  I could possibly try to roll my own by using
> GetDistanceMatrix() and GetAdjacencyMatrix(), but I think I may struggle(!).
>
>
>
> So, any pointer to GetShortestPath() greatly appreciated!
>

As an aside/note: the current implementation does a breadth-first search to
find the shortest path, so it's quite efficient if you're only looking for
a relatively small set of paths in the molecule. If you end up wanting to
find all of them, we probably need to expose the all-pairs shortest paths
algorithm to Python as well. The results this returns are a bit more
complex to work with, but the implementation is much more efficient than
doing the N^2 calls to GetShortestPath().

Best,
-greg
--
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] SmilesWriter doesn't always produce id

2015-04-21 Thread Greg Landrum
Got it. The problem is now fixed.

Thanks for reporting it!

-greg


On Tue, Apr 21, 2015 at 5:33 PM, Michał Nowotka  wrote:

> Hi Greg,
>
> I would expect to have:
>
> SMILES Name
> c1c1 0
>
>
> instead of
>
> SMILES Name
> c1c1
>
> Note, that for SMILES there is also no place to specify a name but if
> I create a mol object from SMILES I will get the desired output.
>
> On Tue, Apr 21, 2015 at 4:20 PM, Greg Landrum 
> wrote:
> > Michal,
> >
> > What do you expect to get for the molecule from the CTAB? In the example
> > below, it does not have anything in the first line, which is the one
> that's
> > used to populate the _Name attribute.
> >
> > -greg
> >
> >
> > On Tue, Apr 21, 2015 at 4:32 PM, Michał Nowotka 
> wrote:
> >>
> >> Hi,
> >>
> >> Imagine I have two rdkit mol objects, one from SD and one from SMILES:
> >>
> >> import os
> >> import StringIO
> >> from rdkit.Chem import SDMolSupplier
> >> from rdkit.Chem import SmilesMolSupplier
> >> from rdkit.Chem import SmilesWriter
> >>
> >> mol = '''
> >>   MJ150413
> >>
> >>   6  6  0  0  0  0  0  0  0  0999 V2000
> >> 0.71441.23750. C   0  0  0  0  0  0  0  0  0  0  0  0
> >> 1.42890.82500. C   0  0  0  0  0  0  0  0  0  0  0  0
> >> 1.4289   -0.0. C   0  0  0  0  0  0  0  0  0  0  0  0
> >> 0.7144   -0.41250. C   0  0  0  0  0  0  0  0  0  0  0  0
> >> 0.0.0. C   0  0  0  0  0  0  0  0  0  0  0  0
> >> 0.0.82500. C   0  0  0  0  0  0  0  0  0  0  0  0
> >>   1  2  2  0  0  0  0
> >>   2  3  1  0  0  0  0
> >>   3  4  2  0  0  0  0
> >>   4  5  1  0  0  0  0
> >>   5  6  2  0  0  0  0
> >>   1  6  1  0  0  0  0
> >> M  END
> >>  '''
> >>
> >> suppl = SDMolSupplier()
> >> suppl.SetData(mol)
> >> fromSD = suppl.next()
> >>
> >> suppl = SmilesMolSupplier()
> >> suppl.SetData('C', titleLine=False)
> >> fromSMILES = suppl.next()
> >>
> >>
> >> Now I want to convert them to SMILES. For the mol from SD, the
> >> identifier is missing:
> >>
> >> sio = StringIO.StringIO()
> >> w = SmilesWriter(sio, delimiter=' ', nameHeader='Name',
> >> includeHeader=True, isomericSmiles=False, kekuleSmiles=False)
> >> w.write(fromSD)
> >> w.flush()
> >> print sio.getvalue()
> >>
> >> >>> SMILES Name
> >> >>> c1c1
> >>
> >> but for mol from SMILES it's fine:
> >>
> >> w.write(fromSMILES)
> >> w.flush()
> >> print sio.getvalue()
> >>
> >> >>> SMILES Name
> >> >>> c1c1
> >> >>> C 1
> >>
> >>
> >> Is that a bug or an expected behavior? Is it possible to get
> >> identifiers for both mols?
> >>
> >>
> >> Kind regards,
> >>
> >> Michał Nowotka
> >>
> >>
> >>
> --
> >> BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
> >> Develop your own process in accordance with the BPMN 2 standard
> >> Learn Process modeling best practices with Bonita BPM through live
> >> exercises
> >> http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual-
> >> event?utm_
> >> source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
> >> ___
> >> Rdkit-discuss mailing list
> >> Rdkit-discuss@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
> >
> >
>
--
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] Python GetShortestPath()?

2015-04-21 Thread James Davidson
Hi Greg,

I just built the latest revision - and the functionality is exposed - thanks 
(and, of course, thanks Paolo!).

Kind regards

James

__
PLEASE READ: This email is confidential and may be privileged. It is intended 
for the named addressee(s) only and access to it by anyone else is 
unauthorised. If you are not an addressee, any disclosure or copying of the 
contents of this email or any action taken (or not taken) in reliance on it is 
unauthorised and may be unlawful. If you have received this email in error, 
please notify the sender or postmas...@vernalis.com. Email is not a secure 
method of communication and the Company cannot accept responsibility for the 
accuracy or completeness of this message or any attachment(s). Please check 
this email for virus infection for which the Company accepts no responsibility. 
If verification of this email is sought then please request a hard copy. Unless 
otherwise stated, any views or opinions presented are solely those of the 
author and do not represent those of the Company.

The Vernalis Group of Companies
100 Berkshire Place
Wharfedale Road
Winnersh, Berkshire
RG41 5RD, England
Tel: +44 (0)118 938 

To access trading company registration and address details, please go to the 
Vernalis website at www.vernalis.com and click on the "Company address and 
registration details" link at the bottom of the page..
__
--
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss