Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bios4biol
bioinfo-utils
Commits
a76b20c4
Commit
a76b20c4
authored
Mar 15, 2016
by
Celine Noirot
Browse files
debug if 2 library
parent
6907d0b4
Changes
1
Hide whitespace changes
Inline
Side-by-side
bin/Normalization.R
View file @
a76b20c4
...
...
@@ -10,7 +10,7 @@ packages <- c("optparse", # to read arguments from a command line
for
(
package
in
packages
){
# if package is installed locally, load
if
(
!
(
package
%in%
rownames
(
installed.packages
())))
{
install.packages
(
package
)
install.packages
(
package
,
repos
=
"http://cran.univ-paris1.fr"
)
}
do.call
(
'library'
,
list
(
package
))
}
...
...
@@ -100,14 +100,16 @@ ggsave(filename = normalizePath(file.path(opt$out, "rawcount_boxplot.svg"),
mustWork
=
FALSE
),
width
=
11
,
height
=
7
)
## MDS
MDS_PC
<-
data.frame
(
plotMDS
(
PC_before_log
)
$
cmdscale.out
)
ggplot
(
MDS_PC
,
aes
(
x
=
X1
,
y
=
X2
,
label
=
rownames
(
MDS_PC
)))
+
geom_point
(
size
=
4
)
+
geom_text
(
hjust
=
0.5
,
vjust
=
-0.5
)
+
theme_bw
()
+
xlab
(
label
=
"Dimension 1"
)
+
ylab
(
label
=
"Dimension 2"
)
+
ggtitle
(
"PCA plot on raw pseudo-counts"
)
ggsave
(
filename
=
normalizePath
(
file.path
(
opt
$
out
,
"rawcount_MDS.svg"
),
mustWork
=
FALSE
),
width
=
11
,
height
=
7
)
if
(
ncol
(
PC_before
)
>
2
){
MDS_PC
<-
data.frame
(
plotMDS
(
PC_before_log
)
$
cmdscale.out
)
ggplot
(
MDS_PC
,
aes
(
x
=
X1
,
y
=
X2
,
label
=
rownames
(
MDS_PC
)))
+
geom_point
(
size
=
4
)
+
geom_text
(
hjust
=
0.5
,
vjust
=
-0.5
)
+
theme_bw
()
+
xlab
(
label
=
"Dimension 1"
)
+
ylab
(
label
=
"Dimension 2"
)
+
ggtitle
(
"PCA plot on raw pseudo-counts"
)
ggsave
(
filename
=
normalizePath
(
file.path
(
opt
$
out
,
"rawcount_MDS.svg"
),
mustWork
=
FALSE
),
width
=
11
,
height
=
7
)
}
## density
ggplot
(
PC_before_log_long
,
aes
(
x
=
log2CPM
,
colour
=
lib
))
+
geom_density
()
+
...
...
@@ -124,9 +126,12 @@ write.table(PC_before_log_long, file = normalizePath(file.path(opt$out,
"raw_boxplot_density.csv"
),
mustWork
=
FALSE
),
sep
=
"\t"
,
row.names
=
TRUE
,
quote
=
FALSE
)
write.table
(
MDS_PC
,
file
=
normalizePath
(
file.path
(
opt
$
out
,
"raw_MDS.csv"
),
if
(
ncol
(
PC_before
)
>
2
){
write.table
(
MDS_PC
,
file
=
normalizePath
(
file.path
(
opt
$
out
,
"raw_MDS.csv"
),
mustWork
=
FALSE
),
sep
=
"\t"
,
row.names
=
TRUE
,
quote
=
FALSE
)
}
#######################################
...
...
@@ -209,10 +214,12 @@ normalization <- function(dge, method) {
paste0
(
method
,
"_boxplot_density.csv"
)),
mustWork
=
FALSE
),
sep
=
"\t"
,
row.names
=
TRUE
,
quote
=
FALSE
)
write.table
(
MDS_PC
,
file
=
normalizePath
(
file.path
(
opt
$
out
,
if
(
ncol
(
PC_before
)
>
2
){
write.table
(
MDS_PC
,
file
=
normalizePath
(
file.path
(
opt
$
out
,
paste0
(
method
,
"_MDS.csv"
)),
mustWork
=
FALSE
),
sep
=
"\t"
,
row.names
=
TRUE
,
quote
=
FALSE
)
}
}
normalization
(
dge
,
"upperquartile"
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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