knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) library(ggplot2) library(dplyr) library(knitr) library(qntmap)
This document introduces a way to quantify X-ray maps without quantitatively analyzed spots by inheriting parameters from a previously quantified X-ray map (See figure below).
set.seed(1) spots <- runif(40) %>% matrix(ncol = 2, dimnames = list(NULL, c("x", "y"))) %>% as.data.frame rect <- data.frame(xmin = c(0, 3), xmax = c(1, 4), ymin = 0, ymax = 1) ggplot(spots) + geom_rect(aes(xmin = xmin, xmax = xmax, ymin = ymin, ymax = ymax), data = rect) + geom_point(aes(x, y)) + annotate("text", x = 2, y = -Inf, label = "Sample", vjust = -1, size = 8) + annotate("text", x = c(0.5, 3.5), y = 1, vjust = -.3, size = 5, label = c( "(a) Mapped area\nwith spots", "(b) Mapped area\nwithout spots" )) + xlim(-1, 5) + ylim(-1.5, 2.5) + theme( axis.ticks=element_blank(), axis.ticks.length=unit(0, "null"), axis.text=element_blank(), axis.title=element_blank(), axis.line=element_blank(), panel.background=element_rect(fill = "gray",colour = NA), panel.border=element_blank(), panel.grid=element_blank(), panel.spacing=unit(c(0,0,0,0), "null"), plot.margin=unit(c(0,0,0,0), "null"), legend.position="none", legend.margin=margin(0,0,0,0, "null"), NULL ) + NULL
qntmap 0.3.2
or laterquantify(saving = TRUE)
under qntmap 0.3.2
or later.library(qntmap)
xmap <- read_xmap(".map/2 for example")
Suppose available quantified maps are constructed by following
"Get started", centers_initial0.csv
is available as well.
Read the csv file by following codes.
centers <- read.csv("example/centers_initial0.csv") centers
dirs <- file.path(system.file('extdata', 'minimal', package = 'qntmap'), c(".map/1", ".qnt")) xmap <- read_xmap(dirs[[1]]) qnt <- read_qnt(dirs[[2]], saving = FALSE) kable(find_centers(xmap, qnt, saveas = FALSE))
The above is a example format of initial centers given by sample data introduced in "Get started". Edit the csv file manually if initial centers require modifications, or if there are any phase abscent in new maps to be quantified.
cluster <- cluster_xmap(xmap, centers)
When available quantified mapes are compsoed by quantify()
function,
parameters.csv
is saved in the qntmap
directory within the directory
storing X-ray mapping data.
Specify a file path of parameters.csv
as fix
parameter of
quantify()
function.
quantify(xmap = xmap, qnt = NULL, cluster = cluster, fix = "example/qntmap/parameters.csv")
Note that qnt
paramter is ignored when fix
parameter is specified.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.