update_feature: Update aSVG Spatial Features

Description Usage Arguments Value Author(s) References Examples

View source: R/update_feature.R

Description

Successful spatial heatmap plotting requires the aSVG features of interest have matching samples (cells, tissues, etc) in the data. This function is designed to replace existing features in aSVG files with user-provided features. Note this function treats the first column in the feature data frame as user-provided features, so custom features must be the first column.

Usage

1
update_feature(feature, dir)

Arguments

feature

The data frame returned by return_feature with the user-provided features added as the first column.

dir

The directory path where the aSVG files to update. It should be the same with dir in return_feature.

Value

Nothing is returned. The aSVG files of interest in dir are updated with new features, and are ready to use in function spatial_hm.

Author(s)

Jianhai Zhang jzhan067@ucr.edu; zhang.jianhai@hotmail.com
Dr. Thomas Girke thomas.girke@ucr.edu

References

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
# 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.
ft.new <- c('BRAIN', 'HEART')
# Add new features to the first column.
feature.df.new <- cbind(featureNew=ft.new, feature.df)
feature.df.new
# Update features.
update_feature(feature=feature.df.new, dir='~/test')

spatialHeatmap documentation built on Nov. 8, 2020, 5:46 p.m.