Skip to content

Instantly share code, notes, and snippets.

@david-andrew
Created January 17, 2025 14:52
Show Gist options
  • Save david-andrew/fc83b888a00c806356f40856010ad115 to your computer and use it in GitHub Desktop.
Save david-andrew/fc83b888a00c806356f40856010ad115 to your computer and use it in GitHub Desktop.
vs vanillla adhoc api
>>> can you run code to get gene panel data?
thought: I need more information about the specific gene panel data the user is
interested in to proceed effectively.
tool: ask_user
tool_input: {'query': 'Could you please provide more details about the gene
panel data you are interested in? For example, are you looking for specific
genes, a particular type of analysis, or data from a specific source?'}
Could you please provide more details about the gene panel data you are interested in? For example, are you looking for specific genes, a particular type of analysis, or data from a specific source? $ I'm just doing early exploration, I don't know what I want.
observation: I'm just doing early exploration, I don't know what I want.
thought: I need to check if there are any APIs available that provide gene panel
data or related information.
tool: list_apis
tool_input: {}
observation: {'cbioportal': {'description': "The cBioPortal for Cancer Genomics
was originally developed at \nMemorial Sloan Kettering Cancer Center (MSK). The
public cBioPortal \nsite is hosted by the Center for Molecular Oncology at MSK.
The \ncBioPortal software is now available under an open source license \nvia
GitHub. The software is now developed and maintained by a \nmulti-institutional
team, consisting of MSK, the Dana Farber Cancer \nInstitute, Princess Margaret
Cancer Centre in Toronto, Children's \nHospital of Philadelphia, Caris Life
Sciences, The Hyve and SE4BIO \nin the Netherlands, and Bilkent University in
Ankara, Turkey.\n"}}
thought: I want to understand what gene panel data is available through the
cBioPortal API, as it might be relevant to the user's request.
tool: ask_api
tool_input: {'api': 'cbioportal', 'query': 'What gene panel data is available?'}
INFO {'api': 'cbioportal', 'ASK_API': 'What gene panel data is available?'}
observation: To get information about all available gene panels, you can use the
`/api/gene-panels` endpoint with a GET request. This endpoint will return a list
of all gene panels, including details such as their descriptions and associated
genes. You can also specify the level of detail you want in the response using
the `projection` query parameter, which can be set to "ID", "SUMMARY",
"DETAILED", or "META".
thought: Calling tool 'use_api'
tool: use_api
tool_input: {'api': 'cbioportal', 'goal': 'Retrieve a list of all available gene
panels with detailed information.'}
INFO {'api': 'cbioportal', 'WRITE_CODE': 'Retrieve a list of all available gene panels with detailed information.'}
observation: import requests
base_url = "https://www.cbioportal.org/api"
endpoint = "/api/gene-panels"
params = {
"projection": "DETAILED"
}
response = requests.get(base_url + endpoint, params=params)
if response.status_code == 200:
gene_panels = response.json()
for panel in gene_panels:
print(panel)
else:
print("Failed to retrieve gene panels:", response.status_code)
thought: Calling tool 'run'
tool: run
tool_input: {'code': 'import requests\n\nbase_url =
"https://www.cbioportal.org/api"\nendpoint = "/api/gene-panels"\nparams = {\n
"projection": "DETAILED"\n}\n\nresponse = requests.get(base_url + endpoint,
params=params)\n\nif response.status_code == 200:\n gene_panels =
response.json()\n for panel in gene_panels:\n print(panel)\nelse:\n
print("Failed to retrieve gene panels:", response.status_code)'}
observation: Failed to retrieve gene panels: 404
Error:
Error message:
I attempted to retrieve gene panel data from the cBioPortal API, but encountered a 404 error, indicating that the endpoint may not exist or is incorrect. Without access to the correct API endpoint or further details, I am unable to proceed with retrieving the gene panel data.
Extra details:
Failed to retrieve gene panels: 404
>>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment