Skip to content

Saved Queries

Overview

Dataset queries can be saved and then used to make queries on datasets with a similar structure. Saved queries can be created for any dataset and can be shared with members of your organization.

For example, you may save a query for a set of interesting genes. You can then make this query available for all datasets that contain genes. If shared with other users in the organization, they will also be able to apply this query.

These queries can be as complex or simple as you wish.

Using Saved Queries

Saved queries can be used via the SolveBio API or the web UI. The UI will only display queries compatible with the current dataset. This compatibility check is handled automatically by SolveBio.

When viewing a dataset in the web UI, previously saved queries can be retrieved by selecting "Load Filters" and then selecting one. You can save a new query by applying filters to the dataset and then by clicking "Save Filters."

Saved Filter toolbar options

The Saved Queries API

To use a saved query, retrieve the SavedQuery object and then apply the parameters.

1
2
saved_query = SavedQuery.retrieve("SAVED_QUERY_ID")
saved_query.query("<DATASET_ID>")
1
# R Support coming soon...

To create a SavedQuery, define the query parameters and a valid dataset. Give it a name and description.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
params = {
    "entities": [["gene", "MTOR"], ["gene", "BRCA2"], ["gene", "CFTR"]]
}

saved_query = SavedQuery.create(
    name="Interesting Genes",
    description="Interesting genes as defined in Pubmed article 512312"
    dataset_id="<DATASET_ID>",
    params=params
)
1
# R Support coming soon...

Get all Saved Queries that apply to a dataset.

1
SavedQuery.all(dataset="<DATASET_ID>")
1
# R Support coming soon...

Read more about SavedQuery endpoints here.