Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
morpheusR
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Daria Zenkova
morpheusR
Commits
71b2e93e
Commit
71b2e93e
authored
Aug 17, 2016
by
Daria Zenkova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix commit
parent
a0b135a5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
0 deletions
+46
-0
R/pcaPlot.R
R/pcaPlot.R
+24
-0
man/pcaPlot.Rd
man/pcaPlot.Rd
+22
-0
No files found.
R/pcaPlot.R
0 → 100644
View file @
71b2e93e
#' Makes nice PCA plot for expression data
#' @param es an ExpressionSet object, should be normalized
#' @param c1 a number of the first component to plot (numeric)
#' @param c2 a number of the second component to plot (numeric)
#' @examples
#' pcaPlot(es.norm, 1, 2) + aes(color=time)
#' @export
pcaPlot
<-
function
(
es
,
c1
,
c2
)
{
stopifnot
(
require
(
ggplot2
))
pca
<-
prcomp
(
t
(
exprs
(
es
)))
explained
<-
(
pca
$
sdev
)
^
2
/
sum
(
pca
$
sdev
^
2
)
xs
<-
sprintf
(
"PC%s"
,
seq_along
(
explained
))
xlabs
<-
sprintf
(
"%s (%.1f%%)"
,
xs
,
explained
*
100
)
pp
<-
ggplot
(
data
=
cbind
(
as.data.frame
(
pca
$
x
),
pData
(
es
)))
pp
+
geom_point
(
aes
(
x
=
eval
(
parse
(
text
=
xs
[
c1
])),
y
=
eval
(
parse
(
text
=
xs
[
c2
]))),
size
=
3
)
+
xlab
(
xlabs
[
c1
])
+
ylab
(
xlabs
[
c2
])
}
man/pcaPlot.Rd
0 → 100644
View file @
71b2e93e
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/pca_plot.R
\name{pcaPlot}
\alias{pcaPlot}
\title{Makes nice PCA plot for expression data}
\usage{
pcaPlot(es, c1, c2)
}
\arguments{
\item{es}{an ExpressionSet object, should be normalized}
\item{c1}{a number of the first component to plot (numeric)}
\item{c2}{a number of the second component to plot (numeric)}
}
\description{
Makes nice PCA plot for expression data
}
\examples{
pcaPlot(es.norm, 1, 2) + aes(color=time)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment