Start here: create a basic view composition with an intraview
Source:R/view-composers.R
create_initial_view.Rd
This function is the first one to be called when building a mistyR workflow, starting from view composition. The initial view describes the intraview of the sample.
Arguments
- data
A
data.frame
or atibble
containing expression information for all markers of interest (in named columns) for each spatial unit (in rows).- unique.id
A
character
vector. Identifier of the current sample. If not provided (unique.id = NULL
) then an id is automatically generated by calculating the md5 hash oftable
.
Value
An initial mistyR view composition containing an intraview list
item named described with abbreviation "intra" and data as provided
in data
and a misty.uniqueid list item containing the
provided or automatically calculated unique.id
. A cache folder for
the sample will be automatically created in the working directory as a
subfolder of .misty.temp/
with the same name as unique.id
.
See also
Other view composition functions:
add_juxtaview()
,
add_paraview()
,
add_views()
,
create_view()
,
remove_views()
Examples
# Create an intrinsic view from the first sample in the dataset synthetic.
library(dplyr)
# get the expression data
data("synthetic")
expr <- synthetic[[1]] %>% select(-c(row, col, type))
create_initial_view(expr)
#> $intraview
#> $intraview$abbrev
#> [1] "intra"
#>
#> $intraview$data
#> # A tibble: 4,205 × 11
#> ECM ligA ligB ligC ligD protE protF prodA prodB prodC prodD
#> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 0.0385 0.834 0.0157 0.236 1.18 1.18 2.55 0.382 0 0 0.588
#> 2 0.0327 0.119 0.0104 0.804 0.101 0 0.386 0 0 0.536 0
#> 3 0.144 0.525 0.0140 0.334 0.434 1.67 1.61 0.472 0 0 0.379
#> 4 0.387 0.269 0.0367 0.502 0.241 0 0.913 0 0 0.418 0
#> 5 0.163 0.195 0.118 0.232 0.203 0 0.162 0 0.160 0 0
#> 6 0.203 0.178 0.0247 0.738 0.236 0 0.603 0 0 0.555 0
#> 7 0.200 0.170 0.122 0.715 0.246 0 0.862 0 0 0.496 0
#> 8 0.0642 0.162 0.0999 0.549 0.243 0 0.0636 0 0.0623 0 0
#> 9 0.0331 0.229 0.0404 0.246 0.378 0 0.0328 0 0.0322 0 0
#> 10 0.268 0.146 0.0186 0.944 0.232 0 0.490 0 0 0.583 0
#> # ℹ 4,195 more rows
#>
#>
#> $misty.uniqueid
#> [1] "b98ad35f4e671871cba35f2155228612"
#>