expr : stage*
stage : model_stage | service_stage | pipe_stage
model_stage : model_step (rma_option_step | filters | includes)*
service_stage : service_step filters
pipe_stage : pipe_step filters
model_step : 'model' '::' ID
rma_step : 'rma' '::' ID
rma_option_step : 'rma' '::' 'option'
attribute_step : ('attribute' '::')? ID
service_step : 'service' '::' ID
pipe_step : 'pipe' '::' ID
filters : ('[' qcolumn operator filter_list ']')+
qcolumn : (ID '.')? ID
operator : '$' ('eq' | 'ne' | 'li' | 'gt' | 'lt' | 'ge' | 'le' | 'in' | 'il' | 'is')
filter_list : filter_element (',' filter_element)*
filter_element : (STRING | REAL | INTEGER | variable | qcolumn | NIL)
includes : attribute_step filters? ('(' include_terms ')')+
include_terms : includes (',' includes)*
STRING : '\'' (.)* '\''
REAL : INTEGER* '.' INTEGER+ ;
INTEGER : DIGIT+;
variable : '$' ID
ID : (ID_START | '*') (ID_CHAR | WILDCARD)*
ID_CHAR ID_START | DIGIT ;
ID_START : ('A'..'Z' | 'a'..'z' | '_' )
DIGIT : '0'..'9'Learn about Connected Services and Pipes with comprehensive guides and examples from Allen Institute for Brain Science.
http://api.brain-map.org/api/v2/data/query.xml?criteria= service::dev_human_correlation[set$eqrna_seq_genes][probes$eq1090294][structures$eq'CBC']
http://api.brain-map.org/api/v2/data/query.xml?criteria= service::dev_human_correlation[set$eqrna_seq_exons][probes$eq279330730][structures$eq'CBC']
Retrieve exon_microarray_genes correlation values for structure with the acronym, "CBC".
http://api.brain-map.org/api/v2/data/query.xml?criteria= service::dev_human_correlation[set$eqexon_microarray_genes][probes$eq9463][structures$eq'CBC']
http://api.brain-map.org/api/v2/data/query.xml?criteria= service::dev_human_correlation[set$eqexon_microarray_exons][probes$eq280550735][structures$eq'CBC']
http://api.brain-map.org/api/v2/data/query.xml?criteria= service::dev_human_differential[set$eq'rna_seq_genes'][structures1$eqDFC][structures2$eqMFC]
http://api.brain-map.org/api/v2/data/query.xml?criteria= service::dev_human_differential[set$eq'rna_seq_genes'][structures1$eqDFC][structures2$eqMFC]
http://api.brain-map.org/api/v2/data/query.xml?criteria= service::dev_human_differential[set$eq'exon_microarray_exons'][structures1$eqDFC][structures2$eqMFC]
http://api.brain-map.org/api/v2/data/query.xml?criteria= service::dev_human_differential[set$eq'exon_microarray_genes'][structures1$eqDFC][structures2$eqMFC]
http://api.brain-map.org/api/v2/data/query.xml?criteria= service::dev_human_expression[set$eq'rna_seq_genes'][probes$eq1090294]
http://api.brain-map.org/api/v2/data/query.xml?criteria= service::dev_human_expression[set$eq'rna_seq_exons'][probes$eq279330730]
http://api.brain-map.org/api/v2/data/query.xml?criteria= service::dev_human_expression[set$eq'exon_microarray_genes'][probes$eq9463]
http://api.brain-map.org/api/v2/data/query.xml?criteria= service::dev_human_expression[set$eq'exon_microarray_exons'][probes$eq280550735]
http://api.brain-map.org/api/v2/data/query.xml?criteria= service::dev_human_microarray_correlation[probes$eq1048426][structures$eqSG]
http://api.brain-map.org/api/v2/data/query.xml?criteria= service::dev_human_microarray_differential[structures1$eqMZ][structures2$eqCP]
http://api.brain-map.org/api/v2/data/query.xml?criteria= service::dev_human_microarray_expression[probes$eq1053223,1053224][donors$eq12566][structures$eq11587]
http://api.brain-map.org/api/v2/data/query.xml?criteria= service::dev_mouse_agea[seed_age$eq'E18.5'][map_age$eq'E15.5'][seed_point$eq4200,2380,2360] [map_threshold$eq0.467,0.657][seed_threshold$eq0.811,0.924]
http://api.brain-map.org/api/v2/data/query.xml?criteria= service::dev_mouse_correlation[row$eq13267][structures$eq'NP'][ages$eq'P14','P28']
http://api.brain-map.org/api/v2/data/query.xml?criteria= service::gbm_correlation[probes$eq3551][structures$eqGBM]
http://api.brain-map.org/api/v2/data/query.xml?criteria= service::gbm_differential[structures1$eqGBM][structures2$eqCTpan]
http://api.brain-map.org/api/v2/data/query.xml?criteria= service::gbm_expression[probes$eq3551][donors$eq703393][structures$eqGBM]
http://api.brain-map.org/api/v2/data/query.xml?criteria= service::gbm_ish_differential[structures1$eqCTpnn][structures2$eqIT]
http://api.brain-map.org/api/v2/data/query.xml?criteria= service::gbm_ish_expression[structures$eqCTpnn][threshold$eq0,100000]
http://api.brain-map.org/api/v2/data/query.xml?criteria= service::human_microarray_correlation[probes$eq1048426][structures$eq'FL']
http://api.brain-map.org/api/v2/data/query.xml?criteria= service::human_microarray_differential[structures1$eq4005][structures2$eq4006]
http://api.brain-map.org/api/v2/data/query.xml?criteria= service::human_microarray_expression[probes$eq1014952][donors$eq9861,10021][structures$eq4079]
http://api.brain-map.org/api/v2/data/query.xml?criteria= service::mouse_agea[set$eqmouse_coronal][seed_age$eqP56][map_age$eqP56][seed_point$eq6800,4200,5600] [correlation_threshold1$eq0.84][correlation_threshold2$eq0.93]
http://api.brain-map.org/api/v2/data/query.xml?criteria= service::mouse_correlation[set$eqmouse][row$eq68918934] http://api.brain-map.org/api/v2/data/query.xml?criteria= service::mouse_correlation[set$eqmouse_coronal][row$eq357096]
http://api.brain-map.org/api/v2/data/query.xml?criteria= service::mouse_differential[set$eq'mouse'][structures1$eq8][structures2$eq315] http://api.brain-map.org/api/v2/data/query.xml?criteria= service::mouse_differential[set$eq'mouse_coronal'][structures1$eq8][structures2$eq315]
http://api.brain-map.org/api/v2/data/query.xml?criteria= service::mouse_connectivity_correlation[row$eq112162251][structures$eqTH][hemisphere$eqright][num_rows$eq100][transgenic_lines$eq0,177838259]
Search for injection sites near a set of 3-D coordinates, ranking the results by their distance from the coordinates.
http://api.brain-map.org/api/v2/data/query.xml?criteria= service::mouse_connectivity_injection_coordinate[seed_point$eq6600,5400,4800][transgenic_lines$eq0]
Search by injection structures, ranking the results the results by signal in the target structures.
http://api.brain-map.org/api/v2/data/query.xml?criteria= service::mouse_connectivity_injection_structure[injection_structures$eqTH][injection_hemisphere$eqRight][target_domain$eqVIS][target_hemisphere$eqRight][transgenic_lines$eq0]
Displays all SectionDataSets with projection signal density >= 0.1 at the seed point. This service also returns the path along the most dense pixels from the seed point to the center of each injection site.
http://api.brain-map.org/api/v2/data/query.xml?criteria= service::mouse_connectivity_target_spatial[seed_point$eq6600,5400,4800][start_row$eq25][num_rows$eq50]
http://api.brain-map.org/api/v2/data/query.xml?criteria= service::nhp_lmd_microarray_correlation[probes$eq30357][structures$eqBN]
http://api.brain-map.org/api/v2/data/query.xml?criteria= service::nhp_lmd_microarray_differential[structures1$eqHF][structures2$eqBN]
http://api.brain-map.org/api/v2/data/query.xml?criteria= service::nhp_lmd_microarray_expression[probes$eq15815]
http://api.brain-map.org/api/v2/data/query.xml?criteria= service::nhp_macro_microarray_correlation[probes$eq49067][structures$eqBN]
http://api.brain-map.org/api/v2/data/query.xml?criteria= service::nhp_macro_microarray_differential[structures1$eqHF][structures2$eqBN]
http://api.brain-map.org/api/v2/data/query.xml?criteria=
service::nhp_macro_microarray_expression[probes$eq15815]
http://api.brain-map.org/api/v2/data/query.xml?criteria= service::tbi_correlation[structures$eqHIP][probes$eq499304660]
http://api.brain-map.org/api/v2/data/query.xml?criteria= service::tbi_differential[structures1$eqFWM][structures2$eqTCx]
http://api.brain-map.org/api/v2/data/query.xml?criteria= service::tbi_expression[donors$eq309335438][structures$eqPCx][probes$eq499304660]
http://api.brain-map.org/api/v2/data/query.xml?criteria= service::text_search[query_string$eq'abat'][k$eqGene]
The output from the previous pipeline stage in json format.
A comma separated list made up of the values found according to the path is assigned to the variable. More than one variable may be assigned in a single list pipe.
A pipe may not be used at the beginning or end of a query pipeline. Pipe::list may be used between model and service stages in any combination. The scope of a variable in a pipe::list stage is from the pipe to the end of the pipeline. Prefix a pipe list variable with a dollar sign ($) to reference it. Use the $in operator when referencing a pipeline variable set by pipe::list because the output is a list.
pipe::list[gene_ids$eq'id'][probe_ids$eq'probes/probe/id']
http://api.brain-map.org/api/v2/data/query.json?criteria=
model::Organism[name$il'*sapiens'],
pipe::list[xorganism_id$eq'id'],
model::Gene[organism_id$in$xorganism_id]
The constant string or variable passed into the input parameter
A string with the substitutions applied is assigned to the output variable.
pipe::replace[pattern$eq'a'][replacement$eq'b'][input$in'abcd'][output$eqexample]
http://api.brain-map.org/api/v2/data/query.json?criteria= model::Structure[acronym$eq'HiF'][ontology_id$eq7], pipe::list[path$eq'structure_id_path'], pipe::replace[pattern$eq'$'][replacement$eq'*'][input$in$path][output$eq'descendents'], model::Structure[structure_id_path$il$descendents][ontology_id$eq7]
The constant string or variable passed into the input parameter
An comma-separated list of input string split where the pattern matched.
pipe::split[pattern$eq'x'][input$in'axbxcxd'][output$eqexample]
http://api.brain-map.org/api/v2/data/query.json?criteria= model::Structure[acronym$eq'HiF'][ontology_id$eq7],pipe::list[path$eq'structure_id_path'],pipe::replace[pattern$eq'(^\/)|(\/$)'][replacement$eq''][input$in$path][output$eq'path'],pipe::split[pattern$eq'/'][input$in$path][output$eq'ancestors'],model::Structure[id$in$ancestors][ontology_id$eq7]
SectionDataSet
Learn about Restful Model Access RMA with comprehensive guides and examples from Allen Institute for Brain Science.

RESTful Model Access (RMA) is an HTTP service designed along RESTful principles to allow access to data in the Allen Institute API. Data model queries support JSON, XML and CSV formats. They can include join, filter, sort, page and eager loading of associations. RMA can also pipe results to perform compound queries and connect to data services. RMA services support JSON and XML formats. The API utility, RMA Query Builder, can be used to compose RMA queries.
The path to the RMA service is /api/v2/data. Other models may be substituted for Organism, such as Gene, Chromosome, or Structure. Model names are always capitalized and singular. The number following the model is a resource id. Valid result formats include JSON (.json), XML (.xml) and CSV (.csv)
http://api.brain-map.org/api/v2/data/[Model]/[Model.id].[json|xml|csv]
Use a browser or other HTTP client to access:
http://api.brain-map.org/api/v2/data/Organism/1.xml
http://api.brain-map.org/api/v2/data/Gene/15.xml
http://api.brain-map.org/api/v2/data/Chromosome/12.json
http://api.brain-map.org/api/v2/data/Structure/4005.xml
Use the keyword query rather than an id to search across all resources in a model.
http://api.brain-map.org/api/v2/data/Organism/query.xml
Use the keyword describe to retrieve information about the available associations for a model. .json format is also available.
http://api.brain-map.org/api/v2/data/Gene/describe.xml
Use the keyword enumerate to retrieve information about all available models and associations. .json format is also available.
http://api.brain-map.org/api/v2/data/enumerate.xml
Use the keyword query without a model or id if the needed information is specified elsewhere in the url. The part after the question mark is explained throughout this document.
http://api.brain-map.org/api/v2/data/query.xml?include=model::Gene[id$eq15]
JSON, XML and CSV formats are supported. For example:
<Response success="true" id="0" start_row="0" num_rows="1" total_rows="1">
<organisms>
<organism>
<id>1</id>
<name>Homo Sapiens</name>
<ncbitaxonomyid>9606</ncbitaxonomyid>
</organism>
</organisms>
</Response>
Resources in the models are associated with other resources. Display this additional information using the include= parameter:
Retrieve details for the Chromosome with ID=12 and include its associated organism:
http://api.brain-map.org/api/v2/data/Chromosome/12.xml?include=organism
The associated information will be nested in the response:
<Response success="true" id="0" start_row="0" num_rows="1" total_rows="1">
<chromosomes>
<chromosome>
<id>15</id>
<name>21</name>
<organism-id>1</organism-id>
<organism>
<id>1</id>
<name>Homo Sapiens</name>
<ncbitaxonomyid>9606</ncbitaxonomyid>
</organism>
</chromosome>
</chromosomes>
</Response>
The include= parameter is discussed in more detail in the RMA Path Syntax section.
Use the criteria parameter to refine the query.
The following criteria will find chromosome resources from the organism with NCBI taxonomy id 9606 (which happens to be Homo Sapiens).
http://api.brain-map.org/api/v2/data/Chromosome/query.xml?criteria=organism[ncbitaxonomyid$eq9606]
The criteria= parameter is discussed in more detail in the RMA Path Syntax section.
Use the only= or except= parameters to restrict the attributes returned in the response. By default the results include all literal attributes of the resource. These options can be applied to model stages, but not service or pipe stages.
http://api.brain-map.org/api/v2/data/Organism/1.xml?only=name
<Response success="true" id="0" start_row="0" num_rows="1" total_rows="1">
<organisms>
<organism>
<name>Homo Sapiens</name>
</organism>
</organisms>
</Response>
Use tabular= to restrict the attributes and also return them in a tabular format. Use ‘as’ to alias an attribute name or ‘distinct’ to eliminate duplicate rows. This option is recommended for accessing data in applications where sorting and paging are used in a tabular, spreadsheet-like display. This option can be applied to model stages, but not service or pipe stages. The csv format is required to be tabular and it defaults to displaying all attributes of the model. If associated models are referenced in the tabular= option, they should be present in a criteria= option as well. The tabular= option masks include= for serialization purposes.
http://api.brain-map.org/api/v2/data/Gene/15.xml?criteria=probes&tabular=distinct%20genes.name%20as%20gene_name,probes.name%20as%20probe_name
<Response success="true" id="0" start_row="0" num_rows="15" total_rows="15">
<hash>
<gene-name>4-aminobutyrate aminotransferase</gene-name>
<probe-name>RP_100125_04_D02</probe-name>
</hash>
.....
</Response>
Limit the number of results by using the start_row=, num_rows= and order= URL parameters. Use num_rows=all to retrieve all records (not recommended for large queries). The response body contains information about the progress of paging. Use count=false if you do not want paging information returned in the response.
http://api.brain-map.org/api/v2/data/[Model]/query.xml?num_rows=[#]&start_row=[#]&order=[...]
Request the first Product by specifying start_row=0:
http://api.brain-map.org/api/v2/data/Product/query.xml?start_row=0&num_rows=1
Request 10 Products beginning with the 20th row, and order by the Products’ names:
http://api.brain-map.org/api/v2/data/Product/query.xml?num_rows=10&start_row=20&order=products.name
RMA uses the ActiveRecord Query Interface.
The filter clauses in both the criteria= parameter and the includes= parameter are treated as an AR Query where() argument. They can be thought of as an SQL where clause combined with the boolean ‘and’ operation.
Models are similar to SQL tables, attributes correspond to literal SQL columns and associations can be thought of as SQL foreign keys.
Learn about Quantified Data By Structures with comprehensive guides and examples from Allen Institute for Brain Science.

Data from our large scale gene expression and connectivity products is processed through an informatics data analysis pipeline to obtain spatially mapped quantified expression/projection information.
Quantified data is available for the following:



The output of the pipeline are quantified values at a grid voxel level. Quantified values can be computed for each structure delineated in the associated reference atlas by combining or unionizing grid voxels with the same 3-D structural label. While the reference atlas is typically annotated at the lowest level of the ontology tree, statistics at upper level structures can be obtained by combining measurements of the hierarchical children to obtain statistics for the parent structure.
Expression statistics are encapsulated as a StructureUnionize object associated with one Structure and one SectionDataSet.
Projection statistics are encapsulated as a ProjectionStructureUnionize object associated with one Structure, either left, right or both Hemispheres and one SectionDataSet.
StructureUnionize and ProjectionStructureUnionize data can be downloaded via RMA and are used in the web application to display expression summary bar graphs for a set of coarse structures. Its usage is also demonstrated in the “structure networks” example application.
Refer to the atlas API pages for further details.
