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
37f09427
Commit
37f09427
authored
Sep 01, 2016
by
Daria Zenkova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added support of size and colour in ggplot2
parent
71b2e93e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
7 deletions
+44
-7
NAMESPACE
NAMESPACE
+1
-0
R/createES.R
R/createES.R
+12
-0
R/pcaPlot.R
R/pcaPlot.R
+26
-7
morpheusR.Rproj
morpheusR.Rproj
+5
-0
No files found.
NAMESPACE
View file @
37f09427
# Generated by roxygen2: do not edit by hand
# Generated by roxygen2: do not edit by hand
export(pcaPlot)
export(pcaPlot)
export(createES)
\ No newline at end of file
R/createES.R
0 → 100644
View file @
37f09427
createES
<-
function
(
data
,
pData
,
labelDescription
,
colNames
,
rowNames
)
{
exprs
<-
data
colnames
(
exprs
)
<-
colNames
truePData
<-
t
(
pData
)
pd
<-
data.frame
(
truePData
,
row.names
=
colNames
)
names
(
pd
)
<-
labelDescription
require
(
Biobase
)
phenoData
<-
AnnotatedDataFrame
(
pd
)
featureData
<-
AnnotatedDataFrame
(
data.frame
(
rowNames
))
es
<-
ExpressionSet
(
assayData
=
exprs
,
phenoData
=
phenoData
,
featureData
=
featureData
)
return
(
es
)
}
\ No newline at end of file
R/pcaPlot.R
View file @
37f09427
...
@@ -5,20 +5,39 @@
...
@@ -5,20 +5,39 @@
#' @examples
#' @examples
#' pcaPlot(es.norm, 1, 2) + aes(color=time)
#' pcaPlot(es.norm, 1, 2) + aes(color=time)
#' @export
#' @export
pcaPlot
<-
function
(
es
,
c
1
,
c2
)
{
pcaPlot
<-
function
(
es
,
c
olumns
,
c1
,
c2
,
size
=
""
,
colour
=
""
)
{
stopifnot
(
require
(
ggplot2
))
stopifnot
(
require
(
ggplot2
))
pca
<-
prcomp
(
t
(
exprs
(
es
)))
stopifnot
(
require
(
Biobase
))
data
<-
t
(
exprs
(
es
)[
columns
,])
pca
<-
prcomp
(
~
.
,
data.frame
(
data
))
explained
<-
(
pca
$
sdev
)
^
2
/
sum
(
pca
$
sdev
^
2
)
explained
<-
(
pca
$
sdev
)
^
2
/
sum
(
pca
$
sdev
^
2
)
xs
<-
sprintf
(
"PC%s"
,
seq_along
(
explained
))
xs
<-
sprintf
(
"PC%s"
,
seq_along
(
explained
))
xlabs
<-
sprintf
(
"%s (%.1f%%)"
,
xs
,
explained
*
100
)
xlabs
<-
sprintf
(
"%s (%.1f%%)"
,
xs
,
explained
*
100
)
pp
<-
ggplot
(
data
=
cbind
(
as.data.frame
(
pca
$
x
),
pData
(
es
)))
pData
<-
pData
(
es
)[
!
(
rownames
(
pData
(
es
))
%in%
setdiff
(
rownames
(
pData
(
es
)),
rownames
(
pca
$
x
))),]
pp
<-
ggplot
(
data
=
cbind
(
as.data.frame
(
pca
$
x
),
pData
))
if
(
size
==
""
&&
colour
==
""
)
{
aes
<-
aes
(
x
=
eval
(
parse
(
text
=
xs
[
c1
])),
y
=
eval
(
parse
(
text
=
xs
[
c2
])))
}
else
if
(
size
==
""
&&
colour
!=
""
)
{
c
<-
pData
[[
colour
]];
aes
<-
aes
(
x
=
eval
(
parse
(
text
=
xs
[
c1
])),
y
=
eval
(
parse
(
text
=
xs
[
c2
])),
colour
=
c
)
}
else
if
(
size
!=
""
&&
colour
==
""
)
{
s
<-
pData
[[
size
]];
aes
<-
aes
(
x
=
eval
(
parse
(
text
=
xs
[
c1
])),
y
=
eval
(
parse
(
text
=
xs
[
c2
])),
size
=
s
)
}
else
{
s
<-
pData
[[
size
]]
c
<-
pData
[[
colour
]]
aes
<-
aes
(
x
=
eval
(
parse
(
text
=
xs
[
c1
])),
y
=
eval
(
parse
(
text
=
xs
[
c2
])),
colour
=
c
,
size
=
s
)
}
pp
+
pp
+
geom_point
(
aes
(
x
=
eval
(
parse
(
text
=
xs
[
c1
])),
geom_point
(
aes
)
+
y
=
eval
(
parse
(
text
=
xs
[
c2
]))),
size
=
3
)
+
xlab
(
xlabs
[
c1
])
+
ylab
(
xlabs
[
c2
])
xlab
(
xlabs
[
c1
])
+
ylab
(
xlabs
[
c2
])
}
}
morpheusR.Rproj
View file @
37f09427
...
@@ -5,8 +5,13 @@ SaveWorkspace: No
...
@@ -5,8 +5,13 @@ SaveWorkspace: No
AlwaysSaveHistory: Default
AlwaysSaveHistory: Default
EnableCodeIndexing: Yes
EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8
Encoding: UTF-8
RnwWeave: Sweave
LaTeX: pdfLaTeX
AutoAppendNewline: Yes
AutoAppendNewline: Yes
StripTrailingWhitespace: Yes
StripTrailingWhitespace: Yes
...
...
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