ggsegExtra does not contain any atlases it self, but rather retains a record of all confirmed extra atlases compatible with ggseg or ggseg3d. If you have a working atlas, either having made it your self or following one of our other tutorials, and want it featured as a confirmed atlas in ggsegExtra, there are some steps to follow.
Since setting up a package for the first time, particularly a data package, we set up a function to help you get started. It contains tests, and some general set-up we would expect from a ggseg-atlas package. If you already are comfortable making R-packages, skip this step. If not, it is intended to help you set up a skeleton for the package.
To create a ggseg repo, use the RStudio New Project creation GUI, and look for the ggseg icon.
The DESCRIPTION file is a text-file with important information regarding the contents of the package. This file is necessary to edit for several reasons:
Description:
section should be altered to reflect the contents of the package.URL:
and BugReports
must be altered to point to the remote repository it will be stored in.
You will need to place your atlas files, as .rda
files in the data/
folder. The atlas data-objects must have the same name as the file. In this case cc200.rda
should load the object cc200
into an R-environment using load("data/cc200.rda")
, and contain a ggseg-atlas (use is_ggseg_atlas()
and as_ggseg_atlas
to check). Likewise, cc200_3d.rda
should load the object cc200_3d
into an R-environment using load("data/cc200_3d.rda")
, and should contains a ggseg3d-atlas (use is_ggseg3d_atlas()
and as_ggseg3d_atlas
to check). And then adapt the atlas information in the R/cc200.R
to match the atlas you are adding. Take particular care with the reference to the atlas with the original paper first introducing the parcellation.
Once data is added, and references fixed, try to run the tests.
devtools::test()
There will likely be some failures, try to resolve them by looking at the error messages.
Common things to check:
atlas$region
column.
data-raw/palettes.R
for setting it up.brain_pal
object, where each list contains a named string vector, the names should match atlas$region
and the strings should be hexidecimal colour codes.Let us know if you struggle. We would love to improve this tutorial with the issues you might encounter.
Once all tests are passed, try running package checks with:
devtools::check()
which will attempt to build you package and see how it goes.
Look at the error messages and try to resolve them by reading the carefully.
Common things to check:
data/atlas.rda
file, it contains information to both atlases and will fail if only one of them are present in data/
.usethis::use_mit_license("Your Name Here")
There will likely be some failures, try to resolve them. Let us know if you struggle. We would love to improve this tutorial with the issues you might encounter.
If everything goes well, push it all to your remote repository and let us know about it. We will double check and add it if it all checks out!