mdsArrange: mdsArrange

Description Usage Arguments Value Examples

View source: R/mdsArrange.R

Description

A function to take a matrix/dataframe of gene expression data and return a dataframe suitable for plotting as an MDS plot with ggplot2

Usage

1
mdsArrange(d, isAlreadyScaled = FALSE)

Arguments

d

is a dataframe of gene expression data

isAlreadyScaled

Logical value for whether d is already scaled

Value

A dataframe compatible with ggplot2

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
#Using the NKI dataset
library(breastCancerNKI)
library(Biobase)
data(nki)
mtx <- exprs(nki)

#Calculate PCs 1 & 2
mds_dfr <- mdsArrange(d = mtx, isAlreadyScaled = TRUE)
#Merge with phenotypic data for plotting
mds_mrg <- merge(mds_dfr, pData(nki), by = 0)

#Plot MDS and colour by estrogen receptor positivity
library(ggplot2)
ggplot(mds_mrg, aes(x = x, y  = y, colour = as.factor(er))) + 
    geom_point()

abc-igmm/transcripTools documentation built on May 20, 2019, 3:05 p.m.