Learn R Programming

pcaExplorer (version 1.0.2)

hi_loadings: Extract genes with highest loadings

Description

Extract genes with highest loadings

Usage

hi_loadings(pcaobj, whichpc = 1, topN = 10, exprTable = NULL,
  annotation = NULL, title = "Top/bottom loadings - ")

Arguments

pcaobj
A prcomp object
whichpc
An integer number, corresponding to the principal component of interest
topN
Integer, number of genes with top and bottom loadings
exprTable
A matrix object, e.g. the counts of a DESeqDataSet. If not NULL, returns the counts matrix for the selected genes
annotation
A data.frame object, with row.names as gene identifiers (e.g. ENSEMBL ids) and a column, gene_name, containing e.g. HGNC-based gene symbols
title
The title of the plot

Value

  • A base plot object, or a matrix, if exprTable is not null

Examples

Run this code
dds <- makeExampleDESeqDataSet_multifac(betaSD = 3,betaSD_tissue = 1)
rlt <- DESeq2::rlogTransformation(dds)
pcaobj <- prcomp(t(SummarizedExperiment::assay(rlt)))
hi_loadings(pcaobj,topN = 20)
hi_loadings(pcaobj,topN = 10,exprTable=dds)
hi_loadings(pcaobj,topN = 10,exprTable=counts(dds))

Run the code above in your browser using DataLab