code for GenerateTopologicalDistanceMatrix function

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

code for GenerateTopologicalDistanceMatrix function

dong_li3

Follow is the tentative code for proposed GenerateTopologicalDistanceMatrix. I have tested and it works fine. With this matrix in hand user can easily generate any given atom pair's through bond topological distance by providing their atomIdx. Currently it returns the full matrix instead of the upper trangle. It is up to user to disregard the H when looking up the distance. There are cases we do want to compute the distance between H and heavy atoms such as H's abstraction by CYP P450. What do you think?

Thanks

Dong

 

 

in obmol header file

private:

....

map<int, map<int, int > > distancematrix;

.... 

public:

....

void GenerateTologicalDistanceMatrix(OBMol  &Mol)

....

//implementation

void OBMol::GenerateTologicalDistanceMatrix(OBMol  &Mol){

        distancematrix.clear();

        FOR_ATOMS_OF_MOL(a, mol) {

           for(OBMolAtomBFSIter b(mol, a->GetIdx()); b; ++b ){

                distancematrix[a->GetIdx()][b->GetIdx()]=b.CurrentDepth()-1;

        }

      }

      return;

}


------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables
unlimited royalty-free distribution of the report engine
for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Reply | Threaded
Open this post in threaded view
|

Re: code for GenerateTopologicalDistanceMatrix function

Martin Guetlein
Hello,

I'm trying to use Dong Li's proposition within Java. This is the first
time I'm using a SWIG library, and I got stuck very early.
Iterating over all atoms did work (even though it looks a bit
complicated to me),  but I have no idea how to iterate with the
BfsIterator.

Can someone help me out, please?
Martin


(Java) Code goes here:
------------------------------------------------------------------------------------------------------------
SWIGTYPE_p_std__vectorT_OpenBabel__OBAtom_p_t__iterator atomIterator1
= mol.BeginAtoms();
OBAtom atom1 = mol.BeginAtom(atomIterator1);
do
{
   OBMolAtomBFSIter bfsIterator = new OBMolAtomBFSIter(mol, (int)
atom1.GetIdx());
   // how to iterate ????
}
while ((atom1 = mol.NextAtom(atomIterator1)) != null);




On Tue, May 19, 2009 at 4:51 AM, Dong Li<[hidden email]> wrote:

> Follow is the tentative code for proposed GenerateTopologicalDistanceMatrix.
> I have tested and it works fine. With this matrix in hand user can easily
> generate any given atom pair's through bond topological distance by
> providing their atomIdx. Currently it returns the full matrix instead of the
> upper trangle. It is up to user to disregard the H when looking up the
> distance. There are cases we do want to compute the distance between H and
> heavy atoms such as H's abstraction by CYP P450. What do you think?
>
> Thanks
>
> Dong
>
>
>
>
>
> in obmol header file
>
> private:
>
> ....
>
> map<int, map<int, int > > distancematrix;
>
> ....
>
> public:
>
> ....
>
> void GenerateTologicalDistanceMatrix(OBMol  &Mol)
>
> ....
>
> //implementation
>
> void OBMol::GenerateTologicalDistanceMatrix(OBMol  &Mol){
>
>         distancematrix.clear();
>
>         FOR_ATOMS_OF_MOL(a, mol) {
>
>            for(OBMolAtomBFSIter b(mol, a->GetIdx()); b; ++b ){
>
>                 distancematrix[a->GetIdx()][b->GetIdx()]=b.CurrentDepth()-1;
>
>         }
>
>       }
>
>       return;
>
> }
>
> ------------------------------------------------------------------------------
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables
> unlimited royalty-free distribution of the report engine
> for externally facing server and web deployment.
> http://p.sf.net/sfu/businessobjects
> _______________________________________________
> OpenBabel-discuss mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
>



--
Dipl-Inf. Martin Gütlein
Phone:
+49 (0)761 203 8442 (office)
+49 (0)177 623 9499 (mobile)
Email:
[hidden email]

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/blackberry
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Reply | Threaded
Open this post in threaded view
|

Re: code for GenerateTopologicalDistanceMatrix function

Martin Guetlein
In reply to this post by dong_li3
Hello,

calculating the distance with the proposed code does not work for
OBMol objects that contain two separated structures (e.g. parsed from
smiles "c1:c:c:c:c1.O").
The Bfs-Iterator delivers the separated atom at the first depth level.
I think that the separated atom(s) should not be included at all. Is
this a bug?
I would like to have -1 values for disconnected atoms in my matrix.
How can this be done?

Thanks,
Martin


On Tue, May 19, 2009 at 4:51 AM, Dong Li<[hidden email]> wrote:

> Follow is the tentative code for proposed GenerateTopologicalDistanceMatrix.
> I have tested and it works fine. With this matrix in hand user can easily
> generate any given atom pair's through bond topological distance by
> providing their atomIdx. Currently it returns the full matrix instead of the
> upper trangle. It is up to user to disregard the H when looking up the
> distance. There are cases we do want to compute the distance between H and
> heavy atoms such as H's abstraction by CYP P450. What do you think?
>
> Thanks
>
> Dong
>
>
>
>
>
> in obmol header file
>
> private:
>
> ....
>
> map<int, map<int, int > > distancematrix;
>
> ....
>
> public:
>
> ....
>
> void GenerateTologicalDistanceMatrix(OBMol  &Mol)
>
> ....
>
> //implementation
>
> void OBMol::GenerateTologicalDistanceMatrix(OBMol  &Mol){
>
>         distancematrix.clear();
>
>         FOR_ATOMS_OF_MOL(a, mol) {
>
>            for(OBMolAtomBFSIter b(mol, a->GetIdx()); b; ++b ){
>
>                 distancematrix[a->GetIdx()][b->GetIdx()]=b.CurrentDepth()-1;
>
>         }
>
>       }
>
>       return;
>
> }
>
> ------------------------------------------------------------------------------
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables
> unlimited royalty-free distribution of the report engine
> for externally facing server and web deployment.
> http://p.sf.net/sfu/businessobjects
> _______________________________________________
> OpenBabel-discuss mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
>



--
Dipl-Inf. Martin Gütlein
Phone:
+49 (0)761 203 8442 (office)
+49 (0)177 623 9499 (mobile)
Email:
[hidden email]

------------------------------------------------------------------------------
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Reply | Threaded
Open this post in threaded view
|

Re: code for GenerateTopologicalDistanceMatrix function

Noel O'Boyle
Administrator
I don't think it's a bug. The Iterator is supposed to iterate over all
atoms in the OBMol. You should simply call OBMol::Separate() first if
you are dealing with disconnected components.

- Noel

2009/7/27 Martin Guetlein <[hidden email]>:

> Hello,
>
> calculating the distance with the proposed code does not work for
> OBMol objects that contain two separated structures (e.g. parsed from
> smiles "c1:c:c:c:c1.O").
> The Bfs-Iterator delivers the separated atom at the first depth level.
> I think that the separated atom(s) should not be included at all. Is
> this a bug?
> I would like to have -1 values for disconnected atoms in my matrix.
> How can this be done?
>
> Thanks,
> Martin
>
>
> On Tue, May 19, 2009 at 4:51 AM, Dong Li<[hidden email]> wrote:
>> Follow is the tentative code for proposed GenerateTopologicalDistanceMatrix.
>> I have tested and it works fine. With this matrix in hand user can easily
>> generate any given atom pair's through bond topological distance by
>> providing their atomIdx. Currently it returns the full matrix instead of the
>> upper trangle. It is up to user to disregard the H when looking up the
>> distance. There are cases we do want to compute the distance between H and
>> heavy atoms such as H's abstraction by CYP P450. What do you think?
>>
>> Thanks
>>
>> Dong
>>
>>
>>
>>
>>
>> in obmol header file
>>
>> private:
>>
>> ....
>>
>> map<int, map<int, int > > distancematrix;
>>
>> ....
>>
>> public:
>>
>> ....
>>
>> void GenerateTologicalDistanceMatrix(OBMol  &Mol)
>>
>> ....
>>
>> //implementation
>>
>> void OBMol::GenerateTologicalDistanceMatrix(OBMol  &Mol){
>>
>>         distancematrix.clear();
>>
>>         FOR_ATOMS_OF_MOL(a, mol) {
>>
>>            for(OBMolAtomBFSIter b(mol, a->GetIdx()); b; ++b ){
>>
>>                 distancematrix[a->GetIdx()][b->GetIdx()]=b.CurrentDepth()-1;
>>
>>         }
>>
>>       }
>>
>>       return;
>>
>> }
>>
>> ------------------------------------------------------------------------------
>> Crystal Reports - New Free Runtime and 30 Day Trial
>> Check out the new simplified licensing option that enables
>> unlimited royalty-free distribution of the report engine
>> for externally facing server and web deployment.
>> http://p.sf.net/sfu/businessobjects
>> _______________________________________________
>> OpenBabel-discuss mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>>
>>
>
>
>
> --
> Dipl-Inf. Martin Gütlein
> Phone:
> +49 (0)761 203 8442 (office)
> +49 (0)177 623 9499 (mobile)
> Email:
> [hidden email]
>
> ------------------------------------------------------------------------------
> _______________________________________________
> OpenBabel-discuss mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>

------------------------------------------------------------------------------
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Reply | Threaded
Open this post in threaded view
|

Re: code for GenerateTopologicalDistanceMatrix function

arronlee
In reply to this post by dong_li3
Hi,
As for me, I am testing the related .net barcode generator these days. Do you have any ideas about it? Or any good suggestion? I am totally a green hand on barcode generating field. Any suggestion will be appreciated.

Thanks in advance.


Best regards,
Arron
Reply | Threaded
Open this post in threaded view
|

Re: code for GenerateTopologicalDistanceMatrix function

arianapham
In reply to this post by dong_li3
There are a very interesting question and very positive thinking in qwop your mind so I like this topic so I one suggestion we can use it now bing.
Reply | Threaded
Open this post in threaded view
|

Re: code for GenerateTopologicalDistanceMatrix function

phamyen123
In reply to this post by dong_li3
Thanks for sharing this marvelous post. I m very pleased to read this article.
https://clickerheroes.games