Global Search with SolveBio clients¶
Global Search allows you to search for vaults, files, folders, and datasets by name, tags, user, date, and other metadata which can be customized. For more information about Global Search please look at Global Search Overview section.
Similarly to Global Search on the web application, the search functionality is available through SolveBio Python and R clients as well.
Please upgrade your Python and R clients
Search functionality is available with the latest versions of the Python client (v2.18.0 or higher) and R client (v2.12.0 or higher).
- To upgrade Python client, run
pip install --upgrade solvebio
- To upgrade R client, run
install.packages("solvebio")
Global Search basics¶
GlobalSearch performs search based on the provided set of parameters (filters, entities, query, limit, ordering, etc.):
query
: Advanced search query stringfilters
: Filters to applyentities
: List of entity tuples to filter on (entity type, entity)limit
: Maximum number of query results to return
Note
: Please see the documentation for the client you're using to find more about the search parameters and functionality.
When no search parameters are provided, it's equivalent to the Global Search page results, on the SolveBio Mesh web application, when no filters, queries or entities are selected:
1 2 3 4 | from solvebio import GlobalSearch # Search returns all objects by default results = GlobalSearch() |
1 2 3 4 5 6 7 | library("solvebio") # By default it limits the number of objects in search result to 100 results <- GlobalSearch.search() # To return all objects set parameter paginate to TRUE results <- GlobalSearch.search(paginate = TRUE) |
You may use the limit
parameter to limit the number of returned objects:
1 2 | # No filters applied with limit parameter results = GlobalSearch(limit = 200) |
1 2 | # No filters applied with limit parameter results <- GlobalSearch.search(limit = 200) |
Applying filters for Global Search¶
Similar as in the web application, where you can apply filters from Filter Dropdown, you can do the same operation with Python and R clients:
1 2 3 4 5 6 7 8 9 10 | from solvebio import GlobalSearch # Global Search object search = GlobalSearch() # Searching only for vaults vaults = search.filter(type__in=["vault"]) # Searching based on date created objects = search.filter(created_at__range=["2021-11-28","2021-12-28"]) |
1 2 3 4 5 6 7 | library("solvebio") # Searching only for vaults response <- GlobalSearch.search(filters = '[{"and":[["type__in",["vault"]]]}]') # Searching based on date created response <- GlobalSearch.search(filters = '[{"and":[{"and":[["created_at__range",["2021-11-21","2021-12-28"]]]}]}]') |
Advanced Search query¶
In the Advanced Search it is explained how users can write their own query using the Query String syntax.
That is also possible to do using Python and R clients by providing query
parameter:
1 2 3 4 5 6 7 | from solvebio import GlobalSearch # Advanced search (using keyword argument) results = GlobalSearch(query="test") # Advanced search (using positional argument) results = GlobalSearch("fuji") |
1 2 3 4 5 6 7 | library("solvebio") # Advanced search (using keyword argument) results <- GlobalSearch.search(query = "test", paginate = TRUE) # Advanced search (using positional argument) results <- GlobalSearch.search("fuji", paginate = TRUE) |
Global Beacon Search¶
Global Beacon Search, that is explained in the Global Beacon Search section, can be performed as well with both clients by using entities
parameter:
1 2 3 4 5 | # Entity search example GlobalSearch(entities=[["gene", "BRCA2"]]) # Entity search example GlobalSearch(entities=[["variant", "GRCH38-7-140753336-140753336-T"]]) |
1 2 3 4 5 | # Entity search example GlobalSearch.search(entities = '[["gene","BRCA2"]]') # Entity search example GlobalSearch.search(entities = '[["variant", "GRCH38-7-140753336-140753336-T"]]') |
Getting the Global Search subjects¶
1 2 3 | # Getting the subjects search = GlobalSearch(entities=[["gene","BRCA2"]]) search.subjects() |
1 2 | # Getting the subjects GlobalSearch.subjects(entities = '[["gene","BRCA2"]]') |
Additional examples¶
To see some additional examples and more details about Python and R client functionality please see the Examples section
: