Simple Features for Science (sffs
for short) is a warehouse of vector-based diagrams for use as heatmaps. Such diagrams can provide spatial, conceptual, or anatomical context that traditional cluster heatmaps obscure. Although structured as a package for the R programming language, all diagrams are also stored in both SVG and geojson data formats, so they are widely usable.
If you aren’t already familiar with Simple Features for R, it is good to first get a feel for the basics, as well as plotting simple features and manipulating them.
While you can clone this project’s repo, or install it as a package – to get up and running fast, you can read the geojson file of the individual diagram you wish to use directly into R. Navigate to the diagram in the data-raw/ directory, copy the URL from the “Download” link for its geojson, and pass it to read_sf()
.
library(tidyverse) library(sf) sf_brain <- read_sf("https://raw.githubusercontent.com/tkoomar/sffs/master/data-raw/sf_brain_outer/sf_brain_outer.geojson") head(sf_brain)
## Simple feature collection with 6 features and 7 fields
## geometry type: MULTIPOLYGON
## dimension: XY
## bbox: xmin: 0.049416 ymin: 0.083922 xmax: 0.95521 ymax: 0.956702
## CRS: 4326
## # A tibble: 6 x 8
## id lab_x lab_y line_x line_y line_xend line_yend
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 back… NA NA NA NA NA NA
## 2 M1C 0.580 1.02 0.580 1 0.580 0.8
## 3 OFC 0.93 0.33 0.9 0.34 0.8 0.48
## 4 VFC 1.01 0.580 0.98 0.580 0.88 0.580
## 5 DFC 0.91 0.89 0.88 0.88 0.78 0.7
## 6 V1C -0.03 0.54 0.01 0.54 0.1 0.54
## # … with 1 more variable: geometry <MULTIPOLYGON [°]>
Now, you’re ready to merge it with some dat
a and plot it:
sf_brain_dat <- read_csv("https://raw.githubusercontent.com/tkoomar/sffs/master/data-raw/brain_data.csv") sf_brain %>% left_join(sf_brain_dat) %>% select(id, ends_with('pcw')) %>% plot()
For more details on plotting, see the documentation of sf
, as well as the tutorials in this repo.
Absolutely! The goal of Simple Features for Science is to make these high-quality heatmap diagrams available to the broader scientific community. Please see the github wiki for full details on contributing.
If you would like to have access to all sffs
diagrams for offline use, you can install it from github using devtools
:
devtools::install_github("tkoomar/sffs")
To plot the same data from the Using Raw Data section above with a package-installed version of sffs
:
sf_brain <- sffs::sf_brain_outer sf_brain_data <- sffs::brain_data sf_brain %>% left_join(sf_brain_data) %>% select(id, ends_with('pcw')) %>% plot()