- Course overview
- Search within this course
- Overview of key IMPC concepts and tools
- Introduction to the Solr API: accessing IMPC data programmatically
- What is Apache Solr?
- Important definitions: query, field, core, document, parameter
- Quiz 2: get yourself familiar with Solr terminology
- What is the difference between an IMPC parameter and a Solr parameter?
- Using simple Solr syntax in your browser
- Output of the simplest request in your browser
- A Python module to access IMPC data: installation and available functions
- Quiz 3: explain Solr request
- Solr query syntax: simplified explanation
- How to use the solr_request function from the impc-api python package
- How to perform a query: q parameter
- Exercise 1: getting familiar with the core
- How to request a limited number of documents: rows parameter
- Exercise 2: requesting three documents
- How to get specific fields: fl parameter
- Exercise 3: selecting specific fields
- Quiz 4: basic Solr parameters
- Filtering data in Solr: narrowing down your results
- How to query a specific field: filter by value
- Exercise 4: filtering by a single field
- How to filter numbers: range search
- Exercise 5: changing the p-value threshold
- How to combine multiple filters: Boolean operators
- Exercise 6: applying multiple filters
- How to exclude data: NOT operator
- Why parentheses are important: combine multiple Boolean operators
- Quiz 5: Boolean operators
- How to handle with null values: exclude empty fields
- Exercise 7: explore null values
- Advanced Solr query techniques: faceting and iterating over entities
- Understanding IMPC data: resources and assistance
- Your feedback
How to download the data: batch_solr_request function
Before downloading anything, start with prototyping using the solr_request function. Once you are confident that you have everything you need in a small dataset, use the batch_solr_request function with the parameter download=True. Other parameters include:
filename— whendownload=True, specify the name of the file without the extension.batch_size— the size of chunks to fetch the data. The default is 5000.
df = batch_solr_request(
core='statistical-result',
params={
'q':'marker_symbol:Prkdc',
'fl': 'marker_symbol,top_level_mp_term_name,effect_size,p_value'
},
download=True,
batch_size=100,
filename='output'
)
When download is set to False, the batch_solr_request function will return the whole dataset as a pandas DataFrame. This can be used for relatively small datasets, fewer than 1,000,000 documents, but for larger datasets, we recommend saving the data and then re-uploading it in Python.
Note: By default, batch_solr_request saves the data in JSON format.