Hi Paolo,?? ? Thank you for your answer. I tried and found an interesting issue:
>>> mol = suppl[1]
>>> print mol.GetProp('_Name')
>>> print list(mol.GetPropNames())---output---1[]
I guess that the _Name property is a hidden variable. ?Maybe the user cannot
find this property_name untill he read the source code, or define the
property_name through adding headers.
Hongbin Yang 杨弘宾
?From:?Paolo ToscoDate:?2016-10-13?18:56To:?杨弘宾; rdkit-discussSubject:?Re:
[Rdkit-discuss] property of name in smilesMolSupplier
Hi Hongbin,
suppl[0].GetPropNames() is an
interable object, so you can use it in for loops such as:
for i in suppl[0].GetPropNames():
? print (i)
or you may convert it to a list:
l = list(suppl[0].GetPropNames())
print (l)
Cheers,
p.
On 10/13/16 11:31, 杨弘宾 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