assign_analyte_id: Assign analyte ID

Description Usage Arguments Value Examples

View source: R/identify_analyte.R

Description

Replace internal cluster IDs with informative analyte IDs

Usage

1
2
3
4
5
6
7
8
9
assign_analyte_id(
  df,
  .parameter,
  .analyte_id,
  .column_name,
  .cluster_column_name = paste0("cluster_", .column_name),
  .desc = FALSE,
  .data = NULL
)

Arguments

df

The tidy data.frame, with indication of clusters

.parameter

The parameter to order the cluster centers by

.analyte_id

A character vector giving the name of the clusters. The order is important and must match the expected order of clusters.

.column_name

A character giving the name of the column to hold the analyte ID. If the column exists it will be silently dropped.

.cluster_column_name

A character giving the name of the column where the clusters are identified. Will be dropped from the data.frame.

.desc

A boolean giving whether the sort order is descending.

.data

Deprecated. Use df.

Value

A data.frame with cluster names instead of cluster ids.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
## Not run: 
library(beadplexr)
library(magrittr)
library(ggplot2)

data("lplex")

df <- lplex[[1]] %>%
  bp_clara(.parameter = c("FSC-A", "SSC-A"), .column_name = "analyte", .k = 2)

df %>%
  beadplexr:::assign_analyte_id(.parameter = c("FSC-A", "SSC-A"),
                                   .analyte_id = c("A", "B"),
                                   .column_name = "pop name",
                                   .cluster_column_name = "analyte") %>%
  ggplot() +
  aes(x = `FSC-A`, y = `SSC-A`, colour = `pop name`) +
  geom_point()

df %>%
  beadplexr:::assign_analyte_id(.parameter = c("FSC-A", "SSC-A"),
                                   .analyte_id = c("A", "B"),
                                   .column_name = "pop name",
                                   .cluster_column_name = "analyte", .desc = TRUE) %>%
  ggplot() +
  aes(x = `FSC-A`, y = `SSC-A`, colour = `pop name`) +
  geom_point()

## End(Not run)

beadplexr documentation built on April 4, 2020, 5:07 p.m.