nsinc.z {colocalization} | R Documentation |
Colocalization index of z-type
Description
nsinc.z
is used to calculate the Pearson's correlation coefficient of the signal proportions of two channels with a z-score normalization based on complete spatial randomness (CSR) in a specified proximity of all signals or all signals of interested type as the colocalization index for a whole image. If a range of proximity sizes are concerned, the nsinc.z
will take the average of the index values over the range. In the case of multiple-species data, the average of index values of all pairs at each proximity size is taken as the index for the image at that size of neighborhood.
Usage
nsinc.z(data, membership, dim = 2, r.min = NULL,
r.max = NULL, r.count = NULL, r.adjust = NULL,
box = NULL, edge.effect = TRUE, strata = FALSE,
base.member = NULL, r.model = "full", ...)
Arguments
data |
a data frame (or object coercible by as.data.frame to a data frame) containing at least the columns |
membership |
a string describing the column name in the |
dim |
an integer either |
r.min |
the minimum proximity size that the user identifies as colocalization of signals. It should be numeric. If |
r.max |
the maximum proximity size that the user identifies as colocalization of signals. It should be numeric. If |
r.count |
the total count of the series of proximity sizes between |
r.adjust |
a very small adjustment for |
box |
a one-row data frame describing the study region which must contain columns |
edge.effect |
a logical value showing whether the edge effect should be corrected. By default it should be corrected otherwise the results are not accurate. |
strata |
a logical value showing whether the user wants to consider single-direction or bi-direction colocalization. By default |
base.member |
one level of the memberships that is designated as the base. It works only when |
r.model |
equals either |
... |
Parameters passed to |
Details
The function calculates the proportion of two types of signals normalized by a z-score under CSR in a specified r neighborhood with edge effect corrected of all signals or all base signals if strata = TRUE
is specified, then obtains the Pearson correlation coefficients of each pair of channels and average them among all pairs at each r in the r series between r.min
to r.max
. In the case of multiple-species data, the average of index values of all pairs at each proximity size is taken as the index for the image at that size of neighborhood. The index for the whole image is named as NSInCz or NSInC of type z. The index will be close to 1 if signals are colocalized, 0 if random and -1 if dispersed. The function can deal with 2D or 3D data.
If the users have their specific proximity size, then they are encouraged to specify r.model = "other"
, and values of r.min
and r.max
.
The difference from nsinc.d
is the normalization of the signal proportions. The z-type normalization has no heterogeneity under CSR caused by the edge effects related to the locations of signals. In many cases, nsinc.d
and nsinc.z
can give similar results. However, if the user's proximity of interest is larger than half of the largest inter-point distances, then nsinc.d
is suggested.
Value
nsinc.z
returns colocalization index values at each separate proximity size r, and the average colocalization index across all r's, the data that the colocalization index is calculated from, the study region, i.e., the carrying box, the original and normalized proportions of each type of signals in an r neighborhodd of all (base) signals, the r series, and some summary information:
method |
"nsinc.z" |
input.data.summary |
a list containing the number of membership levels and the signal counts in each channel or membership of the input data. |
post.data.summary |
a list showing the number of membership levels and signal counts in each channel of the data after removal of signals located outside the specified box by the user. If there is no signals excluded, then |
r.summary |
a data frame listing the |
strata |
a list showing the default setting of strata or the specified strata by the user. It also presents the base membership used in the function if |
edge.effect |
a data frame containing a logical value indicating whether edge effect is corrected or not. |
index.all |
a data frame showing the colocalization index of z-type at each r. |
index |
the averaged colocalization index of z-type across all r's. |
post.data |
a data frame representing the data after removal of signals located outside the specified box by the user. If there is no signal excluded, then |
study.region |
the carrying box with the size of buffer width in each dimension. |
P.all |
the data frame showing all original and normalized proportions of each type of signals in an r-neighborhood around every (base) signal. Rows are (base) signals and columns are all memberships and r's. |
r |
the r series for which the colocalization indices are calculated. |
Author(s)
Xueyan Liu, Jiahui Xu, Cheng Cheng, Hui Zhang.
References
Liu, X., Xu, J., Guy C., Romero E., Green D., Cheng, C., Zhang, H. (2019). Unbiased and Robust Analysis of Co-localization in Super-resolution Images. Manuscript submitted for publication.
Examples
## a simulated 2D example data.
set.seed(1234)
x <- runif(300, min = -1, max = 1)
y <- runif(300, min = -1, max = 1)
red <- data.frame(x,y, color = "red")
x <- runif(50, min = -1, max = 1)
y <- runif(50, min = -1, max = 1)
green <- data.frame(x,y, color = "green")
mydata <- rbind(red,green)
plot(mydata$x,mydata$y,col = mydata$color)
mydata.results <- nsinc.z(data = mydata, membership = "color", dim = 2,
r.model = "other", r.min = 0.01, r.max = 0.5, r.count = 5, r.adjust = 0)
mydata.results$index.all
mydata.results$index
## a simulated 3D example data.
data("twolines")
library("rgl")
plot3d(twolines[,c("x","y","z")], type='s', size=0.7, col = twolines$membership)
aspect3d("iso")
twolines.results <- nsinc.z(data = twolines, membership = "membership",
dim = 3, r.model = "full")
twolines.results$index