Skip to contents

[Experimental]

This helper function returns the first principal component from an assay stored as a matrix.

Usage

colPrinComp1(x, center = TRUE, scale = TRUE)

Arguments

x

(matrix)
containing numeric data with genes in rows and samples in columns, no missing values are allowed.

center

(flag)
whether the variables should be zero centered.

scale

(flag)
whether the variables should be scaled to have unit variance.

Value

A numeric vector containing the principal component values for each column in x.

Examples

object <- hermes_data %>%
  add_quality_flags() %>%
  filter() %>%
  normalize() %>%
  assay("counts")

colPrinComp1(object)
#> 06520011B0023R 06520067C0018R 06520063C0043R 06520105C0017R 06520092C0017R 
#>    -22.7211514    -16.5888471     -8.6643020    -20.3183592     13.4998779 
#> 06520103C0017R 06520001B0023R 06520022C0017R 06520062C0017R 06520101B0017R 
#>     17.9491775      4.7633163    -10.6928704    -16.1907212     30.3749930 
#> 06520047C0017R 06520024B0014R 06520080B0023R 06520093C0017R 06520070C0018R 
#>    -25.6029134    -18.1914202     -6.9932017     36.8659028      0.7099287 
#> 06520023C0018R 06520099B0017R 06520015C0016R 06520019C0023R 
#>     -5.3048871     32.7696234      9.9885728      4.3472814