[Python] How to Efficiently Retrieve Data for Multiple Compounds Using the UniChem API?

Discussão em 'Python' iniciado por Stack, Fevereiro 14, 2025.

  1. Stack

    Stack Membro Participativo

    I'm currently utilizing the UniChem API to retrieve compound data. The get_connectivity method allows for the retrieval of data for a single compound ID at a time. Given that I have approximately one million compound IDs to process, making individual requests for each ID is impractical due to time and resource constraints.

    Is there a way to retrieve information for multiple compounds in a single request or through a more efficient method using the UniChem API? Any guidance or suggestions on how to handle batch retrievals would be greatly appreciated.

    By providing these additional details, you offer potential responders a clearer understanding of your requirements and constraints, which can lead to more targeted and effective solutions.

    I attempted to use a for loop to send individual requests for each compound ID using the get_connectivity method in the UniChem class of the bioservers library. This approach works, but it results in a large number of requests (one million compound IDs = one million requests), which is inefficient and time-consuming. I also checked the methods in the UniChem class of the bioservers library but couldn’t find a method for batch data retrieval. Additionally, it seems that the UniChem API itself does not support returning data for multiple compounds in a single request.

    Continue reading...

Compartilhe esta Página