update_feature {spatialHeatmap} | R Documentation |
Successful spatial heatmap plotting requires the aSVG features of interest have matching samples (cells, tissues, etc) in the data. If this requirement is not fulfiled, either the sample identifiers in the data or the spatial feature identifiers in the aSVG should be changed. This function is designed to replace existing feature identifiers, stroke (outline) widths, and/or feature colors in aSVG files with user-provided entries.
update_feature(df.new, dir)
df.new |
The custom feature identifiers, stroke (outline) widths, and/or feature colors, should be included in the data frame returned by return_feature as independent columns, and the corresponding column names should be "featureNew", "strokeNew", and "colorNew" respectively in order to be recognized. |
dir |
The directory path where the aSVG files to update. It should be the same with |
Nothing is returned. The aSVG files of interest in dir
are updated with provided attributes, and are ready to use in function spatial_hm
.
Jianhai Zhang jzhan067@ucr.edu; zhang.jianhai@hotmail.com
Dr. Thomas Girke thomas.girke@ucr.edu
Hadley Wickham, Jim Hester and Jeroen Ooms (2019). xml2: Parse XML. R package version 1.2.2. https://CRAN.R-project.org/package=xml2
Cardoso-Moreira, Margarida, Jean Halbert, Delphine Valloton, Britta Velten, Chunyan Chen, Yi Shao, Angélica Liechti, et al. 2019. "Gene Expression Across Mammalian Organ Development." Nature 571 (7766): 505-9
Gregory R. Warnes, Ben Bolker, Lodewijk Bonebakker, Robert Gentleman, Wolfgang Huber, Andy Liaw, Thomas Lumley, Martin Maechler, Arni Magnusson, Steffen Moeller, Marc Schwartz and Bill Venables (2020). gplots: Various R Programming Tools for Plotting Data. R package version 3.0.3. https://CRAN.R-project.org/package=gplots
# The following shows how to download a chicken aSVG containing spatial features of 'brain' # and 'heart' from the EBI aSVG repository directly # (https://github.com/ebi-gene-expression-group/anatomogram/tree/master/src/svg). An empty # directory is recommended so as to avoid overwriting existing SVG files with the same names. # Here "~/test" is used. # Make an empty directory "~/test" if not exist. if (!dir.exists('~/test')) dir.create('~/test') # Query the remote EBI aSVG repo. feature.df <- return_feature(feature=c('heart', 'brain'), species=c('gallus'), dir='~/test', match.only=TRUE, remote=TRUE) feature.df # New features, stroke widths, colors. ft.new <- c('BRAIN', 'HEART') stroke.new <- c(0.05, 0.1) col.new <- c('green', 'red') # Include new features, stroke widths, colors to the feature data frame. feature.df.new <- cbind(featureNew=ft.new, strokeNew=stroke.new, colorNew=col.new, feature.df) feature.df.new # Update features. update_feature(df.new=feature.df.new, dir='~/test')