Open nicola-palmieri opened 1 month ago
I'm also trying to get targets from ligands and running into the same error. I also get this starting from targets and trying to query interactions
>>> mtor = pygtop.get_target_by_name('mtor')
>>> print(mtor)
<Target 2109 (mechanistic target of rapamycin kinase)>
>>> mtor.interactions()
KeyError Traceback (most recent call last)
Cell In[29], line 3
1 mtor = pygtop.get_target_by_name('mtor')
2 print(mtor)
----> 3 mtor.interactions()
File ~\miniconda3\envs\qs_mlenv_311\Lib\site-packages\pygtop\targets.py:260, in Target.interactions(self, species)
257 return [Interaction(interaction_json) for interaction_json in self._get_interactions_json()
258 if interaction_json["targetSpecies"] and interaction_json["targetSpecies"].lower() == species.lower()]
259 else:
--> 260 return [Interaction(interaction_json) for interaction_json in self._get_interactions_json()]
File ~\miniconda3\envs\qs_mlenv_311\Lib\site-packages\pygtop\targets.py:260, in <listcomp>(.0)
257 return [Interaction(interaction_json) for interaction_json in self._get_interactions_json()
258 if interaction_json["targetSpecies"] and interaction_json["targetSpecies"].lower() == species.lower()]
259 else:
--> 260 return [Interaction(interaction_json) for interaction_json in self._get_interactions_json()]
File ~\miniconda3\envs\qs_mlenv_311\Lib\site-packages\pygtop\interactions.py:47, in Interaction.__init__(self, json_data)
45 self._affinity_low = affinity_values[0] if affinity_values else None
46 self._affinity_high = affinity_values[-1] if affinity_values else None
---> 47 self._affinity_type = json_data["affinityType"]
KeyError: 'affinityType'
Hi all, this library was created as a wrapper around the API when I was working on the Guidetopharmacology team, but I haven't updated it since leaving - it looks the API may have been changed recently. I would recommend interfacing with the web services directly if this is the case: https://www.guidetopharmacology.org/webServices.jsp
I appreciate the feedback, @samirelanduk ! I may fork this and try to get it up and running or just take a crack at using the API directly.
Thanks!
I found a solution. I have simply downloaded the GitHub repository and installed it with:
python setup.py build
python setup.py install
I wanted to loop over families to extract ligands and interactions for each ligand, but when i run ligand.interactions() i get a KeyError. Even the example code presented on the GitHub page does not work. Any ideas?
Thanks Nicola