nsinc.d {colocalization} | R Documentation |
Colocalization index of d-type
Description
nsinc.d
is used to calculate the Pearson's correlation coefficient of the average proportion densities with complete spatial randomness (CSR) as reference of two types of signals in a specified proximity of all signals or all signals of interested type (or base signals) as the colocalization index for a whole image. If a range of proximity sizes are concerned, the nsinc.d
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.d(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 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 average proportion density with CSR as reference of two types of signals 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 from 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 NSInCd or NSInC of type d. 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 same values for r.min
and r.max
.
Value
nsinc.d
returns all colocalization index 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 neighborhood of all (base) signals, the r series, and some summary information:
method |
"nsinc.d" |
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 d-type at each r. |
index |
the averaged colocalization index of d-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.d(data = mydata, membership = "color", dim = 2)
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.d(data = twolines, membership = "membership",
dim = 3, r.model = "r.med")
twolines.results$index