imbalance_score | R Documentation |

Compute a imbalance score to show whether nearby cells have the same condition of not

```
imbalance_score(Object, ...)
## S4 method for signature 'matrix'
imbalance_score(Object, conditions, k = 10, smooth = 10)
## S4 method for signature 'SingleCellExperiment'
imbalance_score(Object, dimred = 1, conditions, k = 10, smooth = 10)
```

`Object` |
A |

`...` |
parameters including: |

`conditions` |
Either the vector of conditions, or a character indicating which column of the metadata contains this vector |

`k` |
The number of neighbors to consider when computing the score. Default to 10. |

`smooth` |
The smoothing parameter. Default to k. Lower values mean that we smooth more. |

`dimred` |
A string or integer scalar indicating the reduced dimension
result in |

Either a list with the `scaled_scores`

and the `scores`

for
each cell, if input is a matrix, or the `SingleCellExperiment`

object, wit this list in the `colData`

.

```
data("toy_dataset")
scores <- imbalance_score(as.matrix(toy_dataset$sd[,1:2]),
toy_dataset$sd$conditions, k = 4)
cols <- as.numeric(cut(scores$scaled_scores, 8))
plot(as.matrix(toy_dataset$sd[, 1:2]), xlab = "Dim1", ylab = "Dim2",
pch = 16, col = RColorBrewer::brewer.pal(8, "Blues")[cols])
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.