├── .Rbuildignore ├── .gitignore ├── CONTRIBUTION ├── DESCRIPTION ├── LICENSE ├── NAMESPACE ├── R ├── aba_ish.R ├── aba_svg.R ├── constants.R ├── mouse_ccf_meshes.R ├── nrrd.R ├── ontology.R ├── raw_ccf.R └── rgl_plots.R ├── README.md ├── _pkgdown.yml ├── cocoframer.Rproj ├── docs ├── LICENSE-text.html ├── authors.html ├── docsearch.css ├── docsearch.js ├── index.html ├── link.svg ├── pkgdown.css ├── pkgdown.js ├── pkgdown.yml └── reference │ ├── aibs_dims.html │ ├── aibs_organism_id.html │ ├── ccf_2017_color.html │ ├── ccf_2017_mesh.html │ ├── cleanup_taxons.html │ ├── compute_hierarchical.html │ ├── filter_mba_ontology_children.html │ ├── flatten_mba_ontology.html │ ├── generate_mba_taxons.html │ ├── generate_taxons.html │ ├── get_aba_ish_data.html │ ├── get_aba_ish_structure_data.html │ ├── get_ccf_annotation.html │ ├── get_ccf_grid_annotation.html │ ├── get_exp_gene_relationships.html │ ├── get_gene_aba_ish_ids.html │ ├── get_mba_ontology.html │ ├── hello.html │ ├── index.html │ ├── mba_structure_id.html │ ├── obj_to_mesh.html │ ├── plot_ccf_meshes.html │ ├── plot_ccf_structure_points.html │ ├── read_aibs_nrrd.html │ ├── read_rgl_mesh_zip.html │ ├── save_rgl_mesh_zip.html │ └── slice_ccf_arr.html ├── inst └── extdata │ ├── ccf_2017_meshes.zip │ ├── generate_mesh_store.R │ └── mba_structure_id_to_acronym.csv ├── man ├── aibs_dims.Rd ├── aibs_organism_id.Rd ├── ccf_2017_color.Rd ├── ccf_2017_mesh.Rd ├── cleanup_taxons.Rd ├── compute_hierarchical.Rd ├── figures │ ├── readme_ca.png │ ├── readme_ca_colors.png │ ├── readme_cartoon.png │ ├── readme_matte.png │ ├── readme_mo_th_p.png │ ├── readme_shiny.png │ ├── readme_within_th.png │ └── rotate_demo.gif ├── filter_mba_ontology_children.Rd ├── flatten_mba_ontology.Rd ├── generate_mba_taxons.Rd ├── generate_taxons.Rd ├── get_aba_ish_data.Rd ├── get_aba_ish_structure_data.Rd ├── get_ccf_annotation.Rd ├── get_ccf_grid_annotation.Rd ├── get_exp_gene_relationships.Rd ├── get_gene_aba_ish_ids.Rd ├── get_mba_ontology.Rd ├── mba_structure_id.Rd ├── obj_to_mesh.Rd ├── plot_ccf_meshes.Rd ├── plot_ccf_structure_points.Rd ├── read_aibs_nrrd.Rd ├── read_rgl_mesh_zip.Rd ├── save_rgl_mesh_zip.Rd └── slice_ccf_arr.Rd ├── misc └── generate_readme_images.R └── testing └── cocoframer_demo.R /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^.*\.Rproj$ 2 | ^\.Rproj\.user$ 3 | ^_pkgdown\.yml$ 4 | ^docs$ 5 | ^pkgdown$ 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .Rproj.user 2 | .Rhistory 3 | .RData 4 | .Ruserdata 5 | -------------------------------------------------------------------------------- /CONTRIBUTION: -------------------------------------------------------------------------------- 1 | Allen Institute Contribution Agreement 2 | 3 | This document describes the terms under which you may make “Contributions” — which may include without limitation, software additions, revisions, bug fixes, configuration changes, documentation, or any other materials — to any of the projects owned or managed by the Allen Institute. If you have questions about these terms, please contact us at terms@alleninstitute.org. 4 | 5 | You certify that: 6 | 7 | • Your Contributions are either: 8 | 1. Created in whole or in part by you and you have the right to submit them under the designated license (described below); or 9 | 2. Based upon previous work that, to the best of your knowledge, is covered under an appropriate open source license and you have the right under that license to submit that work with modifications, whether created in whole or in part by you, under the designated license; or 10 | 3. Provided directly to you by some other person who certified (1) or (2) and you have not modified them. 11 | 12 | • You are granting your Contributions to the Allen Institute under the terms of the 2-Clause BSD license (the “designated license”). 13 | 14 | • You understand and agree that the Allen Institute projects and your Contributions are public and that a record of the Contributions (including all metadata and personal information you submit with them) is maintained indefinitely and may be redistributed consistent with the Allen Institute’s mission and the 2-Clause BSD license. 15 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: cocoframer 2 | Type: Package 3 | Title: COmmon COordinate FRAMEwork in R 4 | Version: 0.1.1 5 | Author: Lucas Graybuck 6 | Maintainer: Lucas Graybuck 7 | Description: Functions for working with the Allen Institute Common Coordinate Framework in R 8 | License: see file LICENSE 9 | Encoding: UTF-8 10 | LazyData: true 11 | RoxygenNote: 6.1.1 12 | Imports: 13 | dplyr, 14 | jsonlite, 15 | magrittr, 16 | purrr, 17 | rbokeh, 18 | reshape2, 19 | rgl 20 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Allen Institute Software License - This software license is the 2-clause BSD license 2 | plus a third clause that prohibits redistribution for commercial purposes without further permission. 3 | 4 | Copyright (c) 2018. Allen Institute. All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 7 | following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 10 | following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 13 | following disclaimer in the documentation and/or other materials provided with the distribution. 14 | 15 | 3. Redistributions for commercial purposes are not permitted without the Allen Institute's written permission. 16 | For purposes of this license, commercial purposes is the incorporation of the Allen Institute's software into 17 | anything for which you will charge fees or other compensation. Contact terms@alleninstitute.org for commercial 18 | licensing opportunities. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 21 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 25 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 26 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | export(aibs_dims) 4 | export(aibs_organism_id) 5 | export(ccf_2017_color) 6 | export(ccf_2017_mesh) 7 | export(cleanup_taxons) 8 | export(compute_hierarchical) 9 | export(filter_mba_ontology_children) 10 | export(flatten_mba_ontology) 11 | export(generate_mba_taxons) 12 | export(generate_taxons) 13 | export(get_aba_ish_data) 14 | export(get_aba_ish_structure_data) 15 | export(get_ccf_annotation) 16 | export(get_ccf_grid_annotation) 17 | export(get_exp_gene_relationships) 18 | export(get_gene_aba_ish_ids) 19 | export(get_mba_ontology) 20 | export(mba_structure_id) 21 | export(obj_to_mesh) 22 | export(plot_ccf_meshes) 23 | export(plot_ccf_structure_points) 24 | export(read_aibs_nrrd) 25 | export(read_rgl_mesh_zip) 26 | export(save_rgl_mesh_zip) 27 | export(slice_ccf_arr) 28 | -------------------------------------------------------------------------------- /R/aba_svg.R: -------------------------------------------------------------------------------- 1 | get_aba_panel_ids <- function() { 2 | get_ids <- "http://api.brain-map.org/api/v2/data/query.csv?criteria= 3 | model::AtlasImage, 4 | rma::criteria,atlas_data_set(atlases[id$eq602630314]),graphic_objects(graphic_group_label[id$eq28]), 5 | rma::options[tabular$eq'sub_images.id'][order$eq'sub_images.id'] 6 | &num_rows=all&start_row=0" 7 | 8 | get_ids <- gsub("[ \n]+","",get_ids) 9 | 10 | read.csv(url(get_ids))$id 11 | } 12 | 13 | get_aba_svg <- function(ids, 14 | downsample) { 15 | downsample <- as.character(downsample) 16 | 17 | id_urls <- paste0("http://api.brain-map.org/api/v2/svg/", 18 | ids, 19 | "?downsample=",downsample) 20 | 21 | in_con <- curl(id_urls, open = "r") 22 | svg_lines <- suppressWarnings(readLines(in_con)) 23 | close(in_con) 24 | 25 | return(svg_lines) 26 | } 27 | 28 | save_aba_svgs <- function(ids = NULL, 29 | out_dir, 30 | downsample = 4, 31 | remove_colors = FALSE) { 32 | 33 | if(is.null(ids)) { 34 | ids <- get_aba_panel_ids() 35 | } 36 | 37 | for(i in 1:length(ids)) { 38 | svg_lines <- get_aba_svg(ids[i]) 39 | 40 | if(remove_colors) { 41 | svg_lines <- gsub("fill:#.{6}","fill:#ffffff",svg_lines) 42 | } 43 | 44 | out_con <- file(paste0(ids[i],".svg"), open = "w") 45 | writeLines(svg_lines, out_con) 46 | close(out_con) 47 | } 48 | 49 | } 50 | 51 | svg_to_tags <- function(x) { 52 | unlist(strsplit(x, "><")) 53 | } 54 | 55 | aba_svg_tags_to_list <- function(x) { 56 | split_on_space <- unlist(strsplit(x,"\" ")) 57 | no_quotes <- gsub("\"","",split_on_space) 58 | no_brackets <- sub("% 87 | filter(!(x == lag(x) & x == lead(x))) %>% 88 | filter(!(y == lag(y) & y == lead(y))) 89 | 90 | df 91 | } else { 92 | NULL 93 | } 94 | } 95 | 96 | aba_svg_list_to_attr <- function(x) { 97 | keep <- names(x) != "d" 98 | out_list <- x[keep] 99 | if("style" %in% names(out_list)) { 100 | style <- out_list$style 101 | style <- gsub("/","",style) 102 | styles <- unlist(strsplit(style, ";")) 103 | color <- sub("stroke:","",styles[grepl("stroke:",styles)]) 104 | fill <- sub("fill:","",styles[grepl("fill:",styles)]) 105 | out_list$color <- color 106 | out_list$fill <- fill 107 | } 108 | out_list 109 | } 110 | 111 | aba_svg_coords_to_segs <- function(df) { 112 | if(!is.null(df)) { 113 | 114 | points <- df 115 | 116 | segs <- data.frame(x = points$x, 117 | y = points$y, 118 | xend = lead(points$x), 119 | yend = lead(points$y)) 120 | 121 | segs <- segs[-nrow(segs),] 122 | 123 | last_seg <- data.frame(x = segs$xend[nrow(segs)], 124 | y = segs$yend[nrow(segs)], 125 | xend = segs$x[1], 126 | yend = segs$y[1]) 127 | 128 | segs <- rbind(segs, last_seg) 129 | segs 130 | } 131 | } 132 | 133 | plot_aba_svg_coords <- function(svg_coords, 134 | svg_attr, 135 | min_pts = 20) { 136 | # remove nulls 137 | keep_coords <- !map_lgl(svg_coords, is.null) 138 | svg_coords <- svg_coords[keep_coords] 139 | svg_attr <- svg_attr[keep_coords] 140 | 141 | keep_coords <- map_int(svg_coords, nrow) >= min_pts 142 | svg_coords <- svg_coords[keep_coords] 143 | svg_attr <- svg_attr[keep_coords] 144 | 145 | plot_data <- map2_dfr(svg_coords, 146 | svg_attr, 147 | function(x, y) { 148 | out <- x 149 | out$fill <- y$fill 150 | out$color <- y$color 151 | out$id <- y$id 152 | out$order <- y$order 153 | out 154 | }) 155 | 156 | plot_list <- split(plot_data, plot_data$order) 157 | 158 | p <- ggplot() + 159 | scale_fill_identity() + 160 | scale_color_identity() + 161 | scale_y_reverse() + 162 | theme_void() 163 | 164 | for(i in 1:length(plot_list)) { 165 | p <- p + 166 | geom_polygon(data = plot_list[[i]], 167 | aes(x = x, 168 | y = y, 169 | group = id, 170 | fill = fill, 171 | color = color)) 172 | } 173 | 174 | p 175 | } 176 | -------------------------------------------------------------------------------- /R/constants.R: -------------------------------------------------------------------------------- 1 | #' Dimensions for AIBS CCF data at different resolutions 2 | #' 3 | #' Data at 1um: CCF Meshes 4 | #' Data at 25um: Annotation grids and most gridded TissueCyte datasets 5 | #' Data at 200um: Gridded ISH datasets and related annotations 6 | #' 7 | #' @param res The resolution of the dataset. Can be "1um","25um", or "200um". Default is "25um". 8 | #' 9 | #' @export 10 | #' 11 | #' @return a 3-element integer vector with the x,y,z dimensions. 12 | #' 13 | #' x is anterior<->posterior 14 | #' y is ventral<->dorsal 15 | #' z is left<->right 16 | #' 17 | aibs_dims <- function(res = "25um") { 18 | if(res == "1um") { 19 | c(13200, 8000, 11400) 20 | } else if(res == "25um") { 21 | c(528, 320, 456) 22 | } else if(res == "200um") { 23 | c(67, 41, 58) 24 | } 25 | } 26 | 27 | #' Organism ID used by the AIBS API 28 | #' 29 | #' @param species character, which species to use. Currently available: "human" and "mouse". 30 | #' 31 | #' @export 32 | #' 33 | #' @return a numeric value used by the AIBS API to represent the selected organism. 34 | aibs_organism_id <- function(species) { 35 | if(species %in% c("human","Homo sapiens","homo sapiens","hs","Hs")) { 36 | 1 37 | } else if(species %in% c("mouse","Mus musculus","mus musculus","mm","Mm")) { 38 | 2 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /R/nrrd.R: -------------------------------------------------------------------------------- 1 | #' Read AIBS .nrrd files 2 | #' 3 | #' This function reads the .nrrd format used by 4 | #' AIBS, containing 32-bit integer values with 15 header lines. 5 | #' 6 | #' @param file The .nrrd file to read 7 | #' @param dims The dimensions of the array. Default is for 25 nm CCF arrays: c(528,320,456) 8 | #' @param header_lines The number of header lines in the .nrrd file. Default is 15. 9 | #' 10 | #' @return a 3 dimensional integer array with dims 11 | #' 12 | #' @export 13 | read_aibs_nrrd <- function (file, 14 | dims = c(528, 320, 456), 15 | header_lines = 15) 16 | { 17 | con <- file(file, "rb") 18 | 19 | # skip header lines 20 | h <- readLines(con, n = header_lines) 21 | 22 | # data is gzipped 23 | fc <- gzcon(con) 24 | d <- readBin(con, 25 | what = "integer", 26 | n = prod(dims), 27 | size = 4, 28 | endian = "little") 29 | 30 | close(con) 31 | 32 | array(d, dim = dims) 33 | 34 | } 35 | -------------------------------------------------------------------------------- /R/raw_ccf.R: -------------------------------------------------------------------------------- 1 | #' Download the CCF Annotation object and return a 3D Array of values 2 | #' 3 | #' This annotation is at 25 um resolution, and is used for brain atlas annotations. 4 | #' 5 | #' No parameters 6 | #' 7 | #' @export 8 | #' 9 | #' @return a 3-dimensional array with 25 micron resolution. Dimension are: 10 | #' \itemize{ 11 | #' \item x, 528: anterior/posterior 12 | #' \item y, 320: superior/inferior 13 | #' \item z, 456: left/right 14 | #' } 15 | get_ccf_annotation <- function() { 16 | # CCF Annotation Dimensions 17 | vol_dims <- aibs_dims("25um") 18 | # Download and read the CCF Annotation coordinates 19 | temp <- tempfile() 20 | download.file("http://download.alleninstitute.org/informatics-archive/current-release/mouse_annotation/P56_Mouse_annotation.zip", temp) 21 | 22 | raw_file <- unz(temp, "annotation.raw", "rb") 23 | vol_raw <- readBin(raw_file, "integer", size = 4, n = vol_dims[1]*vol_dims[2]*vol_dims[3]) 24 | close(raw_file) 25 | 26 | file.remove(temp) 27 | 28 | array(vol_raw, dim = vol_dims) 29 | } 30 | 31 | #' Download the CCF Grid Annotation object and return a 3D Array of values 32 | #' 33 | #' This annotation is at 200 um resolution, and is used for gene expression atlas data. 34 | #' 35 | #' No parameters 36 | #' 37 | #' @export 38 | #' 39 | #' @return a 3-dimensional array with 200 micron resolution. Dimension are: 40 | #' \itemize{ 41 | #' \item x, 67: anterior/posterior 42 | #' \item y, 41: superior/inferior 43 | #' \item z, 58: left/right 44 | #' } 45 | get_ccf_grid_annotation <- function() { 46 | # CCF Annotation Dimensions 47 | vol_dims <- aibs_dims("200um") 48 | # Download and read the CCF Annotation coordinates 49 | temp <- tempfile() 50 | download.file("http://download.alleninstitute.org/informatics-archive/current-release/mouse_annotation/P56_Mouse_gridAnnotation.zip", temp) 51 | 52 | raw_file <- unz(temp, "gridAnnotation.raw", "rb") 53 | vol_raw <- readBin(raw_file, "integer", size = 4, n = vol_dims[1]*vol_dims[2]*vol_dims[3]) 54 | close(raw_file) 55 | 56 | file.remove(temp) 57 | 58 | array(vol_raw, dim = vol_dims) 59 | } 60 | -------------------------------------------------------------------------------- /R/rgl_plots.R: -------------------------------------------------------------------------------- 1 | #' Plot a 3D CCF structure specified by its structure ID as points 2 | #' 3 | #' @param ccf_arr a CCF annotation array 4 | #' @param structure_id The ID number of the desired CCF structure 5 | #' 6 | #' @export 7 | #' 8 | #' @return An rgl points3d plot 9 | plot_ccf_structure_points <- function(ccf_arr, 10 | structure_id) { 11 | 12 | vol_melt <- reshape2::melt(ccf_arr) 13 | vol_melt <- vol_melt[vol_melt$value > 0,] 14 | 15 | if(!structure_id %in% unique(vol_melt$value)) { 16 | stop("Structure not found in ccf_arr.") 17 | } 18 | 19 | str_melt <- vol_melt[vol_melt$value == structure_id,] 20 | 21 | rgl::points3d(str_melt$Var1,str_melt$Var2,str_melt$Var3) 22 | 23 | } 24 | 25 | 26 | #' Plot 3D structures from the CCF 27 | #' 28 | #' @param mesh_list a named list of one or more 3D mesh objects 29 | #' @param fg_structure The name(s) of the structure to plot as a foreground (solid) object. 30 | #' @param fg_color The color to use for the foreground object (default is NULL, which retains mesh material). 31 | #' @param fg_alpha The alpha/opacity of the foreground object (default is 1). 32 | #' @param bg_structure The name(s) of the structure to plot as a background (semitransparent) object. 33 | #' @param bg_color The color to use for the background object (default is NULL, which retains mesh material). 34 | #' @param bg_alpha The alpha/opacity of the background object (default is 0.2) 35 | #' @param style The overall style of the structures. Can be "shiny","matte", "cartoon", or "none". "none" will not modify the existing rgl.material settings for the meshes. 36 | #' 37 | #' @return a 3D plot in an RGL window. 38 | #' 39 | #' @export 40 | plot_ccf_meshes <- function(mesh_list, 41 | fg_structure, 42 | fg_color = NULL, 43 | fg_alpha = 1, 44 | bg_structure = NULL, 45 | bg_color = NULL, 46 | bg_alpha = 0.2, 47 | style = "shiny") { 48 | 49 | style <- match.arg(style, 50 | choices = c("shiny","matte","cartoon","none")) 51 | 52 | 53 | if(is.null(bg_structure)) { 54 | meshes <- mesh_list[fg_structure] 55 | } else { 56 | meshes <- mesh_list[c(fg_structure, 57 | bg_structure)] 58 | if(!is.null(bg_color)) { 59 | bg_colors <- rep(bg_color, length.out = length(bg_structure)) 60 | } 61 | bg_alphas <- rep(bg_alpha, length.out = length(bg_structure)) 62 | 63 | for(i in seq_along(bg_structure)) { 64 | if(is.null(bg_color)) { 65 | meshes[[bg_structure[i]]]$material$alpha <- bg_alphas[i] 66 | } else { 67 | meshes[[bg_structure[i]]]$material$color <- bg_colors[i] 68 | meshes[[bg_structure[i]]]$material$alpha <- bg_alphas[i] 69 | } 70 | 71 | } 72 | 73 | } 74 | 75 | if(!is.null(fg_color)) { 76 | fg_colors <- rep(fg_color, length.out = length(fg_structure)) 77 | } 78 | fg_alphas <- rep(fg_alpha, length.out = length(fg_structure)) 79 | 80 | for(i in seq_along(fg_structure)) { 81 | if(is.null(fg_color)) { 82 | meshes[[fg_structure[i]]]$material$alpha <- fg_alphas[i] 83 | } else { 84 | meshes[[fg_structure[i]]]$material$color <- fg_colors[i] 85 | meshes[[fg_structure[i]]]$material$alpha <- fg_alphas[i] 86 | } 87 | 88 | } 89 | 90 | if(style == "shiny") { 91 | for(i in seq_along(meshes)) { 92 | meshes[[i]]$material$specular <- "white" 93 | meshes[[i]]$material$shininess <- 50 94 | } 95 | } else if(style == "matte") { 96 | for(i in seq_along(meshes)) { 97 | meshes[[i]]$material$specular <- "black" 98 | } 99 | } else if(style == "cartoon") { 100 | for(i in seq_along(meshes)) { 101 | meshes[[i]]$material$lit <- FALSE 102 | } 103 | } 104 | 105 | rgl::view3d(theta = -45, phi = 35, zoom = 0.7) 106 | 107 | rgl::shapelist3d(meshes, 108 | box = FALSE, 109 | axes = FALSE, 110 | xlab = "", ylab = "", zlab = "") 111 | } 112 | -------------------------------------------------------------------------------- /_pkgdown.yml: -------------------------------------------------------------------------------- 1 | destination: docs 2 | -------------------------------------------------------------------------------- /cocoframer.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: Default 4 | SaveWorkspace: Default 5 | AlwaysSaveHistory: Default 6 | 7 | EnableCodeIndexing: Yes 8 | UseSpacesForTab: Yes 9 | NumSpacesForTab: 2 10 | Encoding: UTF-8 11 | 12 | RnwWeave: Sweave 13 | LaTeX: pdfLaTeX 14 | 15 | AutoAppendNewline: Yes 16 | StripTrailingWhitespace: Yes 17 | 18 | BuildType: Package 19 | PackageUseDevtools: Yes 20 | PackageInstallArgs: --no-multiarch --with-keep.source 21 | -------------------------------------------------------------------------------- /docs/LICENSE-text.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | License • cocoframer 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 45 | 46 | 47 | 48 | 49 | 50 |
51 |
52 | 87 | 88 | 89 |
90 | 91 |
92 |
93 | 96 | 97 |
Allen Institute Software License - This software license is the 2-clause BSD license
 98 | plus a third clause that prohibits redistribution for commercial purposes without further permission.
 99 | 
100 | Copyright (c) 2018. Allen Institute. All rights reserved.
101 | 
102 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
103 | following conditions are met:
104 | 
105 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
106 | following disclaimer.
107 | 
108 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
109 | following disclaimer in the documentation and/or other materials provided with the distribution.
110 | 
111 | 3. Redistributions for commercial purposes are not permitted without the Allen Institute's written permission.
112 | For purposes of this license, commercial purposes is the incorporation of the Allen Institute's software into
113 | anything for which you will charge fees or other compensation. Contact terms@alleninstitute.org for commercial
114 | licensing opportunities.
115 | 
116 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
117 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
118 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
119 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
120 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
121 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
122 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
123 | 
124 | 125 |
126 | 127 |
128 | 129 | 130 |
131 | 134 | 135 |
136 |

Site built with pkgdown 1.3.0.

137 |
138 |
139 |
140 | 141 | 142 | 143 | 144 | 145 | 146 | -------------------------------------------------------------------------------- /docs/authors.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Authors • cocoframer 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 45 | 46 | 47 | 48 | 49 | 50 |
51 |
52 | 87 | 88 | 89 |
90 | 91 |
92 |
93 | 96 | 97 |
    98 |
  • 99 |

    Lucas Graybuck. Maintainer. 100 |

    101 |
  • 102 |
103 | 104 |
105 | 106 |
107 | 108 | 109 |
110 | 113 | 114 |
115 |

Site built with pkgdown 1.3.0.

116 |
117 |
118 |
119 | 120 | 121 | 122 | 123 | 124 | 125 | -------------------------------------------------------------------------------- /docs/docsearch.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | 3 | // register a handler to move the focus to the search bar 4 | // upon pressing shift + "/" (i.e. "?") 5 | $(document).on('keydown', function(e) { 6 | if (e.shiftKey && e.keyCode == 191) { 7 | e.preventDefault(); 8 | $("#search-input").focus(); 9 | } 10 | }); 11 | 12 | $(document).ready(function() { 13 | // do keyword highlighting 14 | /* modified from https://jsfiddle.net/julmot/bL6bb5oo/ */ 15 | var mark = function() { 16 | 17 | var referrer = document.URL ; 18 | var paramKey = "q" ; 19 | 20 | if (referrer.indexOf("?") !== -1) { 21 | var qs = referrer.substr(referrer.indexOf('?') + 1); 22 | var qs_noanchor = qs.split('#')[0]; 23 | var qsa = qs_noanchor.split('&'); 24 | var keyword = ""; 25 | 26 | for (var i = 0; i < qsa.length; i++) { 27 | var currentParam = qsa[i].split('='); 28 | 29 | if (currentParam.length !== 2) { 30 | continue; 31 | } 32 | 33 | if (currentParam[0] == paramKey) { 34 | keyword = decodeURIComponent(currentParam[1].replace(/\+/g, "%20")); 35 | } 36 | } 37 | 38 | if (keyword !== "") { 39 | $(".contents").unmark({ 40 | done: function() { 41 | $(".contents").mark(keyword); 42 | } 43 | }); 44 | } 45 | } 46 | }; 47 | 48 | mark(); 49 | }); 50 | }); 51 | 52 | /* Search term highlighting ------------------------------*/ 53 | 54 | function matchedWords(hit) { 55 | var words = []; 56 | 57 | var hierarchy = hit._highlightResult.hierarchy; 58 | // loop to fetch from lvl0, lvl1, etc. 59 | for (var idx in hierarchy) { 60 | words = words.concat(hierarchy[idx].matchedWords); 61 | } 62 | 63 | var content = hit._highlightResult.content; 64 | if (content) { 65 | words = words.concat(content.matchedWords); 66 | } 67 | 68 | // return unique words 69 | var words_uniq = [...new Set(words)]; 70 | return words_uniq; 71 | } 72 | 73 | function updateHitURL(hit) { 74 | 75 | var words = matchedWords(hit); 76 | var url = ""; 77 | 78 | if (hit.anchor) { 79 | url = hit.url_without_anchor + '?q=' + escape(words.join(" ")) + '#' + hit.anchor; 80 | } else { 81 | url = hit.url + '?q=' + escape(words.join(" ")); 82 | } 83 | 84 | return url; 85 | } 86 | -------------------------------------------------------------------------------- /docs/link.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 12 | 13 | -------------------------------------------------------------------------------- /docs/pkgdown.css: -------------------------------------------------------------------------------- 1 | /* Sticky footer */ 2 | 3 | /** 4 | * Basic idea: https://philipwalton.github.io/solved-by-flexbox/demos/sticky-footer/ 5 | * Details: https://github.com/philipwalton/solved-by-flexbox/blob/master/assets/css/components/site.css 6 | * 7 | * .Site -> body > .container 8 | * .Site-content -> body > .container .row 9 | * .footer -> footer 10 | * 11 | * Key idea seems to be to ensure that .container and __all its parents__ 12 | * have height set to 100% 13 | * 14 | */ 15 | 16 | html, body { 17 | height: 100%; 18 | } 19 | 20 | body > .container { 21 | display: flex; 22 | height: 100%; 23 | flex-direction: column; 24 | 25 | padding-top: 60px; 26 | } 27 | 28 | body > .container .row { 29 | flex: 1 0 auto; 30 | } 31 | 32 | footer { 33 | margin-top: 45px; 34 | padding: 35px 0 36px; 35 | border-top: 1px solid #e5e5e5; 36 | color: #666; 37 | display: flex; 38 | flex-shrink: 0; 39 | } 40 | footer p { 41 | margin-bottom: 0; 42 | } 43 | footer div { 44 | flex: 1; 45 | } 46 | footer .pkgdown { 47 | text-align: right; 48 | } 49 | footer p { 50 | margin-bottom: 0; 51 | } 52 | 53 | img.icon { 54 | float: right; 55 | } 56 | 57 | img { 58 | max-width: 100%; 59 | } 60 | 61 | /* Fix bug in bootstrap (only seen in firefox) */ 62 | summary { 63 | display: list-item; 64 | } 65 | 66 | /* Typographic tweaking ---------------------------------*/ 67 | 68 | .contents .page-header { 69 | margin-top: calc(-60px + 1em); 70 | } 71 | 72 | /* Section anchors ---------------------------------*/ 73 | 74 | a.anchor { 75 | margin-left: -30px; 76 | display:inline-block; 77 | width: 30px; 78 | height: 30px; 79 | visibility: hidden; 80 | 81 | background-image: url(./link.svg); 82 | background-repeat: no-repeat; 83 | background-size: 20px 20px; 84 | background-position: center center; 85 | } 86 | 87 | .hasAnchor:hover a.anchor { 88 | visibility: visible; 89 | } 90 | 91 | @media (max-width: 767px) { 92 | .hasAnchor:hover a.anchor { 93 | visibility: hidden; 94 | } 95 | } 96 | 97 | 98 | /* Fixes for fixed navbar --------------------------*/ 99 | 100 | .contents h1, .contents h2, .contents h3, .contents h4 { 101 | padding-top: 60px; 102 | margin-top: -40px; 103 | } 104 | 105 | /* Static header placement on mobile devices */ 106 | @media (max-width: 767px) { 107 | .navbar-fixed-top { 108 | position: absolute; 109 | } 110 | .navbar { 111 | padding: 0; 112 | } 113 | } 114 | 115 | 116 | /* Sidebar --------------------------*/ 117 | 118 | #sidebar { 119 | margin-top: 30px; 120 | } 121 | #sidebar h2 { 122 | font-size: 1.5em; 123 | margin-top: 1em; 124 | } 125 | 126 | #sidebar h2:first-child { 127 | margin-top: 0; 128 | } 129 | 130 | #sidebar .list-unstyled li { 131 | margin-bottom: 0.5em; 132 | } 133 | 134 | .orcid { 135 | height: 16px; 136 | vertical-align: middle; 137 | } 138 | 139 | /* Reference index & topics ----------------------------------------------- */ 140 | 141 | .ref-index th {font-weight: normal;} 142 | 143 | .ref-index td {vertical-align: top;} 144 | .ref-index .icon {width: 40px;} 145 | .ref-index .alias {width: 40%;} 146 | .ref-index-icons .alias {width: calc(40% - 40px);} 147 | .ref-index .title {width: 60%;} 148 | 149 | .ref-arguments th {text-align: right; padding-right: 10px;} 150 | .ref-arguments th, .ref-arguments td {vertical-align: top;} 151 | .ref-arguments .name {width: 20%;} 152 | .ref-arguments .desc {width: 80%;} 153 | 154 | /* Nice scrolling for wide elements --------------------------------------- */ 155 | 156 | table { 157 | display: block; 158 | overflow: auto; 159 | } 160 | 161 | /* Syntax highlighting ---------------------------------------------------- */ 162 | 163 | pre { 164 | word-wrap: normal; 165 | word-break: normal; 166 | border: 1px solid #eee; 167 | } 168 | 169 | pre, code { 170 | background-color: #f8f8f8; 171 | color: #333; 172 | } 173 | 174 | pre code { 175 | overflow: auto; 176 | word-wrap: normal; 177 | white-space: pre; 178 | } 179 | 180 | pre .img { 181 | margin: 5px 0; 182 | } 183 | 184 | pre .img img { 185 | background-color: #fff; 186 | display: block; 187 | height: auto; 188 | } 189 | 190 | code a, pre a { 191 | color: #375f84; 192 | } 193 | 194 | a.sourceLine:hover { 195 | text-decoration: none; 196 | } 197 | 198 | .fl {color: #1514b5;} 199 | .fu {color: #000000;} /* function */ 200 | .ch,.st {color: #036a07;} /* string */ 201 | .kw {color: #264D66;} /* keyword */ 202 | .co {color: #888888;} /* comment */ 203 | 204 | .message { color: black; font-weight: bolder;} 205 | .error { color: orange; font-weight: bolder;} 206 | .warning { color: #6A0366; font-weight: bolder;} 207 | 208 | /* Clipboard --------------------------*/ 209 | 210 | .hasCopyButton { 211 | position: relative; 212 | } 213 | 214 | .btn-copy-ex { 215 | position: absolute; 216 | right: 0; 217 | top: 0; 218 | visibility: hidden; 219 | } 220 | 221 | .hasCopyButton:hover button.btn-copy-ex { 222 | visibility: visible; 223 | } 224 | 225 | /* mark.js ----------------------------*/ 226 | 227 | mark { 228 | background-color: rgba(255, 255, 51, 0.5); 229 | border-bottom: 2px solid rgba(255, 153, 51, 0.3); 230 | padding: 1px; 231 | } 232 | 233 | /* vertical spacing after htmlwidgets */ 234 | .html-widget { 235 | margin-bottom: 10px; 236 | } 237 | -------------------------------------------------------------------------------- /docs/pkgdown.js: -------------------------------------------------------------------------------- 1 | /* http://gregfranko.com/blog/jquery-best-practices/ */ 2 | (function($) { 3 | $(function() { 4 | 5 | $("#sidebar") 6 | .stick_in_parent({offset_top: 40}) 7 | .on('sticky_kit:bottom', function(e) { 8 | $(this).parent().css('position', 'static'); 9 | }) 10 | .on('sticky_kit:unbottom', function(e) { 11 | $(this).parent().css('position', 'relative'); 12 | }); 13 | 14 | $('body').scrollspy({ 15 | target: '#sidebar', 16 | offset: 60 17 | }); 18 | 19 | $('[data-toggle="tooltip"]').tooltip(); 20 | 21 | var cur_path = paths(location.pathname); 22 | var links = $("#navbar ul li a"); 23 | var max_length = -1; 24 | var pos = -1; 25 | for (var i = 0; i < links.length; i++) { 26 | if (links[i].getAttribute("href") === "#") 27 | continue; 28 | // Ignore external links 29 | if (links[i].host !== location.host) 30 | continue; 31 | 32 | var nav_path = paths(links[i].pathname); 33 | 34 | var length = prefix_length(nav_path, cur_path); 35 | if (length > max_length) { 36 | max_length = length; 37 | pos = i; 38 | } 39 | } 40 | 41 | // Add class to parent
  • , and enclosing
  • if in dropdown 42 | if (pos >= 0) { 43 | var menu_anchor = $(links[pos]); 44 | menu_anchor.parent().addClass("active"); 45 | menu_anchor.closest("li.dropdown").addClass("active"); 46 | } 47 | }); 48 | 49 | function paths(pathname) { 50 | var pieces = pathname.split("/"); 51 | pieces.shift(); // always starts with / 52 | 53 | var end = pieces[pieces.length - 1]; 54 | if (end === "index.html" || end === "") 55 | pieces.pop(); 56 | return(pieces); 57 | } 58 | 59 | // Returns -1 if not found 60 | function prefix_length(needle, haystack) { 61 | if (needle.length > haystack.length) 62 | return(-1); 63 | 64 | // Special case for length-0 haystack, since for loop won't run 65 | if (haystack.length === 0) { 66 | return(needle.length === 0 ? 0 : -1); 67 | } 68 | 69 | for (var i = 0; i < haystack.length; i++) { 70 | if (needle[i] != haystack[i]) 71 | return(i); 72 | } 73 | 74 | return(haystack.length); 75 | } 76 | 77 | /* Clipboard --------------------------*/ 78 | 79 | function changeTooltipMessage(element, msg) { 80 | var tooltipOriginalTitle=element.getAttribute('data-original-title'); 81 | element.setAttribute('data-original-title', msg); 82 | $(element).tooltip('show'); 83 | element.setAttribute('data-original-title', tooltipOriginalTitle); 84 | } 85 | 86 | if(ClipboardJS.isSupported()) { 87 | $(document).ready(function() { 88 | var copyButton = ""; 89 | 90 | $(".examples, div.sourceCode").addClass("hasCopyButton"); 91 | 92 | // Insert copy buttons: 93 | $(copyButton).prependTo(".hasCopyButton"); 94 | 95 | // Initialize tooltips: 96 | $('.btn-copy-ex').tooltip({container: 'body'}); 97 | 98 | // Initialize clipboard: 99 | var clipboardBtnCopies = new ClipboardJS('[data-clipboard-copy]', { 100 | text: function(trigger) { 101 | return trigger.parentNode.textContent; 102 | } 103 | }); 104 | 105 | clipboardBtnCopies.on('success', function(e) { 106 | changeTooltipMessage(e.trigger, 'Copied!'); 107 | e.clearSelection(); 108 | }); 109 | 110 | clipboardBtnCopies.on('error', function() { 111 | changeTooltipMessage(e.trigger,'Press Ctrl+C or Command+C to copy'); 112 | }); 113 | }); 114 | } 115 | })(window.jQuery || window.$) 116 | -------------------------------------------------------------------------------- /docs/pkgdown.yml: -------------------------------------------------------------------------------- 1 | pandoc: '2.6' 2 | pkgdown: 1.3.0 3 | pkgdown_sha: ~ 4 | articles: [] 5 | 6 | -------------------------------------------------------------------------------- /docs/reference/aibs_dims.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Dimensions for AIBS CCF data at different resolutions — aibs_dims • cocoframer 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 50 | 51 | 52 | 53 | 54 | 55 |
    56 |
    57 | 92 | 93 | 94 |
    95 | 96 |
    97 |
    98 | 103 | 104 |
    105 | 106 |

    Data at 1um: CCF Meshes 107 | Data at 25um: Annotation grids and most gridded TissueCyte datasets 108 | Data at 200um: Gridded ISH datasets and related annotations

    109 | 110 |
    111 | 112 |
    aibs_dims(res = "25um")
    113 | 114 |

    Arguments

    115 | 116 | 117 | 118 | 119 | 120 | 121 |
    res

    The resolution of the dataset. Can be "1um","25um", or "200um". Default is "25um".

    122 | 123 |

    Value

    124 | 125 |

    a 3-element integer vector with the x,y,z dimensions.

    126 |

    x is anterior<->posterior 127 | y is ventral<->dorsal 128 | z is left<->right

    129 | 130 | 131 |
    132 | 141 |
    142 | 143 |
    144 | 147 | 148 |
    149 |

    Site built with pkgdown 1.3.0.

    150 |
    151 |
    152 |
    153 | 154 | 155 | 156 | 157 | 158 | 159 | -------------------------------------------------------------------------------- /docs/reference/aibs_organism_id.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Organism ID used by the AIBS API — aibs_organism_id • cocoframer 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 48 | 49 | 50 | 51 | 52 | 53 |
    54 |
    55 | 90 | 91 | 92 |
    93 | 94 |
    95 |
    96 | 101 | 102 |
    103 | 104 |

    Organism ID used by the AIBS API

    105 | 106 |
    107 | 108 |
    aibs_organism_id(species)
    109 | 110 |

    Arguments

    111 | 112 | 113 | 114 | 115 | 116 | 117 |
    species

    character, which species to use. Currently available: "human" and "mouse".

    118 | 119 |

    Value

    120 | 121 |

    a numeric value used by the AIBS API to represent the selected organism.

    122 | 123 | 124 |
    125 | 134 |
    135 | 136 |
    137 | 140 | 141 |
    142 |

    Site built with pkgdown 1.3.0.

    143 |
    144 |
    145 |
    146 | 147 | 148 | 149 | 150 | 151 | 152 | -------------------------------------------------------------------------------- /docs/reference/ccf_2017_color.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Retrieve a set of CCF 2017 colors — ccf_2017_color • cocoframer 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 48 | 49 | 50 | 51 | 52 | 53 |
    54 |
    55 | 90 | 91 | 92 |
    93 | 94 |
    95 |
    96 | 101 | 102 |
    103 | 104 |

    Must provide either acronym(s) or a structure_id(s).

    105 | 106 |
    107 | 108 |
    ccf_2017_color(acronym = NULL, structure_id = NULL)
    109 | 110 |

    Arguments

    111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 |
    acronym

    The structure acronym(s) to retrieve. Default is NULL.

    structure_id

    The structure_id(s) to retrieve. Defualt is NULL.

    122 | 123 |

    Value

    124 | 125 |

    a vector of color hex values prefixed with "#".

    126 | 127 | 128 |

    Examples

    129 |
    BLA_mesh <- ccf_2017_color(acronym = "BLA")
    130 |
    131 | 142 |
    143 | 144 |
    145 | 148 | 149 |
    150 |

    Site built with pkgdown 1.3.0.

    151 |
    152 |
    153 |
    154 | 155 | 156 | 157 | 158 | 159 | 160 | -------------------------------------------------------------------------------- /docs/reference/ccf_2017_mesh.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Retrieve a CCF 2017 mesh from the cocoframer package — ccf_2017_mesh • cocoframer 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 48 | 49 | 50 | 51 | 52 | 53 |
    54 |
    55 | 90 | 91 | 92 |
    93 | 94 |
    95 |
    96 | 101 | 102 |
    103 | 104 |

    Must provide either an acronym or a structure_id.

    105 | 106 |
    107 | 108 |
    ccf_2017_mesh(acronym = NULL, structure_id = NULL, material = NULL)
    109 | 110 |

    Arguments

    111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 125 | 126 |
    acronym

    The structure acronym to retrieve. Default is NULL.

    structure_id

    The structure_id to retrieve. Defualt is NULL.

    material

    The rgl material to apply to the mesh. Default is NULL, which uses the ABA ontology colorset. 124 | See ?rgl.material for details and additional options.

    127 | 128 |

    Value

    129 | 130 |

    a 3D mesh object for the selected structure

    131 | 132 | 133 |

    Examples

    134 |
    BLA_mesh <- ccf_2017_mesh(acronym = "BLA")
    135 |
    136 | 147 |
    148 | 149 |
    150 | 153 | 154 |
    155 |

    Site built with pkgdown 1.3.0.

    156 |
    157 |
    158 |
    159 | 160 | 161 | 162 | 163 | 164 | 165 | -------------------------------------------------------------------------------- /docs/reference/cleanup_taxons.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Clean up taxons by removing structures no longer present after filtering — cleanup_taxons • cocoframer 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 48 | 49 | 50 | 51 | 52 | 53 |
    54 |
    55 | 90 | 91 | 92 |
    93 | 94 |
    95 |
    96 | 101 | 102 |
    103 | 104 |

    Clean up taxons by removing structures no longer present after filtering

    105 | 106 |
    107 | 108 |
    cleanup_taxons(flat_ontology, id_column = "id",
    109 |   taxon_column = "taxons")
    110 | 111 |

    Arguments

    112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 |
    flat_ontology

    A flat ontology data.frame generated by flatten_mba_ontology.

    id_column

    The id column used to link structures. default is "id".

    taxon_column

    The name of the column with taxons generated by generate_taxons().

    127 | 128 |

    Value

    129 | 130 |

    a data.frame with a modified taxons column that lacks any ids that are no 131 | longer present in the ontology.

    132 | 133 | 134 |
    135 | 144 |
    145 | 146 |
    147 | 150 | 151 |
    152 |

    Site built with pkgdown 1.3.0.

    153 |
    154 |
    155 |
    156 | 157 | 158 | 159 | 160 | 161 | 162 | -------------------------------------------------------------------------------- /docs/reference/filter_mba_ontology_children.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Filter the MBA ontology to find children of a given structure acronym — filter_mba_ontology_children • cocoframer 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 48 | 49 | 50 | 51 | 52 | 53 |
    54 |
    55 | 90 | 91 | 92 |
    93 | 94 |
    95 |
    96 | 101 | 102 |
    103 | 104 |

    Filter the MBA ontology to find children of a given structure acronym

    105 | 106 |
    107 | 108 |
    filter_mba_ontology_children(flat_ontology, parent_acronym,
    109 |   include_parent = FALSE)
    110 | 111 |

    Arguments

    112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 |
    flat_ontology

    A flat ontology data.frame generated by flatten_mba_ontology

    parent_acronym

    The acronym of a brain ontology structure to find

    include_parent

    Whether or not to include the parent structure in the output. Default = FALSE.

    127 | 128 |

    Value

    129 | 130 |

    A data.frame with the filtered ontology only for children of the parent structure.

    131 | 132 | 133 |
    134 | 143 |
    144 | 145 |
    146 | 149 | 150 |
    151 |

    Site built with pkgdown 1.3.0.

    152 |
    153 |
    154 |
    155 | 156 | 157 | 158 | 159 | 160 | 161 | -------------------------------------------------------------------------------- /docs/reference/flatten_mba_ontology.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Convert a nested Mouse Brain Atlas ontology to a data.frame — flatten_mba_ontology • cocoframer 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 48 | 49 | 50 | 51 | 52 | 53 |
    54 |
    55 | 90 | 91 | 92 |
    93 | 94 |
    95 |
    96 | 101 | 102 |
    103 | 104 |

    Convert a nested Mouse Brain Atlas ontology to a data.frame

    105 | 106 |
    107 | 108 |
    flatten_mba_ontology(ontology, ontology_df = NULL)
    109 | 110 |

    Arguments

    111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 |
    ontology

    A nested ontology object

    ongology_df

    An existing ontology data.frame. This is used for recursion. You should use the default, NULL, to extract a full ontology.

    122 | 123 |

    Value

    124 | 125 |

    a data.frame with all descriptive columns for the ontology.

    126 | 127 | 128 |
    129 | 138 |
    139 | 140 |
    141 | 144 | 145 |
    146 |

    Site built with pkgdown 1.3.0.

    147 |
    148 |
    149 |
    150 | 151 | 152 | 153 | 154 | 155 | 156 | -------------------------------------------------------------------------------- /docs/reference/generate_mba_taxons.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Generate a taxon column that shows the "lineage" of each ontology term — generate_mba_taxons • cocoframer 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 48 | 49 | 50 | 51 | 52 | 53 |
    54 |
    55 | 90 | 91 | 92 |
    93 | 94 |
    95 |
    96 | 101 | 102 |
    103 | 104 |

    Generate a taxon column that shows the "lineage" of each ontology term

    105 | 106 |
    107 | 108 |
    generate_mba_taxons(flat_ontology)
    109 | 110 |

    Arguments

    111 | 112 | 113 | 114 | 115 | 116 | 117 |
    flat_ontology

    A flat ontology object generated by flatten_mba_ontology

    118 | 119 |

    Value

    120 | 121 |

    a data.frame with all descriptive columns for the ontology plus a new taxon column.

    122 | 123 | 124 |
    125 | 134 |
    135 | 136 |
    137 | 140 | 141 |
    142 |

    Site built with pkgdown 1.3.0.

    143 |
    144 |
    145 |
    146 | 147 | 148 | 149 | 150 | 151 | 152 | -------------------------------------------------------------------------------- /docs/reference/generate_taxons.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Generate a taxons column for a flattened ontology — generate_taxons • cocoframer 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 48 | 49 | 50 | 51 | 52 | 53 |
    54 |
    55 | 90 | 91 | 92 |
    93 | 94 |
    95 |
    96 | 101 | 102 |
    103 | 104 |

    This column is needed for use with the taxa and metacodeR packages.

    105 | 106 |
    107 | 108 |
    generate_taxons(flat_ontology, id_column = "id",
    109 |   parent_column = "parent_structure_id", value_column = "id",
    110 |   taxon_column = "taxons")
    111 | 112 |

    Arguments

    113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 |
    flat_ontology

    A flat ontology data.frame generated by flatten_mba_ontology

    id_column

    The id column used to link structures. default is "id".

    parent_column

    The column specifying the id column of the parent of each structure. default is "parent_structure_id".

    value_column

    The column of values to use to build the taxons column. Default is "id". Using "acronym" will yield a more readable taxonomy.

    taxon_column

    The name of the column to use for storing the resulting taxons. Default is "taxons".

    136 | 137 |

    Value

    138 | 139 |

    a data.frame with an additional column of semicolon-separated taxons based on the value_column.

    140 | 141 | 142 |
    143 | 152 |
    153 | 154 |
    155 | 158 | 159 |
    160 |

    Site built with pkgdown 1.3.0.

    161 |
    162 |
    163 |
    164 | 165 | 166 | 167 | 168 | 169 | 170 | -------------------------------------------------------------------------------- /docs/reference/get_aba_ish_data.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Retrieve gridded ABA RNA ISH results for a specific SectionDataSet — get_aba_ish_data • cocoframer 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 48 | 49 | 50 | 51 | 52 | 53 |
    54 |
    55 | 90 | 91 | 92 |
    93 | 94 |
    95 |
    96 | 101 | 102 |
    103 | 104 |

    Retrieve gridded ABA RNA ISH results for a specific SectionDataSet

    105 | 106 |
    107 | 108 |
    get_aba_ish_data(api_id, values = "energy")
    109 | 110 |

    Arguments

    111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 |
    api_id

    The ID of the SectionDataSet to retrieve

    values

    Which values to retrieve. Options are "energy", "density", "intensity", and "injection". Default = "energy".

    122 | 123 |

    Value

    124 | 125 |

    a 3d array with values for each position in the ABA mouse gridAnnotation space at 200 um resolution. Dimension are:

      126 |
    • x, 67: anterior/posterior

    • 127 |
    • y, 41: superior/inferior

    • 128 |
    • z, 58: left/right

    • 129 |
    130 | 131 | 132 | 133 |
    134 | 143 |
    144 | 145 |
    146 | 149 | 150 |
    151 |

    Site built with pkgdown 1.3.0.

    152 |
    153 |
    154 |
    155 | 156 | 157 | 158 | 159 | 160 | 161 | -------------------------------------------------------------------------------- /docs/reference/get_aba_ish_structure_data.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Get per-structure ABA RNA ISH results for a specific SectionDataSet — get_aba_ish_structure_data • cocoframer 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 48 | 49 | 50 | 51 | 52 | 53 |
    54 |
    55 | 90 | 91 | 92 |
    93 | 94 |
    95 |
    96 | 101 | 102 |
    103 | 104 |

    Get per-structure ABA RNA ISH results for a specific SectionDataSet

    105 | 106 |
    107 | 108 |
    get_aba_ish_structure_data(api_id, keep_non_atlas = FALSE)
    109 | 110 |

    Arguments

    111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 |
    api_id

    The ID of the SectionDataSet to retrieve

    keep_non_atlas

    Logical, whether to keep or filter structures without an atlas id value. Default = FALSE.

    122 | 123 |

    Value

    124 | 125 |

    a data.frame with per-structure atlas expression values:

      126 |
    • name: full name of the atlas structure

    • 127 |
    • acronym: structure acronym

    • 128 |
    • atlas_id: atlas id value for structure

    • 129 |
    • density: normalized expression density value

    • 130 |
    • energy: normalized expression as intensity/density

    • 131 |
    • sum_expressing_pixel_intensity

    • 132 |
    • sum_expressing_pixels

    • 133 |
    • sum_pixel_intensity

    • 134 |
    • sum_pixels

    • 135 |
    • voxel_energy_mean

    • 136 |
    • voxel_energy_cv

    • 137 |
    138 | 139 | 140 | 141 |
    142 | 151 |
    152 | 153 |
    154 | 157 | 158 |
    159 |

    Site built with pkgdown 1.3.0.

    160 |
    161 |
    162 |
    163 | 164 | 165 | 166 | 167 | 168 | 169 | -------------------------------------------------------------------------------- /docs/reference/get_ccf_annotation.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Download the CCF Annotation object and return a 3D Array of values — get_ccf_annotation • cocoframer 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 48 | 49 | 50 | 51 | 52 | 53 |
    54 |
    55 | 90 | 91 | 92 |
    93 | 94 |
    95 |
    96 | 101 | 102 |
    103 | 104 |

    This annotation is at 25 um resolution, and is used for brain atlas annotations.

    105 | 106 |
    107 | 108 |
    get_ccf_annotation()
    109 | 110 |

    Value

    111 | 112 |

    a 3-dimensional array with 25 micron resolution. Dimension are:

      113 |
    • x, 528: anterior/posterior

    • 114 |
    • y, 320: superior/inferior

    • 115 |
    • z, 456: left/right

    • 116 |
    117 | 118 | 119 |

    Details

    120 | 121 |

    No parameters

    122 | 123 | 124 |
    125 | 135 |
    136 | 137 |
    138 | 141 | 142 |
    143 |

    Site built with pkgdown 1.3.0.

    144 |
    145 |
    146 |
    147 | 148 | 149 | 150 | 151 | 152 | 153 | -------------------------------------------------------------------------------- /docs/reference/get_ccf_grid_annotation.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Download the CCF Grid Annotation object and return a 3D Array of values — get_ccf_grid_annotation • cocoframer 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 48 | 49 | 50 | 51 | 52 | 53 |
    54 |
    55 | 90 | 91 | 92 |
    93 | 94 |
    95 |
    96 | 101 | 102 |
    103 | 104 |

    This annotation is at 200 um resolution, and is used for gene expression atlas data.

    105 | 106 |
    107 | 108 |
    get_ccf_grid_annotation()
    109 | 110 |

    Value

    111 | 112 |

    a 3-dimensional array with 200 micron resolution. Dimension are:

      113 |
    • x, 67: anterior/posterior

    • 114 |
    • y, 41: superior/inferior

    • 115 |
    • z, 58: left/right

    • 116 |
    117 | 118 | 119 |

    Details

    120 | 121 |

    No parameters

    122 | 123 | 124 |
    125 | 135 |
    136 | 137 |
    138 | 141 | 142 |
    143 |

    Site built with pkgdown 1.3.0.

    144 |
    145 |
    146 |
    147 | 148 | 149 | 150 | 151 | 152 | 153 | -------------------------------------------------------------------------------- /docs/reference/get_exp_gene_relationships.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Query the ABA API to get relationships between ISH experiments and genes — get_exp_gene_relationships • cocoframer 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 48 | 49 | 50 | 51 | 52 | 53 |
    54 |
    55 | 90 | 91 | 92 |
    93 | 94 |
    95 |
    96 | 101 | 102 |
    103 | 104 |

    Query the ABA API to get relationships between ISH experiments and genes

    105 | 106 |
    107 | 108 |
    get_exp_gene_relationships(plane = "coronal")
    109 | 110 |

    Arguments

    111 | 112 | 113 | 114 | 115 | 116 | 117 |
    plane

    The plane of the ISH experiments to query. Must be either "coronal" or "saggital".

    118 | 119 |

    Value

    120 | 121 |

    a data.frame with two columns: id and gene_symbol

    122 | 123 | 124 |
    125 | 134 |
    135 | 136 |
    137 | 140 | 141 |
    142 |

    Site built with pkgdown 1.3.0.

    143 |
    144 |
    145 |
    146 | 147 | 148 | 149 | 150 | 151 | 152 | -------------------------------------------------------------------------------- /docs/reference/get_gene_aba_ish_ids.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Find ABA RNA ISH experiment IDs for a specific gene symbol — get_gene_aba_ish_ids • cocoframer 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 48 | 49 | 50 | 51 | 52 | 53 |
    54 |
    55 | 90 | 91 | 92 |
    93 | 94 |
    95 |
    96 | 101 | 102 |
    103 | 104 |

    Find ABA RNA ISH experiment IDs for a specific gene symbol

    105 | 106 |
    107 | 108 |
    get_gene_aba_ish_ids(gene_symbol, plane = "coronal")
    109 | 110 |

    Arguments

    111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 |
    gene_symbol

    The gene symbol to search for

    plane

    The plane of the ISH experiments to query. Must be either "coronal" or "saggital".

    122 | 123 |

    Value

    124 | 125 |

    a character object with all of the gene symbols matching your query

    126 | 127 | 128 |
    129 | 138 |
    139 | 140 |
    141 | 144 | 145 |
    146 |

    Site built with pkgdown 1.3.0.

    147 |
    148 |
    149 |
    150 | 151 | 152 | 153 | 154 | 155 | 156 | -------------------------------------------------------------------------------- /docs/reference/get_mba_ontology.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Download the Mouse Brain Atlas ontology as a list object — get_mba_ontology • cocoframer 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 48 | 49 | 50 | 51 | 52 | 53 |
    54 |
    55 | 90 | 91 | 92 |
    93 | 94 |
    95 |
    96 | 101 | 102 |
    103 | 104 |

    No parameters

    105 | 106 |
    107 | 108 |
    get_mba_ontology()
    109 | 110 |

    Value

    111 | 112 |

    a nested list object containing the Mouse Brain Atlas ontology

    113 | 114 | 115 |
    116 | 124 |
    125 | 126 |
    127 | 130 | 131 |
    132 |

    Site built with pkgdown 1.3.0.

    133 |
    134 |
    135 |
    136 | 137 | 138 | 139 | 140 | 141 | 142 | -------------------------------------------------------------------------------- /docs/reference/hello.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Hello, World! — hello • cocoframer 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 48 | 49 | 50 | 51 | 52 | 53 |
    54 |
    55 | 90 | 91 | 92 |
    93 | 94 |
    95 |
    96 | 101 | 102 |
    103 | 104 |

    Prints 'Hello, world!'.

    105 | 106 |
    107 | 108 |
    hello()
    109 | 110 | 111 |

    Examples

    112 |
    hello()
    #> Error in hello(): could not find function "hello"
    113 |
    114 | 122 |
    123 | 124 |
    125 | 128 | 129 |
    130 |

    Site built with pkgdown 1.3.0.

    131 |
    132 |
    133 |
    134 | 135 | 136 | 137 | 138 | 139 | 140 | -------------------------------------------------------------------------------- /docs/reference/mba_structure_id.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Get the Mouse Brain Atlas numeric structure ID(s) for given structure acronym(s) — mba_structure_id • cocoframer 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 48 | 49 | 50 | 51 | 52 | 53 |
    54 |
    55 | 90 | 91 | 92 |
    93 | 94 |
    95 |
    96 | 101 | 102 |
    103 | 104 |

    This retrieves the ID from an internal storage source in the package.

    105 | 106 |
    107 | 108 |
    mba_structure_id(acronym)
    109 | 110 |

    Arguments

    111 | 112 | 113 | 114 | 115 | 116 | 117 |
    acronym

    The structure acronym(s) to use.

    118 | 119 |

    Value

    120 | 121 |

    numeric value(s) for the target structure ID.

    122 | 123 | 124 |

    Examples

    125 |
    MOp_id <- mba_structure_id("MOp")
    126 |
    127 | 138 |
    139 | 140 |
    141 | 144 | 145 |
    146 |

    Site built with pkgdown 1.3.0.

    147 |
    148 |
    149 |
    150 | 151 | 152 | 153 | 154 | 155 | 156 | -------------------------------------------------------------------------------- /docs/reference/obj_to_mesh.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Read a .obj file to get a rgl-compatible mesh object — obj_to_mesh • cocoframer 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 48 | 49 | 50 | 51 | 52 | 53 |
    54 |
    55 | 90 | 91 | 92 |
    93 | 94 |
    95 |
    96 | 101 | 102 |
    103 | 104 |

    Read a .obj file to get a rgl-compatible mesh object

    105 | 106 |
    107 | 108 |
    obj_to_mesh(obj, material = "gray", invert_y = TRUE, yrange = c(0,
    109 |   8000))
    110 | 111 |

    Arguments

    112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 |
    obj

    A character object with the location of a .obj file.

    material

    The rgl material to use for the mesh. Default is "gray". For details, see ?rgl.material.

    invert_y

    Logical. Whether to flip the object in the y-dimensions. This is useful for AIBS mesh objects. Default is TRUE.

    yrange

    Length 2 numeric vector indicating the range to use for inversion. Default is c(0,8000).

    131 | 132 |

    Value

    133 | 134 |

    a list object with class mesh3d and shape3d.

    135 | 136 | 137 |
    138 | 147 |
    148 | 149 |
    150 | 153 | 154 |
    155 |

    Site built with pkgdown 1.3.0.

    156 |
    157 |
    158 |
    159 | 160 | 161 | 162 | 163 | 164 | 165 | -------------------------------------------------------------------------------- /docs/reference/plot_ccf_structure_points.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Plot a 3D CCF structure specified by its structure ID as points — plot_ccf_structure_points • cocoframer 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 48 | 49 | 50 | 51 | 52 | 53 |
    54 |
    55 | 90 | 91 | 92 |
    93 | 94 |
    95 |
    96 | 101 | 102 |
    103 | 104 |

    Plot a 3D CCF structure specified by its structure ID as points

    105 | 106 |
    107 | 108 |
    plot_ccf_structure_points(ccf_arr, structure_id)
    109 | 110 |

    Arguments

    111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 |
    ccf_arr

    a CCF annotation array

    structure_id

    The ID number of the desired CCF structure

    122 | 123 |

    Value

    124 | 125 |

    An rgl points3d plot

    126 | 127 | 128 |
    129 | 138 |
    139 | 140 |
    141 | 144 | 145 |
    146 |

    Site built with pkgdown 1.3.0.

    147 |
    148 |
    149 |
    150 | 151 | 152 | 153 | 154 | 155 | 156 | -------------------------------------------------------------------------------- /docs/reference/read_aibs_nrrd.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Read AIBS .nrrd files — read_aibs_nrrd • cocoframer 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 49 | 50 | 51 | 52 | 53 | 54 |
    55 |
    56 | 91 | 92 | 93 |
    94 | 95 |
    96 |
    97 | 102 | 103 |
    104 | 105 |

    This function reads the .nrrd format used by 106 | AIBS, containing 32-bit integer values with 15 header lines.

    107 | 108 |
    109 | 110 |
    read_aibs_nrrd(file, dims = c(528, 320, 456), header_lines = 15)
    111 | 112 |

    Arguments

    113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 |
    file

    The .nrrd file to read

    dims

    The dimensions of the array. Default is for 25 nm CCF arrays: c(528,320,456)

    header_lines

    The number of header lines in the .nrrd file. Default is 15.

    128 | 129 |

    Value

    130 | 131 |

    a 3 dimensional integer array with dims

    132 | 133 | 134 |
    135 | 144 |
    145 | 146 |
    147 | 150 | 151 |
    152 |

    Site built with pkgdown 1.3.0.

    153 |
    154 |
    155 |
    156 | 157 | 158 | 159 | 160 | 161 | 162 | -------------------------------------------------------------------------------- /docs/reference/save_rgl_mesh_zip.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Save a mesh object to a zip file for later use — save_rgl_mesh_zip • cocoframer 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 48 | 49 | 50 | 51 | 52 | 53 |
    54 |
    55 | 90 | 91 | 92 |
    93 | 94 |
    95 |
    96 | 101 | 102 |
    103 | 104 |

    This is currently only intended to work with triangular faces.

    105 | 106 |
    107 | 108 |
    save_rgl_mesh_zip(mesh, mesh_name, zip_file)
    109 | 110 |

    Arguments

    111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 |
    mesh

    The mesh object to store.

    mesh_name

    A character object specifying the mesh name, which will be used for file names.

    zip_file

    The zip file to use as output.

    126 | 127 |

    Details

    128 | 129 |

    This converts the vertex positions (vb) and face indexes (it) to vectors and 130 | stores them compactly as zipped binary files.

    131 |

    The first value in each file is a 32-bit integer specifying the number of vertexes or positions.

    132 |

    No material information is retained.

    133 |

    Note that new data will be appended to an existing .zip file. This allows many 134 | meshes to be stored together.

    135 | 136 | 137 |
    138 | 147 |
    148 | 149 |
    150 | 153 | 154 |
    155 |

    Site built with pkgdown 1.3.0.

    156 |
    157 |
    158 |
    159 | 160 | 161 | 162 | 163 | 164 | 165 | -------------------------------------------------------------------------------- /docs/reference/slice_ccf_arr.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Slice a 3D CCF array to get a 2D matrix — slice_ccf_arr • cocoframer 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 48 | 49 | 50 | 51 | 52 | 53 |
    54 |
    55 | 90 | 91 | 92 |
    93 | 94 |
    95 |
    96 | 101 | 102 |
    103 | 104 |

    Slice a 3D CCF array to get a 2D matrix

    105 | 106 |
    107 | 108 |
    slice_ccf_arr(arr, slice_num, plane = "coronal")
    109 | 110 |

    Arguments

    111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 |
    arr

    The 3D CCF array to slice

    slice_num

    numeric, which slice to select.

    plane

    character, which plane to use. Can be "coronal", "saggital", or "horizontal".

    126 | 127 |

    Value

    128 | 129 |

    A matrix of values from the selected slice.

    130 | 131 | 132 |
    133 | 142 |
    143 | 144 | 153 |
    154 | 155 | 156 | 157 | 158 | 159 | 160 | -------------------------------------------------------------------------------- /inst/extdata/ccf_2017_meshes.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AllenInstitute/cocoframer/1de30a8a5990f40ba5f55aff294e2c8f14b58add/inst/extdata/ccf_2017_meshes.zip -------------------------------------------------------------------------------- /inst/extdata/generate_mesh_store.R: -------------------------------------------------------------------------------- 1 | library(cocoframer) 2 | library(xml2) 3 | library(purrr) 4 | 5 | obj_dir <- "http://download.alleninstitute.org/informatics-archive/current-release/mouse_ccf/annotation/ccf_2017/structure_meshes/" 6 | 7 | obj_page <- read_html(obj_dir) 8 | 9 | obj_links <- xml_find_all(obj_page, ".//a") 10 | obj_files <- unlist(xml_attrs(obj_links, "href")) 11 | 12 | obj_files <- obj_files[grepl(".obj$", obj_files)] 13 | 14 | walk(obj_files, 15 | function(x) { 16 | download.file(file.path(obj_dir, x), x) 17 | }) 18 | 19 | obj_names <- sub(".obj","",obj_files) 20 | 21 | walk(1:length(obj_files), 22 | function(x) { 23 | mesh <- obj_to_mesh(obj_files[x], 24 | yrange = c(0, 8000)) 25 | 26 | save_rgl_mesh_zip(mesh, obj_names[x], "ccf_2017_meshes.zip") 27 | }) 28 | 29 | library(dplyr) 30 | 31 | ont <- flatten_mba_ontology(get_mba_ontology()) 32 | 33 | ont <- ont %>% 34 | mutate(color = paste0("#",color_hex_triplet)) 35 | 36 | ont <- ont[,c("id","acronym","name","color")] 37 | 38 | write.csv(ont, "inst/extdata/mba_structure_id_to_acronym.csv", row.names = FALSE) 39 | -------------------------------------------------------------------------------- /man/aibs_dims.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/constants.R 3 | \name{aibs_dims} 4 | \alias{aibs_dims} 5 | \title{Dimensions for AIBS CCF data at different resolutions} 6 | \usage{ 7 | aibs_dims(res = "25um") 8 | } 9 | \arguments{ 10 | \item{res}{The resolution of the dataset. Can be "1um","25um", or "200um". Default is "25um".} 11 | } 12 | \value{ 13 | a 3-element integer vector with the x,y,z dimensions. 14 | 15 | x is anterior<->posterior 16 | y is ventral<->dorsal 17 | z is left<->right 18 | } 19 | \description{ 20 | Data at 1um: CCF Meshes 21 | Data at 25um: Annotation grids and most gridded TissueCyte datasets 22 | Data at 200um: Gridded ISH datasets and related annotations 23 | } 24 | -------------------------------------------------------------------------------- /man/aibs_organism_id.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/constants.R 3 | \name{aibs_organism_id} 4 | \alias{aibs_organism_id} 5 | \title{Organism ID used by the AIBS API} 6 | \usage{ 7 | aibs_organism_id(species) 8 | } 9 | \arguments{ 10 | \item{species}{character, which species to use. Currently available: "human" and "mouse".} 11 | } 12 | \value{ 13 | a numeric value used by the AIBS API to represent the selected organism. 14 | } 15 | \description{ 16 | Organism ID used by the AIBS API 17 | } 18 | -------------------------------------------------------------------------------- /man/ccf_2017_color.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mouse_ccf_meshes.R 3 | \name{ccf_2017_color} 4 | \alias{ccf_2017_color} 5 | \title{Retrieve a set of CCF 2017 colors} 6 | \usage{ 7 | ccf_2017_color(acronym = NULL, structure_id = NULL) 8 | } 9 | \arguments{ 10 | \item{acronym}{The structure acronym(s) to retrieve. Default is NULL.} 11 | 12 | \item{structure_id}{The structure_id(s) to retrieve. Defualt is NULL.} 13 | } 14 | \value{ 15 | a vector of color hex values prefixed with "#". 16 | } 17 | \description{ 18 | Must provide either acronym(s) or a structure_id(s). 19 | } 20 | \examples{ 21 | BLA_mesh <- ccf_2017_color(acronym = "BLA") 22 | } 23 | -------------------------------------------------------------------------------- /man/ccf_2017_mesh.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mouse_ccf_meshes.R 3 | \name{ccf_2017_mesh} 4 | \alias{ccf_2017_mesh} 5 | \title{Retrieve a CCF 2017 mesh from the cocoframer package} 6 | \usage{ 7 | ccf_2017_mesh(acronym = NULL, structure_id = NULL, material = NULL) 8 | } 9 | \arguments{ 10 | \item{acronym}{The structure acronym to retrieve. Default is NULL.} 11 | 12 | \item{structure_id}{The structure_id to retrieve. Defualt is NULL.} 13 | 14 | \item{material}{The rgl material to apply to the mesh. Default is NULL, which uses the ABA ontology colorset. 15 | See ?rgl.material for details and additional options.} 16 | } 17 | \value{ 18 | a 3D mesh object for the selected structure 19 | } 20 | \description{ 21 | Must provide either an acronym or a structure_id. 22 | } 23 | \examples{ 24 | BLA_mesh <- ccf_2017_mesh(acronym = "BLA") 25 | } 26 | -------------------------------------------------------------------------------- /man/cleanup_taxons.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ontology.R 3 | \name{cleanup_taxons} 4 | \alias{cleanup_taxons} 5 | \title{Clean up taxons by removing structures no longer present after filtering} 6 | \usage{ 7 | cleanup_taxons(flat_ontology, id_column = "id", 8 | taxon_column = "taxons") 9 | } 10 | \arguments{ 11 | \item{flat_ontology}{A flat ontology data.frame generated by flatten_mba_ontology.} 12 | 13 | \item{id_column}{The id column used to link structures. default is "id".} 14 | 15 | \item{taxon_column}{The name of the column with taxons generated by generate_taxons().} 16 | } 17 | \value{ 18 | a data.frame with a modified taxons column that lacks any ids that are no 19 | longer present in the ontology. 20 | } 21 | \description{ 22 | Clean up taxons by removing structures no longer present after filtering 23 | } 24 | -------------------------------------------------------------------------------- /man/compute_hierarchical.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ontology.R 3 | \name{compute_hierarchical} 4 | \alias{compute_hierarchical} 5 | \title{Compute values hierarchicaly over a flat ontology} 6 | \usage{ 7 | compute_hierarchical(df, fun, compute_column, result_column, 8 | include_node = FALSE, na.rm = NULL, taxon_column = "taxons") 9 | } 10 | \arguments{ 11 | \item{df}{A flat ontology data.frame with a taxons column} 12 | 13 | \item{fun}{The function to run as a character object, e.g. "mean".} 14 | 15 | \item{compute_column}{The column of values to use for the function computation.} 16 | 17 | \item{result_column}{The name of the output column.} 18 | 19 | \item{include_node}{Logical, should values assigned to non-leaf nodes be included in calculation?} 20 | 21 | \item{na.rm}{If TRUE or FALSE, passed as a parameter to fun. If NULL (default), is ignored.} 22 | 23 | \item{taxon_column}{The name of the taxons column. Default is "taxons"} 24 | } 25 | \value{ 26 | A flat ontology data.frame with the result_column added. The taxon column will be moved 27 | to the last column position. This should behave similarly to mutate(). 28 | } 29 | \description{ 30 | Values accumulate from the bottom of the ontology to the top at each node, 31 | and are computed only from the values of the direct children of each node. 32 | } 33 | \examples{ 34 | 35 | flat_ontology2 <- flat_ontology \%>\% 36 | compute_hierarchical("mean","n_children","mean_children", 37 | include_node = TRUE) 38 | 39 | } 40 | -------------------------------------------------------------------------------- /man/figures/readme_ca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AllenInstitute/cocoframer/1de30a8a5990f40ba5f55aff294e2c8f14b58add/man/figures/readme_ca.png -------------------------------------------------------------------------------- /man/figures/readme_ca_colors.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AllenInstitute/cocoframer/1de30a8a5990f40ba5f55aff294e2c8f14b58add/man/figures/readme_ca_colors.png -------------------------------------------------------------------------------- /man/figures/readme_cartoon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AllenInstitute/cocoframer/1de30a8a5990f40ba5f55aff294e2c8f14b58add/man/figures/readme_cartoon.png -------------------------------------------------------------------------------- /man/figures/readme_matte.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AllenInstitute/cocoframer/1de30a8a5990f40ba5f55aff294e2c8f14b58add/man/figures/readme_matte.png -------------------------------------------------------------------------------- /man/figures/readme_mo_th_p.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AllenInstitute/cocoframer/1de30a8a5990f40ba5f55aff294e2c8f14b58add/man/figures/readme_mo_th_p.png -------------------------------------------------------------------------------- /man/figures/readme_shiny.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AllenInstitute/cocoframer/1de30a8a5990f40ba5f55aff294e2c8f14b58add/man/figures/readme_shiny.png -------------------------------------------------------------------------------- /man/figures/readme_within_th.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AllenInstitute/cocoframer/1de30a8a5990f40ba5f55aff294e2c8f14b58add/man/figures/readme_within_th.png -------------------------------------------------------------------------------- /man/figures/rotate_demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AllenInstitute/cocoframer/1de30a8a5990f40ba5f55aff294e2c8f14b58add/man/figures/rotate_demo.gif -------------------------------------------------------------------------------- /man/filter_mba_ontology_children.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ontology.R 3 | \name{filter_mba_ontology_children} 4 | \alias{filter_mba_ontology_children} 5 | \title{Filter the MBA ontology to find children of a given structure acronym} 6 | \usage{ 7 | filter_mba_ontology_children(flat_ontology, parent_acronym, 8 | include_parent = FALSE) 9 | } 10 | \arguments{ 11 | \item{flat_ontology}{A flat ontology data.frame generated by flatten_mba_ontology} 12 | 13 | \item{parent_acronym}{The acronym of a brain ontology structure to find} 14 | 15 | \item{include_parent}{Whether or not to include the parent structure in the output. Default = FALSE.} 16 | } 17 | \value{ 18 | A data.frame with the filtered ontology only for children of the parent structure. 19 | } 20 | \description{ 21 | Filter the MBA ontology to find children of a given structure acronym 22 | } 23 | -------------------------------------------------------------------------------- /man/flatten_mba_ontology.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ontology.R 3 | \name{flatten_mba_ontology} 4 | \alias{flatten_mba_ontology} 5 | \title{Convert a nested Mouse Brain Atlas ontology to a data.frame} 6 | \usage{ 7 | flatten_mba_ontology(ontology, ontology_df = NULL) 8 | } 9 | \arguments{ 10 | \item{ontology}{A nested ontology object} 11 | 12 | \item{ongology_df}{An existing ontology data.frame. This is used for recursion. You should use the default, NULL, to extract a full ontology.} 13 | } 14 | \value{ 15 | a data.frame with all descriptive columns for the ontology. 16 | } 17 | \description{ 18 | Convert a nested Mouse Brain Atlas ontology to a data.frame 19 | } 20 | -------------------------------------------------------------------------------- /man/generate_mba_taxons.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ontology.R 3 | \name{generate_mba_taxons} 4 | \alias{generate_mba_taxons} 5 | \title{Generate a taxon column that shows the "lineage" of each ontology term} 6 | \usage{ 7 | generate_mba_taxons(flat_ontology) 8 | } 9 | \arguments{ 10 | \item{flat_ontology}{A flat ontology object generated by flatten_mba_ontology} 11 | } 12 | \value{ 13 | a data.frame with all descriptive columns for the ontology plus a new taxon column. 14 | } 15 | \description{ 16 | Generate a taxon column that shows the "lineage" of each ontology term 17 | } 18 | -------------------------------------------------------------------------------- /man/generate_taxons.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ontology.R 3 | \name{generate_taxons} 4 | \alias{generate_taxons} 5 | \title{Generate a taxons column for a flattened ontology} 6 | \usage{ 7 | generate_taxons(flat_ontology, id_column = "id", 8 | parent_column = "parent_structure_id", value_column = "id", 9 | taxon_column = "taxons") 10 | } 11 | \arguments{ 12 | \item{flat_ontology}{A flat ontology data.frame generated by flatten_mba_ontology} 13 | 14 | \item{id_column}{The id column used to link structures. default is "id".} 15 | 16 | \item{parent_column}{The column specifying the id column of the parent of each structure. default is "parent_structure_id".} 17 | 18 | \item{value_column}{The column of values to use to build the taxons column. Default is "id". Using "acronym" will yield a more readable taxonomy.} 19 | 20 | \item{taxon_column}{The name of the column to use for storing the resulting taxons. Default is "taxons".} 21 | } 22 | \value{ 23 | a data.frame with an additional column of semicolon-separated taxons based on the value_column. 24 | } 25 | \description{ 26 | This column is needed for use with the taxa and metacodeR packages. 27 | } 28 | -------------------------------------------------------------------------------- /man/get_aba_ish_data.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/aba_ish.R 3 | \name{get_aba_ish_data} 4 | \alias{get_aba_ish_data} 5 | \title{Retrieve gridded ABA RNA ISH results for a specific SectionDataSet} 6 | \usage{ 7 | get_aba_ish_data(api_id, values = "energy") 8 | } 9 | \arguments{ 10 | \item{api_id}{The ID of the SectionDataSet to retrieve} 11 | 12 | \item{values}{Which values to retrieve. Options are "energy", "density", "intensity", and "injection". Default = "energy".} 13 | } 14 | \value{ 15 | a 3d array with values for each position in the ABA mouse gridAnnotation space at 200 um resolution. Dimension are: 16 | \itemize{ 17 | \item x, 67: anterior/posterior 18 | \item y, 41: superior/inferior 19 | \item z, 58: left/right 20 | } 21 | } 22 | \description{ 23 | Retrieve gridded ABA RNA ISH results for a specific SectionDataSet 24 | } 25 | -------------------------------------------------------------------------------- /man/get_aba_ish_structure_data.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/aba_ish.R 3 | \name{get_aba_ish_structure_data} 4 | \alias{get_aba_ish_structure_data} 5 | \title{Get per-structure ABA RNA ISH results for a specific SectionDataSet} 6 | \usage{ 7 | get_aba_ish_structure_data(api_id, keep_non_atlas = FALSE) 8 | } 9 | \arguments{ 10 | \item{api_id}{The ID of the SectionDataSet to retrieve} 11 | 12 | \item{keep_non_atlas}{Logical, whether to keep or filter structures without an atlas id value. Default = FALSE.} 13 | } 14 | \value{ 15 | a data.frame with per-structure atlas expression values: 16 | \itemize{ 17 | \item name: full name of the atlas structure 18 | \item acronym: structure acronym 19 | \item atlas_id: atlas id value for structure 20 | \item density: normalized expression density value 21 | \item energy: normalized expression as intensity/density 22 | \item sum_expressing_pixel_intensity 23 | \item sum_expressing_pixels 24 | \item sum_pixel_intensity 25 | \item sum_pixels 26 | \item voxel_energy_mean 27 | \item voxel_energy_cv 28 | } 29 | } 30 | \description{ 31 | Get per-structure ABA RNA ISH results for a specific SectionDataSet 32 | } 33 | -------------------------------------------------------------------------------- /man/get_ccf_annotation.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/raw_ccf.R 3 | \name{get_ccf_annotation} 4 | \alias{get_ccf_annotation} 5 | \title{Download the CCF Annotation object and return a 3D Array of values} 6 | \usage{ 7 | get_ccf_annotation() 8 | } 9 | \value{ 10 | a 3-dimensional array with 25 micron resolution. Dimension are: 11 | \itemize{ 12 | \item x, 528: anterior/posterior 13 | \item y, 320: superior/inferior 14 | \item z, 456: left/right 15 | } 16 | } 17 | \description{ 18 | This annotation is at 25 um resolution, and is used for brain atlas annotations. 19 | } 20 | \details{ 21 | No parameters 22 | } 23 | -------------------------------------------------------------------------------- /man/get_ccf_grid_annotation.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/raw_ccf.R 3 | \name{get_ccf_grid_annotation} 4 | \alias{get_ccf_grid_annotation} 5 | \title{Download the CCF Grid Annotation object and return a 3D Array of values} 6 | \usage{ 7 | get_ccf_grid_annotation() 8 | } 9 | \value{ 10 | a 3-dimensional array with 200 micron resolution. Dimension are: 11 | \itemize{ 12 | \item x, 67: anterior/posterior 13 | \item y, 41: superior/inferior 14 | \item z, 58: left/right 15 | } 16 | } 17 | \description{ 18 | This annotation is at 200 um resolution, and is used for gene expression atlas data. 19 | } 20 | \details{ 21 | No parameters 22 | } 23 | -------------------------------------------------------------------------------- /man/get_exp_gene_relationships.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/aba_ish.R 3 | \name{get_exp_gene_relationships} 4 | \alias{get_exp_gene_relationships} 5 | \title{Query the ABA API to get relationships between ISH experiments and genes} 6 | \usage{ 7 | get_exp_gene_relationships(plane = "coronal") 8 | } 9 | \arguments{ 10 | \item{plane}{The plane of the ISH experiments to query. Must be either "coronal" or "saggital".} 11 | } 12 | \value{ 13 | a data.frame with two columns: id and gene_symbol 14 | } 15 | \description{ 16 | Query the ABA API to get relationships between ISH experiments and genes 17 | } 18 | -------------------------------------------------------------------------------- /man/get_gene_aba_ish_ids.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/aba_ish.R 3 | \name{get_gene_aba_ish_ids} 4 | \alias{get_gene_aba_ish_ids} 5 | \title{Find ABA RNA ISH experiment IDs for a specific gene symbol} 6 | \usage{ 7 | get_gene_aba_ish_ids(gene_symbol, plane = "coronal") 8 | } 9 | \arguments{ 10 | \item{gene_symbol}{The gene symbol to search for} 11 | 12 | \item{plane}{The plane of the ISH experiments to query. Must be either "coronal" or "saggital".} 13 | } 14 | \value{ 15 | a character object with all of the gene symbols matching your query 16 | } 17 | \description{ 18 | Find ABA RNA ISH experiment IDs for a specific gene symbol 19 | } 20 | -------------------------------------------------------------------------------- /man/get_mba_ontology.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ontology.R 3 | \name{get_mba_ontology} 4 | \alias{get_mba_ontology} 5 | \title{Download the Mouse Brain Atlas ontology as a list object} 6 | \usage{ 7 | get_mba_ontology() 8 | } 9 | \value{ 10 | a nested list object containing the Mouse Brain Atlas ontology 11 | } 12 | \description{ 13 | No parameters 14 | } 15 | -------------------------------------------------------------------------------- /man/mba_structure_id.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ontology.R 3 | \name{mba_structure_id} 4 | \alias{mba_structure_id} 5 | \title{Get the Mouse Brain Atlas numeric structure ID(s) for given structure acronym(s)} 6 | \usage{ 7 | mba_structure_id(acronym) 8 | } 9 | \arguments{ 10 | \item{acronym}{The structure acronym(s) to use.} 11 | } 12 | \value{ 13 | numeric value(s) for the target structure ID. 14 | } 15 | \description{ 16 | This retrieves the ID from an internal storage source in the package. 17 | } 18 | \examples{ 19 | MOp_id <- mba_structure_id("MOp") 20 | } 21 | -------------------------------------------------------------------------------- /man/obj_to_mesh.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mouse_ccf_meshes.R 3 | \name{obj_to_mesh} 4 | \alias{obj_to_mesh} 5 | \title{Read a .obj file to get a rgl-compatible mesh object} 6 | \usage{ 7 | obj_to_mesh(obj, material = "gray", invert_y = TRUE, yrange = c(0, 8 | 8000)) 9 | } 10 | \arguments{ 11 | \item{obj}{A character object with the location of a .obj file.} 12 | 13 | \item{material}{The rgl material to use for the mesh. Default is "gray". For details, see ?rgl.material.} 14 | 15 | \item{invert_y}{Logical. Whether to flip the object in the y-dimensions. This is useful for AIBS mesh objects. Default is TRUE.} 16 | 17 | \item{yrange}{Length 2 numeric vector indicating the range to use for inversion. Default is c(0,8000).} 18 | } 19 | \value{ 20 | a list object with class mesh3d and shape3d. 21 | } 22 | \description{ 23 | Read a .obj file to get a rgl-compatible mesh object 24 | } 25 | -------------------------------------------------------------------------------- /man/plot_ccf_meshes.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/rgl_plots.R 3 | \name{plot_ccf_meshes} 4 | \alias{plot_ccf_meshes} 5 | \title{Plot 3D structures from the CCF} 6 | \usage{ 7 | plot_ccf_meshes(mesh_list, fg_structure, fg_color = NULL, fg_alpha = 1, 8 | bg_structure = NULL, bg_color = NULL, bg_alpha = 0.2, 9 | style = "shiny") 10 | } 11 | \arguments{ 12 | \item{mesh_list}{a named list of one or more 3D mesh objects} 13 | 14 | \item{fg_structure}{The name(s) of the structure to plot as a foreground (solid) object.} 15 | 16 | \item{fg_color}{The color to use for the foreground object (default is NULL, which retains mesh material).} 17 | 18 | \item{fg_alpha}{The alpha/opacity of the foreground object (default is 1).} 19 | 20 | \item{bg_structure}{The name(s) of the structure to plot as a background (semitransparent) object.} 21 | 22 | \item{bg_color}{The color to use for the background object (default is NULL, which retains mesh material).} 23 | 24 | \item{bg_alpha}{The alpha/opacity of the background object (default is 0.2)} 25 | 26 | \item{style}{The overall style of the structures. Can be "shiny","matte", "cartoon", or "none". "none" will not modify the existing rgl.material settings for the meshes.} 27 | } 28 | \value{ 29 | a 3D plot in an RGL window. 30 | } 31 | \description{ 32 | Plot 3D structures from the CCF 33 | } 34 | -------------------------------------------------------------------------------- /man/plot_ccf_structure_points.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/rgl_plots.R 3 | \name{plot_ccf_structure_points} 4 | \alias{plot_ccf_structure_points} 5 | \title{Plot a 3D CCF structure specified by its structure ID as points} 6 | \usage{ 7 | plot_ccf_structure_points(ccf_arr, structure_id) 8 | } 9 | \arguments{ 10 | \item{ccf_arr}{a CCF annotation array} 11 | 12 | \item{structure_id}{The ID number of the desired CCF structure} 13 | } 14 | \value{ 15 | An rgl points3d plot 16 | } 17 | \description{ 18 | Plot a 3D CCF structure specified by its structure ID as points 19 | } 20 | -------------------------------------------------------------------------------- /man/read_aibs_nrrd.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/nrrd.R 3 | \name{read_aibs_nrrd} 4 | \alias{read_aibs_nrrd} 5 | \title{Read AIBS .nrrd files} 6 | \usage{ 7 | read_aibs_nrrd(file, dims = c(528, 320, 456), header_lines = 15) 8 | } 9 | \arguments{ 10 | \item{file}{The .nrrd file to read} 11 | 12 | \item{dims}{The dimensions of the array. Default is for 25 nm CCF arrays: c(528,320,456)} 13 | 14 | \item{header_lines}{The number of header lines in the .nrrd file. Default is 15.} 15 | } 16 | \value{ 17 | a 3 dimensional integer array with dims 18 | } 19 | \description{ 20 | This function reads the .nrrd format used by 21 | AIBS, containing 32-bit integer values with 15 header lines. 22 | } 23 | -------------------------------------------------------------------------------- /man/read_rgl_mesh_zip.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mouse_ccf_meshes.R 3 | \name{read_rgl_mesh_zip} 4 | \alias{read_rgl_mesh_zip} 5 | \title{Read a mesh object from a zip file generated by save_rgl_mesh_zip()} 6 | \usage{ 7 | read_rgl_mesh_zip(mesh_name, zip_file, material = "gray") 8 | } 9 | \arguments{ 10 | \item{mesh_name}{A character object specifying the mesh name, which will be used for file names.} 11 | 12 | \item{zip_file}{The zip file containing vectorized meshes.} 13 | 14 | \item{material}{The rgl material to use for the mesh. Default is "gray". For details, see ?rgl.material.} 15 | } 16 | \value{ 17 | a list object with class mesh3d and shape3d. 18 | } 19 | \description{ 20 | This is currently only intended to work with triangular faces. 21 | } 22 | \details{ 23 | This reverses the proccessing in save_rgl_mesh_zip() to rebuild the mesh object 24 | from binary vectors. 25 | 26 | If you're looking for a simple way to get a brain structure, use ccf_2017_mesh, which wraps this 27 | function, and retrieves a mesh that's included in this package. 28 | } 29 | \examples{ 30 | mesh_store <- system.file("extdata", "ccf_2017_meshes.zip", package = "cocoframer") 31 | structure_id <- mba_structure_id(acronym = "MOp") 32 | MOp_mesh <- read_rgl_mesh(structure_id, 33 | zip_file = mesh_store) 34 | } 35 | -------------------------------------------------------------------------------- /man/save_rgl_mesh_zip.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mouse_ccf_meshes.R 3 | \name{save_rgl_mesh_zip} 4 | \alias{save_rgl_mesh_zip} 5 | \title{Save a mesh object to a zip file for later use} 6 | \usage{ 7 | save_rgl_mesh_zip(mesh, mesh_name, zip_file) 8 | } 9 | \arguments{ 10 | \item{mesh}{The mesh object to store.} 11 | 12 | \item{mesh_name}{A character object specifying the mesh name, which will be used for file names.} 13 | 14 | \item{zip_file}{The zip file to use as output.} 15 | } 16 | \description{ 17 | This is currently only intended to work with triangular faces. 18 | } 19 | \details{ 20 | This converts the vertex positions (vb) and face indexes (it) to vectors and 21 | stores them compactly as zipped binary files. 22 | 23 | The first value in each file is a 32-bit integer specifying the number of vertexes or positions. 24 | 25 | No material information is retained. 26 | 27 | Note that new data will be appended to an existing .zip file. This allows many 28 | meshes to be stored together. 29 | } 30 | -------------------------------------------------------------------------------- /man/slice_ccf_arr.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/aba_ish.R 3 | \name{slice_ccf_arr} 4 | \alias{slice_ccf_arr} 5 | \title{Slice a 3D CCF array to get a 2D matrix} 6 | \usage{ 7 | slice_ccf_arr(arr, slice_num, plane = "coronal") 8 | } 9 | \arguments{ 10 | \item{arr}{The 3D CCF array to slice} 11 | 12 | \item{slice_num}{numeric, which slice to select.} 13 | 14 | \item{plane}{character, which plane to use. Can be "coronal", "saggital", or "horizontal".} 15 | } 16 | \value{ 17 | A matrix of values from the selected slice. 18 | } 19 | \description{ 20 | Slice a 3D CCF array to get a 2D matrix 21 | } 22 | -------------------------------------------------------------------------------- /misc/generate_readme_images.R: -------------------------------------------------------------------------------- 1 | library(cocoframer) 2 | library(purrr) 3 | library(rgl) 4 | 5 | out_dir <- "man/figures" 6 | 7 | structures <- c("root","CA") 8 | mesh_list <- map(structures, ccf_2017_mesh) 9 | 10 | names(mesh_list) <- structures 11 | 12 | plot_ccf_meshes(mesh_list, 13 | fg_structure = "CA", 14 | bg_structure = "root") 15 | 16 | snapshot3d(file.path(out_dir, 17 | "readme_ca.png")) 18 | 19 | clear3d() 20 | plot_ccf_meshes(mesh_list, 21 | fg_structure = "CA", 22 | fg_color = "orangered", 23 | fg_alpha = 0.4, 24 | bg_structure = "root", 25 | bg_color = "yellow", 26 | bg_alpha = 0.4) 27 | 28 | snapshot3d(file.path(out_dir, 29 | "readme_ca_colors.png")) 30 | clear3d() 31 | 32 | structures <- c("root","TH","MOs","P") 33 | mesh_list <- map(structures, ccf_2017_mesh) 34 | 35 | names(mesh_list) <- structures 36 | 37 | plot_ccf_meshes(mesh_list, 38 | fg_structure = c("MOs","TH","P"), 39 | fg_color = c("orangered","skyblue","purple"), 40 | bg_structure = "root") 41 | 42 | snapshot3d(file.path(out_dir, 43 | "readme_mo_th_p.png")) 44 | 45 | clear3d() 46 | 47 | th_str <- c("TH","LGd","LP","LGv","RT") 48 | th_meshes <- map(th_str, ccf_2017_mesh) 49 | 50 | names(th_meshes) <- th_str 51 | 52 | plot_ccf_meshes(th_meshes, 53 | fg_structure = c("LGd","LGv","LP","RT"), 54 | fg_color = c("orangered","skyblue","purple","darkgreen"), 55 | bg_structure = c("TH")) 56 | 57 | snapshot3d(file.path(out_dir, 58 | "readme_within_th.png")) 59 | 60 | clear3d() 61 | 62 | structures <- c("root","MO","SS") 63 | mesh_list <- map(structures, ccf_2017_mesh) 64 | names(mesh_list) <- structures 65 | 66 | plot_ccf_meshes(mesh_list, 67 | fg_structure = c("MO","SS"), 68 | bg_structure = "root", 69 | style = "shiny") 70 | 71 | snapshot3d(file.path(out_dir, 72 | "readme_shiny.png")) 73 | clear3d() 74 | 75 | plot_ccf_meshes(mesh_list, 76 | fg_structure = c("MO","SS"), 77 | bg_structure = "root", 78 | style = "matte") 79 | 80 | snapshot3d(file.path(out_dir, 81 | "readme_matte.png")) 82 | 83 | clear3d() 84 | 85 | plot_ccf_meshes(mesh_list, 86 | fg_structure = c("MO","SS"), 87 | bg_structure = "root", 88 | style = "cartoon") 89 | 90 | snapshot3d(file.path(out_dir, 91 | "readme_cartoon.png")) 92 | 93 | 94 | 95 | structures <- c("root","TH","MOs","P") 96 | mesh_list <- map(structures, ccf_2017_mesh) 97 | 98 | names(mesh_list) <- structures 99 | 100 | plot_ccf_meshes(mesh_list, 101 | fg_structure = c("MOs","TH","P"), 102 | bg_structure = "root") 103 | 104 | anim <- spin3d(axis=c(0,1,0), # Spin on the y-axis 105 | rpm = 12) 106 | 107 | movie3d(anim, 108 | fps = 20, # 20 fps is fairly smooth 109 | duration = 5, # 5 sec = 1 rotation at 12 rpm 110 | movie = "brain_demo", # Save as brain_demo.gif 111 | dir = "./", # Output directory - will make a lot of temporary files. 112 | type = "gif") 113 | -------------------------------------------------------------------------------- /testing/cocoframer_demo.R: -------------------------------------------------------------------------------- 1 | # Package dependencies: 2 | devtools::install_github("AllenInstitute/cocoframer") 3 | # devtools::install_github("AllenInstitute/scrattch.vis") 4 | # install.packages(c("reshape2","dplyr","purrr","rbokeh","viridisLite")) 5 | 6 | library(cocoframer) 7 | library(purrr) 8 | library(viridisLite) # optional - nice color palettes 9 | library(dplyr) 10 | library(reshape2) 11 | 12 | # Get structure ontology annotations 13 | ga <- get_ccf_grid_annotation() 14 | 15 | ontology <- get_mba_ontology() 16 | ontology_df <- flatten_mba_ontology(ontology) 17 | 18 | # build a 3d array of ontology structure acronyms - easier to deal with than IDs 19 | oa <- array(ontology_df$acronym[match(ga, ontology_df$id)], dim = dim(ga)) 20 | 21 | # Get ISH data 22 | Slc17a7_ids <- get_gene_aba_ish_ids("Slc17a7") 23 | Pvalb_ids <- get_gene_aba_ish_ids("Pvalb") 24 | Sst_ids <- get_gene_aba_ish_ids("Sst") 25 | 26 | Cux2_ids <- get_gene_aba_ish_ids("Cux2") 27 | Scnn1a_ids <- get_gene_aba_ish_ids("Scnn1a") 28 | Foxp2_ids <- get_gene_aba_ish_ids("Foxp2") 29 | 30 | # For now, we'll just take one of each - you could use more than 3 with ish_slice_heatmap_funs, below. 31 | all_ids <- c(Slc17a7_ids[1], Pvalb_ids[1], Sst_ids[1]) 32 | 33 | all_ids <- c(Cux2_ids[1], Scnn1a_ids[1], Foxp2_ids[1]) 34 | 35 | all_data <- map(all_ids, get_aba_ish_data) 36 | 37 | # Build heatmap plot with functions 38 | # Note - the resolution of these datasets is 200 um per voxel/tile 39 | 40 | # ish_slice_heatmap() gives you simple heatmaps for any single ISH dataset: 41 | ish_slice_heatmap(all_data[[1]], 42 | anno = oa, 43 | direction = "coronal", 44 | colorset = c("black","white"), 45 | slice = 42) 46 | 47 | ish_slice_heatmap(all_data[[2]], 48 | anno = oa, 49 | direction = "coronal", 50 | colorset = viridis(10), 51 | slice = 42) 52 | 53 | ish_slice_heatmap(all_data[[3]], 54 | anno = oa, 55 | direction = "coronal", 56 | colorset = c("white","orange","red"), 57 | slice = 42) 58 | 59 | # ish_slice_heatmap_funs() lets you apply functions to combine multiple ISH datasets 60 | # funs = c("+","+","+") will add all of the values for each gene. 61 | ish_slice_heatmap_funs(all_data, 62 | anno = oa, 63 | direction = "coronal", 64 | slice_num = 42, 65 | funs = c("+","+","+")) 66 | 67 | # You can get the difference between genes with "-". 68 | # For example, you could subtract Pvalb and Sst from Slc17a7 to highlight Glutamatergic regions 69 | ish_slice_heatmap_funs(all_data, 70 | anno = oa, 71 | direction = "coronal", 72 | slice_num = 42, 73 | funs = c("+","-","-")) 74 | 75 | # Or multiply Pvalb and Sst to really highlight where they're coexpressed: 76 | ish_slice_heatmap_funs(all_data[2:3], 77 | anno = oa, 78 | direction = "coronal", 79 | slice_num = 42, 80 | funs = c("+","*")) 81 | 82 | 83 | # You can also make (up to) 3-color overlay heatmaps: 84 | ish_slice_heatmap_3color(all_data[1:2], 85 | anno = oa, 86 | direction = "coronal", 87 | slice_num = 42) 88 | 89 | ish_slice_heatmap_3color(all_data[1:2], 90 | anno = oa, 91 | colors = c("green","blue"), 92 | direction = "coronal", 93 | slice_num = 42) 94 | 95 | ish_slice_heatmap_3color(all_data, 96 | anno = oa, 97 | direction = "coronal", 98 | slice_num = 25) 99 | 100 | ish_slice_heatmap_3color(all_data, 101 | anno = oa, 102 | direction = "saggital", 103 | slice_num = 20) 104 | 105 | 106 | # You can also do any of these in horizontal or saggital slices: 107 | ish_slice_heatmap_3color(all_data[1:2], 108 | anno = oa, 109 | direction = "horizontal", 110 | slice_num = 15) 111 | 112 | ish_slice_heatmap_funs(all_data, 113 | anno = oa, 114 | direction = "saggital", 115 | slice_num = 20, 116 | funs = c("+","+","+")) 117 | 118 | --------------------------------------------------------------------------------