-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshiny_light_transcriptomes_functions.r
More file actions
63 lines (51 loc) · 1.9 KB
/
Copy pathshiny_light_transcriptomes_functions.r
File metadata and controls
63 lines (51 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
require(magicaxis)
ssp_plot_lines <<- function(matn, metad, reg=1, gene,
plot_far_red=FALSE,
plot_pdf=FALSE,
plot_png=FALSE,
time_factors_d = c(1,4,5,3,6,2),
time_factors_nd = c(3,4,2,5,1),
plot_interactive=TRUE,
plot_filename = NULL,
basedir = "/groups/dolan/lab/members/Zohar/figures/",
myDate = substr(Sys.time(),1,10)) {
metad_levels = sort(as.numeric(names(table(metad$time))))
metad$time = factor(metad$time,levels = metad_levels)
e_d = matn[gene,grepl("^Dark_",colnames(matn))][time_factors_d]
e_w = matn[gene,grepl("^White_",colnames(matn))][time_factors_nd]
e_r = matn[gene,grepl("^Red_",colnames(matn))][time_factors_nd]
e_b = matn[gene,grepl("^Blue_",colnames(matn))][time_factors_nd]
if (plot_far_red) {
e_fr = matn[gene,grepl("^FarRed_",colnames(matn))][time_factors_nd] }
if (plot_far_red) {
y_range = c(0,max(c(e_d,e_w,e_r,e_b,e_fr),na.rm=TRUE))
} else {
y_range = c(0,max(c(e_d,e_w,e_r,e_b),na.rm=TRUE))
}
if (plot_pdf & !is.null(plot_filename)) {
pdf(plot_filename,
width=800/100,height=300/100)
} else if (plot_png & !is.null(plot_filename)) {
png(plot_filename,
width=800,height=300,
res=100)} else if (plot_interactive) {
par(mar=c(5,5,1,1),mgp=c(3,0.8,0), bty="L")
plot(e_d, lwd=3,type="b",pch=19,cex=1.5,col="black",
cex.axis=1.5,cex.lab=1.5,
ylim = y_range,
xaxt="n",
yaxt="n",
ylab = gene,
xlab = "Time (minutes)"
)
magaxis(2,cex=1.5,las=2,cex.axis=1.5,tcl=(-0.5))
axis(1,at=1:length(metad_levels),labels=metad_levels,cex.axis=1.5)
lines(2:length(metad_levels),e_w,lwd=3,type="b",pch=19,cex=1.5,col="navajowhite2")
lines(2:length(metad_levels),e_r,lwd=3,type="b",pch=19,cex=1.5,col="red")
lines(2:length(metad_levels),e_b,lwd=3,type="b",pch=19,cex=1.5,col="blue")
if (plot_far_red) {
lines(2:length(metad_levels),e_fr,lwd=3,type="b",pch=19,cex=1.5,col="red3")
}
}
if ((plot_pdf | plot_png)) { dev.off() }
}