IvanChernyshov / ILThermoPy

Python API for the ILThermo 2.0 database with SMILES support
MIT License
2 stars 0 forks source link

Prop keys not working #1

Closed jaeminyoo-nu closed 2 months ago

jaeminyoo-nu commented 2 months ago

Hi,

I've been trying to scrape some data from ILThermo using this API but the DataFrame I get from using the ilt.Search feature returns an empty DataFrame when I use any kind of prop_keys.

for example, using df = ilt.Search(n_compounds = 1, compound = "methylimidazolium", prop_key = "YQlI") df=pd.DataFrame(df)

returns an empty DataFrame, although it worked couple months ago.

Is there a workaround?

IvanChernyshov commented 2 months ago

Hi,

It seems that ILThermo was updated on June 4, so I need to update the package. However, it should be OK for the most cases. Try the following scheme:

To get the actual list of keys, do this:

import ilthermopy as ilt

pl = ilt.PropertyList()
for k, v in pl.key2prop.items():
    print(f'{k}: {v}')

>> BPpY: Activity
>> VjHv: Osmotic coefficient
>> dNip: Composition at phase equilibrium
>> MbEq: Eutectic composition
>> lIUh: Henry's Law constant
>> eCTp: Ostwald coefficient
>> neae: Tieline
...

This code will print you the actual property keys. Please note that where is no "YQlI":

print("YQlI" in pl.key2prop)

>> False

Now, you can run the search, e.g.:

# prop == normal melting temperature
df = ilt.Search(n_compounds = 1, compound = 'methylimidazolium', prop_key = 'NmYB')
df

>>         id                 reference                    property          phases  ...  cmp2_smiles  cmp3  cmp3_id cmp3_smiles
>> 0    TYkZj       Alves et al. (2010)  Normal melting temperature  Crystal;Liquid  ...         None  None     None        None
>> 1    Lcgtv       Annat et al. (2012)  Normal melting temperature  Crystal;Liquid  ...         None  None     None        None
>> 2    SpFSp  Appetecchi et al. (2011)  Normal melting temperature  Crystal;Liquid  ...         None  None     None        None
>> 3    ewjSV  Appetecchi et al. (2011)  Normal melting temperature  Crystal;Liquid  ...         None  None     None        None
>> 4    XPqoc   Aranowski et al. (2016)  Normal melting temperature  Crystal;Liquid  ...         None  None     None        None
>> ..     ...                       ...                         ...             ...  ...          ...   ...      ...         ...
>> 317  TUpZc         Zhu et al. (2009)  Normal melting temperature  Crystal;Liquid  ...         None  None     None        None
>> 318  BSZVx         Zhu et al. (2009)  Normal melting temperature  Crystal;Liquid  ...         None  None     None        None
>> 319  OpFtO         Zhu et al. (2009)  Normal melting temperature  Crystal;Liquid  ...         None  None     None        None
>> 320  wzMif         Zhu et al. (2009)  Normal melting temperature  Crystal;Liquid  ...         None  None     None        None
>> 321  YiGio         Zhu et al. (2009)  Normal melting temperature  Crystal;Liquid  ...         None  None     None        None
>> 
>> [322 rows x 16 columns]

I hope this helps!

jaeminyoo-nu commented 2 months ago

Hi Ivan,

Thank you for the help! It worked. I didn't realize the prop keys would change. I will keep this in mind for future usage!