Skip to content

Commit

Permalink
Version Beta.1 upload to github
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardojo committed Sep 12, 2023
0 parents commit 93ed8a0
Show file tree
Hide file tree
Showing 134 changed files with 121,679 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
4 changes: 4 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
^.*\.Rproj$
^\.Rproj\.user$
^README\.Rmd$
^data-raw$
7 changes: 7 additions & 0 deletions .Rproj.user/02275A6F/build_options
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
auto_roxygenize_for_build_and_reload="1"
auto_roxygenize_for_build_package="1"
auto_roxygenize_for_check="1"
live_preview_website="0"
makefile_args=""
preview_website="1"
website_output_format="all"
5 changes: 5 additions & 0 deletions .Rproj.user/02275A6F/pcs/debug-breakpoints.pper
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"debugBreakpointsState": {
"breakpoints": []
}
}
9 changes: 9 additions & 0 deletions .Rproj.user/02275A6F/pcs/files-pane.pper
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"sortOrder": [
{
"columnIndex": 2,
"ascending": true
}
],
"path": "~/Library/CloudStorage/OneDrive-UniversiteitUtrecht/Postdoc/ggPlantmap/ggPlantmap"
}
3 changes: 3 additions & 0 deletions .Rproj.user/02275A6F/pcs/source-pane.pper
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"activeTab": 2
}
14 changes: 14 additions & 0 deletions .Rproj.user/02275A6F/pcs/windowlayoutstate.pper
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"left": {
"splitterpos": 350,
"topwindowstate": "NORMAL",
"panelheight": 734,
"windowheight": 772
},
"right": {
"splitterpos": 459,
"topwindowstate": "NORMAL",
"panelheight": 734,
"windowheight": 772
}
}
5 changes: 5 additions & 0 deletions .Rproj.user/02275A6F/pcs/workbench-pane.pper
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"TabSet1": 3,
"TabSet2": 3,
"TabZoom": {}
}
8 changes: 8 additions & 0 deletions .Rproj.user/02275A6F/persistent-state
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
build-last-errors="[]"
build-last-errors-base-dir="~/Library/CloudStorage/OneDrive-UniversiteitUtrecht/Postdoc/ggPlantmap/ggPlantmap/"
build-last-outputs="[{\"type\":0,\"output\":\"==> devtools::document(roclets = c('rd', 'collate', 'namespace', 'vignette'))\\n\\n\"},{\"type\":2,\"output\":\"ℹ Updating ggPlantmap documentation\\n\"},{\"type\":2,\"output\":\"Warning: Version of roxygen2 last used with this package is 7.2.3. You only have version 7.1.2\\nℹ Loading ggPlantmap\\n\"},{\"type\":1,\"output\":\"Writing NAMESPACE\\n\"},{\"type\":1,\"output\":\"Writing NAMESPACE\\n\"},{\"type\":1,\"output\":\"Documentation completed\\n\\n\"},{\"type\":0,\"output\":\"==> R CMD INSTALL --no-multiarch --with-keep.source ggPlantmap\\n\\n\"},{\"type\":1,\"output\":\"* installing to library ‘/Library/Frameworks/R.framework/Versions/4.1/Resources/library’\\n\"},{\"type\":1,\"output\":\"* installing *source* package ‘ggPlantmap’ ...\\n\"},{\"type\":1,\"output\":\"\"},{\"type\":1,\"output\":\"** using staged installation\\n\"},{\"type\":1,\"output\":\"** R\\n\"},{\"type\":1,\"output\":\"** data\\n\"},{\"type\":1,\"output\":\"*** moving datasets to lazyload DB\\n\"},{\"type\":1,\"output\":\"\"},{\"type\":1,\"output\":\"** byte-compile and prepare package for lazy loading\\n\"},{\"type\":1,\"output\":\"\"},{\"type\":1,\"output\":\"** help\\n\"},{\"type\":1,\"output\":\"\"},{\"type\":1,\"output\":\"*** installing help indices\\n\"},{\"type\":1,\"output\":\"\"},{\"type\":1,\"output\":\"*** copying figures\\n\"},{\"type\":1,\"output\":\"** building package indices\\n\"},{\"type\":1,\"output\":\"\"},{\"type\":1,\"output\":\"** testing if installed package can be loaded from temporary location\\n\"},{\"type\":1,\"output\":\"\"},{\"type\":1,\"output\":\"** testing if installed package can be loaded from final location\\n\"},{\"type\":1,\"output\":\"\"},{\"type\":1,\"output\":\"** testing if installed package keeps a record of temporary installation path\\n\"},{\"type\":1,\"output\":\"\"},{\"type\":1,\"output\":\"* DONE (ggPlantmap)\\n\"},{\"type\":1,\"output\":\"\"}]"
compile_pdf_state="{\"tab_visible\":false,\"running\":false,\"target_file\":\"\",\"output\":\"\",\"errors\":[]}"
files.monitored-path=""
find-in-files-state="{\"handle\":\"\",\"input\":\"\",\"path\":\"\",\"regex\":false,\"ignoreCase\":false,\"results\":{\"file\":[],\"line\":[],\"lineValue\":[],\"matchOn\":[],\"matchOff\":[],\"replaceMatchOn\":[],\"replaceMatchOff\":[]},\"running\":false,\"replace\":false,\"preview\":false,\"gitFlag\":false,\"replacePattern\":\"\"}"
imageDirtyState="1"
saveActionState="-1"
10 changes: 10 additions & 0 deletions .Rproj.user/02275A6F/rmd-outputs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/var/folders/6g/3y4xtlkx5tdf56sf5l6ggy380000gn/T//Rtmp9Eezg7/preview-af449c30689.html
/var/folders/6g/3y4xtlkx5tdf56sf5l6ggy380000gn/T//Rtmp9Eezg7/preview-b0d473f4a7bf.html
/var/folders/6g/3y4xtlkx5tdf56sf5l6ggy380000gn/T//Rtmp9Eezg7/preview-addd7f5d8928.html
/var/folders/6g/3y4xtlkx5tdf56sf5l6ggy380000gn/T//Rtmp9Eezg7/preview-ae08172bd625.html
/var/folders/6g/3y4xtlkx5tdf56sf5l6ggy380000gn/T//Rtmp9Eezg7/preview-ae36caac5e0.html





1 change: 1 addition & 0 deletions .Rproj.user/02275A6F/saved_source_markers
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"active_set":"","sets":[]}
6 changes: 6 additions & 0 deletions .Rproj.user/02275A6F/sources/prop/01D5028E
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"source_window_id": "",
"Source": "Source",
"cursorPosition": "19,15",
"scrollLine": "0"
}
6 changes: 6 additions & 0 deletions .Rproj.user/02275A6F/sources/prop/0D0752A6
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"source_window_id": "",
"Source": "Source",
"cursorPosition": "17,1",
"scrollLine": "0"
}
6 changes: 6 additions & 0 deletions .Rproj.user/02275A6F/sources/prop/1642A531
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"source_window_id": "",
"Source": "Source",
"cursorPosition": "0,0",
"scrollLine": "0"
}
6 changes: 6 additions & 0 deletions .Rproj.user/02275A6F/sources/prop/1767B849
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"source_window_id": "",
"Source": "Source",
"cursorPosition": "32,38",
"scrollLine": "25"
}
6 changes: 6 additions & 0 deletions .Rproj.user/02275A6F/sources/prop/4BD52895
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"source_window_id": "",
"Source": "Source",
"cursorPosition": "11,46",
"scrollLine": "0"
}
6 changes: 6 additions & 0 deletions .Rproj.user/02275A6F/sources/prop/690B81C6
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"source_window_id": "",
"Source": "Source",
"cursorPosition": "189,0",
"scrollLine": "0"
}
4 changes: 4 additions & 0 deletions .Rproj.user/02275A6F/sources/prop/A37668AD
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"source_window_id": "",
"Source": "Source"
}
6 changes: 6 additions & 0 deletions .Rproj.user/02275A6F/sources/prop/AB597954
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"source_window_id": "",
"Source": "Source",
"cursorPosition": "106,0",
"scrollLine": "0"
}
7 changes: 7 additions & 0 deletions .Rproj.user/02275A6F/sources/prop/B14A132A
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"tempName": "Untitled1",
"source_window_id": "",
"Source": "Source",
"cursorPosition": "51,82",
"scrollLine": "0"
}
6 changes: 6 additions & 0 deletions .Rproj.user/02275A6F/sources/prop/B57A3B94
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"source_window_id": "",
"Source": "Source",
"cursorPosition": "0,0",
"scrollLine": "0"
}
6 changes: 6 additions & 0 deletions .Rproj.user/02275A6F/sources/prop/FDB464DC
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"source_window_id": "",
"Source": "Source",
"cursorPosition": "194,0",
"scrollLine": "0"
}
11 changes: 11 additions & 0 deletions .Rproj.user/02275A6F/sources/prop/INDEX
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
~%2FLibrary%2FCloudStorage%2FOneDrive-UniversiteitUtrecht%2FPostdoc%2FggPlantmap%2FggPlantmap%2FDESCRIPTION="01D5028E"
~%2FLibrary%2FCloudStorage%2FOneDrive-UniversiteitUtrecht%2FPostdoc%2FggPlantmap%2FggPlantmap%2FNAMESPACE="1642A531"
~%2FLibrary%2FCloudStorage%2FOneDrive-UniversiteitUtrecht%2FPostdoc%2FggPlantmap%2FggPlantmap%2FR%2Fdata.R="4BD52895"
~%2FLibrary%2FCloudStorage%2FOneDrive-UniversiteitUtrecht%2FPostdoc%2FggPlantmap%2FggPlantmap%2FR%2Ffunctions.R="B14A132A"
~%2FLibrary%2FCloudStorage%2FOneDrive-UniversiteitUtrecht%2FPostdoc%2FggPlantmap%2FggPlantmap%2FR%2Fhello.R="0D0752A6"
~%2FLibrary%2FCloudStorage%2FOneDrive-UniversiteitUtrecht%2FPostdoc%2FggPlantmap%2FggPlantmap%2FREADME.Rmd="FDB464DC"
~%2FLibrary%2FCloudStorage%2FOneDrive-UniversiteitUtrecht%2FPostdoc%2FggPlantmap%2FggPlantmap%2Fdata-raw%2FDATASET.R="A37668AD"
~%2FLibrary%2FCloudStorage%2FOneDrive-UniversiteitUtrecht%2FPostdoc%2FggPlantmap%2FggPlantmap%2Fdata-raw%2Fpreprocess.R="1767B849"
~%2FLibrary%2FCloudStorage%2FOneDrive-UniversiteitUtrecht%2FPostdoc%2Fggphytomap%2Ftrial%2Fggphytomap.trial%2FDESCRIPTION="B57A3B94"
~%2FLibrary%2FCloudStorage%2FOneDrive-UniversiteitUtrecht%2FPostdoc%2Fggphytomap%2Ftrial%2Fggphytomap.trial%2FR%2Ffunctions.R="AB597954"
~%2FLibrary%2FCloudStorage%2FOneDrive-UniversiteitUtrecht%2FPostdoc%2Fggphytomap%2Ftrial%2Fggphytomap.trial%2FREADME.Rmd="690B81C6"
21 changes: 21 additions & 0 deletions .Rproj.user/02275A6F/sources/s-77013F18/00EC171F-contents
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Package: ggPlantmap
Type: Package
Title: ggPlantmap
Version: 0.1.0
Authors@R:
person("Leonardo", "jo", ,"[email protected]", role = c("aut", "cre"))
Maintainer: Leonardo Jo <[email protected]>
Description: gPlantmap is a R tidyverse based package with a series of plant images to be mapped in a ggplot enviroment.
We also provide a series of functions and instructions to easily create your own personal ggPlantmap.
These ggPlantmap objects can be added into R pipelines for the visual representation of quantitative data in plant distinct cells/structures.
License: `use_gpl3_license()`
Encoding: UTF-8
LazyData: true
Imports:
dplyr,
tibble,
ggplot2,
XML
Depends:
R (>= 2.10)
RoxygenNote: 7.2.3
106 changes: 106 additions & 0 deletions .Rproj.user/02275A6F/sources/s-77013F18/1E5380C1-contents
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
#' XML.to.ggPlantmap
#'
#' @description Open an Icy generated XML file and extract x and y coordinates of ROIs
#'
#' @param data XML file name (character string; e.g. "arabidopsis.root.crosssection.xml").
#'
#' @return A tibble table with x,y coordinates of individual ROIs (ROI.id) and the name of the ROI (ROI.name)
#' @import dplyr XML
#' @importFrom dplyr tibble
#' @export
#'
#' @examples
#' XML.to.ggPlantmap("arabidopsis.root.crossection.xml")
XML.to.ggPlantmap <- function(data) {
xml.ROI <- XML::xmlToList(data)
final.ROI <- NULL
for (x in 1:length(xml.ROI)) {
ROI <- xml.ROI[x]
for (k in 1:length(ROI$roi$points)) {
x <- as.numeric(ROI$roi$points[k]$point$pos_x)
y <- as.numeric(ROI$roi$points[k]$point$pos_y)
final.ROI2 <- dplyr::tibble(point=k,x=x,y=y*-1,ROI.name=ROI$roi$name,id=ROI$roi$id)
final.ROI <- rbind(final.ROI,final.ROI2)
}
}

final.ROI3 <- dplyr::tibble(id = as.numeric(unique(final.ROI$id))) %>%
dplyr::arrange(id) %>%
dplyr::mutate(ROI.id = seq(1,length(unique(final.ROI$id)))) %>%
merge(final.ROI,by="id") %>%
dplyr::arrange(ROI.id,point) %>%
dplyr::select(ROI.name,ROI.id,point,x,y)
dplyr::tibble(final.ROI3)
}

#' ggPlantmap.plot
#'
#' @description create a ggplot sample from a ggPlantmap table object
#'
#' @param data The ggPlantmap tibble to be displayed
#' @param layer The level in which you want to distinguish the different ROIs. For example ROI.name,ROI.id or any other classifier you determined (Default: ROI.name).
#' @param linewdith The line width of the tracing lines of your ggplot (Default = 0.5).
#' @param show.legend logical. Should a legend for the levels to be included in the plot? If there are too many levels, legends can overwhelm the image. In this case, change to FALSE (Default: TRUE).
#' @return A ggplot generated map of your ggPlantmap object with colors separated by layers.
#' @import ggplot2
#' @export
#'
#' @examples
#' ggPlantmap.plot(data=ggPm.At.3weekrosette.topview,layer=ROI.name,linewdith=1,show.legend=T)
ggPlantmap.plot <- function(data,layer=ROI.name,linewidth=0.5,show.legend=T) {
ggPlantmap <- data
##ar <- (max(ggPlantmap$y) - min(ggPlantmap$y))/(max(ggPlantmap$x) - min(ggPlantmap$x)) ## recording the aspect ratio of the whole image to adjust it in the final plot.
ggplot2::ggplot(ggPlantmap, aes(x = x, y = y)) +
geom_polygon(aes(group=ROI.id,fill=factor({{layer}})),colour="black",size=linewidth,show.legend={{show.legend}}) +
theme_void() +
theme(panel.grid = element_blank(),legend.position="right") +
coord_fixed()
##theme(aspect.ratio = ar)
}

#' ggPlantmap.merge
#'
#' @description combine a ggPlantmap with a table that contain quantitative data for specific ROIs of your ggPlantmap.
#'
#' @param data The ggPlantmap tibble
#' @param value The value table you want to combine with the ggPlantmap tibble. For simplicity, it would be better if this value table is pre-processed so the only information within it are the level ids (Ex: ROI.name) and the value column (Ex: A specific gene expression values in all the different level ids).
#' @param id.x Character string. The name of the column in your ggPlantmap tibble where you want to match to the value table. IMPORTANT: It is important to write as a character string, so in between quotes #' @param id.x The name of the column in your ggPlantmap tibble where you want to match to the value table (Ex: "ROI.name").
#' @param id.y Character string. The name of the column in your value table where you want to match to the ggPlantmap table (Ex: ROI.name). By default, this function will consider that the column names are exactly the same. In this case you don't need to specify id.y. In case of a different column name, you need to specify the column in the value table that correspond to the one in your ggPlantmap. Also as a character string (Ex: "Cell names").
#' @return A merged tibble with values assigned to specific levels of your ggPlantmap
#' @import dplyr
#' @export
#'
#' @examples
#' ggPlantmap.merge(map=ggPm.At.seed.developmentalseries,value=ggPm.At.seed.expressionsample,id.x="ROI.name")
ggPlantmap.merge <- function(map,value,id.x,id.y=id.x) {
map %>%
merge(value,by.x={{id.x}},by.y={{id.y}},all.x=T) %>%
arrange(ROI.id,point) %>%
tibble()
}

#' ggPlantmap.heatmap
#'
#' @description produce a heatmap from a ggPlantmap that contains quantitative values for specific ROI levels.
#'
#' @param map.quant The ggPlantmap tibble with quantitative values.
#' @param value.quant The name of the column that contains the quantitative values (Ex: Gene.expression).
#' @param linewdith The line width of the tracing lines of your ggplot (Default = 0.5).
#' @param show.legend logical. Should a legend for the levels to be included in the plot? If there are too many levels, legends can overwhelm the image. In this case, change to FALSE (Default: TRUE).
#' @return A ggplot generated heatmap of your ggPlantmap with colors that depicts the continuous values of your quantitative data. You can integrate this with a ggplot gradient scale (Example: + scale_fill_gradient())
#' @import ggplot2
#' @export
#'
#' @examples
#' quant.data <- ggPlantmap.merge(map=ggPm.At.seed.developmentalseries,value=ggPm.At.seed.expressionsample,id.x="ROI.name")
#' ggPlantmap.heatmap(map.quant=quant.data,value.quant=gene.expression,linewdith=1,show.legend=T) +
#' scale_fill_gradient(low="white",high="red")
ggPlantmap.heatmap <- function(map.quant,value.quant=value.quant,show.legend=T,linewidth=0.5) {
ggPlantmap <- map.quant
ar <- (max(ggPlantmap$y) - min(ggPlantmap$y))/(max(ggPlantmap$x) - min(ggPlantmap$x)) ## recording the aspect ratio of the whole image to adjust it in the final plot.
ggplot2::ggplot(ggPlantmap, aes(x = x, y = y)) +
geom_polygon(aes(group=ROI.id,fill={{value.quant}}),colour="black",size=linewidth,show.legend={{show.legend}}) +
theme_void() +
theme(panel.grid = element_blank(),legend.position="right") +
theme(aspect.ratio = ar)
}
3 changes: 3 additions & 0 deletions .Rproj.user/02275A6F/sources/s-77013F18/32328C73-contents
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
library(ggplot2)
ggplot2::ggplot(ggPm.At.3weekrosette.topview) +
geom_polygon(aes(x,y,group=ROI.id),fill="white",colour="black",linewidth=0.1)
3 changes: 3 additions & 0 deletions .Rproj.user/02275A6F/sources/s-77013F18/3A30653C-contents
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## code to prepare `DATASET` dataset goes here

usethis::use_data(DATASET, overwrite = TRUE)
26 changes: 26 additions & 0 deletions .Rproj.user/02275A6F/sources/s-77013F18/3D23095A
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"id": "3D23095A",
"path": "~/Library/CloudStorage/OneDrive-UniversiteitUtrecht/Postdoc/ggPlantmap/ggPlantmap/R/data.R",
"project_path": "R/data.R",
"type": "r_source",
"hash": "0",
"contents": "",
"dirty": false,
"created": 1694528799365.0,
"source_on_save": false,
"relative_order": 3,
"properties": {
"source_window_id": "",
"Source": "Source",
"cursorPosition": "11,46",
"scrollLine": "0"
},
"folds": "",
"lastKnownWriteTime": 1694528879,
"encoding": "UTF-8",
"collab_server": "",
"source_window": "",
"last_content_update": 1694528879999,
"read_only": false,
"read_only_alternatives": []
}
Loading

0 comments on commit 93ed8a0

Please sign in to comment.