如何通过NeuroML Database API获取给定通道模型关联的细胞模型?
Great question! I’ve tinkered with the NeuroML Database API before, so let me walk you through the best ways to get the associated cell models for a given channel model.
1. Use the Model Relationships API Endpoint
The NeuroML Database has a functional (though not widely documented) endpoint that directly returns relationships between models. You can use this to fetch all cell models linked to your target channel model in one go.
For example, to get cells associated with NMLCH000001, run this command:
curl "https://neuroml-db.org/api/model_relationships?source_model_id=NMLCH000001&source_model_type=CH"
The response will be a JSON array where each entry includes target_model_id (the NMLCLxxxxxx cell model ID) and target_model_type (marked as "CL"). This is the most efficient method for both single and bulk queries.
2. Reverse-Engineer Cell Model Components
If you need a fallback option, you can query individual cell models and check their components for your target channel:
- First, fetch a list of all cell models:
curl "https://neuroml-db.org/api/models?type=CL" - For each cell model ID (
NMLCLxxxxxx), pull its full details:curl "https://neuroml-db.org/api/models?id=NMLCLxxxxxx" - Look for the
componentsfield in the response—this lists all channel models used by the cell. Match against your target channel ID to find associations.
Note: This method is slower for large-scale work, but works well if you only need to check a handful of cells.
3. Inspect the Website’s Network Requests
Since you saw the associated cell on the channel model’s web page, you can find the exact API call the site uses:
- Open your browser’s Developer Tools (F12) and switch to the "Network" tab.
- Load the channel model page (e.g.,
NMLCH000001). - Look for API requests that fetch associated models—you’ll spot a call to an endpoint like
/api/associated_modelsor similar. You can reuse this endpoint directly in your scripts.
Key Notes
- These endpoints are actively used by the NeuroML Database website, so they’re reliable even if they aren’t listed in official docs.
- For bulk operations, prioritize the model relationships endpoint to avoid redundant API calls.
内容的提问来源于stack exchange,提问作者Vergil R. Haynes

