plot_ccposition_den {tricycle} | R Documentation

## Plot cell cycle position kernel density stratified by a factor

### Description

The function will compute and plot cell cycle position kernel density.

### Arguments

`theta.v` | The cell cycle position - a numeric vector with range between 0 to 2pi.
`color_var.v` | A factor variable to stratify `theta.v`, such as samples or 'CCStage'. The length of it should equal to the length of `theta.v`.
`color_name` | The name of the color_var.v to be used in the legend.
`palette.v` | A string vector to give the color names. It should has the length of the number of levels of `color_var.v`. If not given, the 'Set1' palette will be used. (See `display.brewer.all`) If the number of levels of `color_var.v` is greater than 8, only the top 8 levels of most cell will be shown. You can show them all by feeding enough colors in `palette.v`. Default: NULL
`fig.title` | The title of the figure. Default: NULL
`type` | It can be either of 'linear' or 'circular'. 'linear' corresponds to Cartesian coordinate system and 'circular' for polar coordinate system. Default: 'linear'
`bw` | The smoothing bandwidth to be used. It is equal to the concentration parameter of the von Mises distribution. See `density.circular`. Default: 30
`weighted` | Whether the density should be weighted on the percentage of each level of `color_var.v`. Default: FALSE
`line.size` | The size of the line used by `geom_path`. Default: 0.5
`line.alpha` | The alpha value of the line used by `geom_path`. Default: 0.5
`...` | Other arguments accepted by `geom_path`.

### Details

The function first estimates kernel density using the von Mises distribution. Then, it plots out the density in the polar coordinate system or Cartesian coordinate system. Different colors represents different levels of `color_var.v` and the dashed black line is the marginal distribution of all cells.

### Value

A ggplot object

### Author(s)

Shijie C. Zheng

### See Also

`estimate_Schwabe_stage`, for inferring 5 stages of cell cycle

### Examples

    data(neurosphere_example, package = "tricycle")
    neurosphere_example <- estimate_cycle_position(neurosphere_example)
    plot_ccposition_den(neurosphere_example$tricyclePosition, neurosphere_example$sample, "sample")

    neurosphere_example <- estimate_Schwabe_stage(neurosphere_example,
     gname.type = "ENSEMBL", species = "mouse")
    plot_ccposition_den(neurosphere_example$tricyclePosition, neurosphere_example$CCStage, "CCStage")

[Package tricycle version 1.0.0 Index]