BioNeMo icon indicating copy to clipboard operation
BioNeMo copied to clipboard

Error 422 when using Docker-based msa-search API with example code

Open danid77 opened this issue 8 months ago • 0 comments

Hello,

I tried running the following code using your example for the Docker-based msa-search, but encountered an error.

import requests
import json

MSA_HOST = 'http://0.0.0.0:8701'

def main():
    NIM_URL_FULL_PATH = f"{MSA_HOST}/biology/colabfold/msa-search/predict"

    sequence = (
        "MVPSAGQLALFALGIVLAACQALENSTSPLSADPPVAAAVVSHFNDCPDSHTQFCFHGTCRFL"
        "VQEDKPACVCHSGYVGARCEHADLLAVVAASQKKQAITALVVVSIVALAVLIITCVLIHCCQVRKHCEWCR"
        "ALICRHEKPSALLKGRTACCHSETVV"
    )

    headers = {
        "Content-Type": "application/json"
    }

    data = {
        "sequence": sequence,
        "search_type": "colabfold"
    }

    print("Making request to", NIM_URL_FULL_PATH)

    response = requests.post(NIM_URL_FULL_PATH, headers=headers, data=json.dumps(data))

    if response.status_code == 200:
        print("Request was successful.")
        with open('response.json', 'w') as f:
            json.dump(response.json(), f)
    else:
        print(f"Unexpected status code: {response.status_code}")
        print("Response data:", response.text)

if __name__ == "__main__":
    main()

When I run this code, I get the following output:

Making request to http://0.0.0.0:8701/biology/colabfold/msa-search/predict  
Unexpected status code: 422  
Response data: {"detail":"e"}

Could you please let me know what might be causing this issue?

Thank you in advance for your help.

Best regards, SB jin

danid77 avatar Apr 03 '25 00:04 danid77