get_cohort_outliers: Detect the outlying samples in a cohort.

Description Usage Arguments Details Value See Also Examples

View source: R/outlier-detection.R

Description

This function wraps mirmodels::compute_pcas() and hence uses rrcov::PcaGrid() to do robust PCA analysis and detect outliers.

Usage

1

Arguments

cohort

A two-character string, e.g. "BW".

Details

Prior to PCA calculation (and outlier detection), a call to mirmodels::linear_correct() is made to regress away the effect of the total number of counts on gene expression levels, with care taken to not regress away the effect of gestational age.

There's an Easter egg. You can pass a data frame directly as the cohort argument and then the function will use that rather than having to call get_*_data() to get the data. I advise get_*_data(log2 = TRUE, tot_counts = TRUE, gene_pred = ~median(.) > 0).

Value

An object of class mirvie_cohort_outliers. This is a data frame with 5 principal components named PC1, PC2, . . ., PC5. It also has columns meta_collectionga, mirvie_id and outlier which is a boolean column where TRUE indicates an outlier. This object has attributes var_exp and loadings. Read the documentation of mirmodels::compute_pcas() for more on those.

See Also

autoplot.mirvie_cohort_outliers()

Examples

1
2
3
4
if (require("mirmodels")) {
  ga_outliers <- get_cohort_outliers("ga")
  autoplot(ga_outliers)
}

mirvie/mirmisc documentation built on Dec. 21, 2021, 7 p.m.