I agree.  I tend to think molecules should have GetName/SetName since this is a 
common operation.

One note though:

mol.GetPropsAsDict()

Might help with introspection.  There are optionally arguments that allow 
looking at private and computed properties, I.e.

mol.GetPropsAsDict(True,True)

I believe will list them all.

----
Brian Kelley

> On Oct 13, 2016, at 6:31 AM, 杨弘宾 <yanyangh...@163.com> wrote:
> 
> Hi,
>     I spent a lot of time to explorer "How to get the property of name when 
> using SmilesMolSupplier"
> 
> I had a smiles file like this:
> ===
> c1ccccc1\t1\n
> ...
> ===
> where 1 means that it is positve
> 
> So I wanted to read this smiles file via SMilesMolSupplier and I knew that 
> the second column is the default name column.
> suppl = Chem.SmilesMolSupplier('compounds.smi',delimiter='\t',titleLine=False)
> 
> However, I could not get the property of 1 because I had no idea what the 
> property_name was.
> In the document, it shows that :
> If the input file has a title line and more than two columns (smiles and id), 
> the
> additional columns will be used to set properties on each molecule.  The 
> properties
> are accessible using the mol.GetProp(propName) method.
> But It was a "no title table", So I thought its property_name of "their 
> names" should be "Name" or "name" as default. And I failed...
> After read the source code, I found that it should be _Name
> https://github.com/rdkit/rdkit/blob/f4529c910e546af590c56eba01f96e9015c269a6/Code/GraphMol/FileParsers/SmilesMolSupplier.cpp#L194
>  
> I think the document should be improved so that others may know how to get 
> the name of each compound
> BTW, I tried to use suppl[0].GetPropNames() but only to get 
> "<rdkit.rdBase._vectclass std::basic_string<char,struct 
> std::char_traits<char>,class std::allocator<char> > at 0x7402e90>" that 
> seemed tell nothing. I wondered that is there any way to make it readable in 
> python?
> 
> 
> Hongbin Yang 杨弘宾 
> Research: Toxicophore and Chemoinformatics
> Pharmaceutical Science, School of Pharmacy 
> East China University of Science and Technology 
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most 
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to