annotate scripts/contamination_plot.R @ 2:5ade5cf200da draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
author iuc
date Wed, 12 Jun 2019 04:58:19 -0400
parents 253c9448f524
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
582b7bd4ae4c planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 6f73edc667e61fabdab8b24a7ff40942588fee5b
iuc
parents:
diff changeset
1 #!/usr/bin/env R
582b7bd4ae4c planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 6f73edc667e61fabdab8b24a7ff40942588fee5b
iuc
parents:
diff changeset
2
1
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
3 suppressPackageStartupMessages(require(ggplot2))
0
582b7bd4ae4c planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 6f73edc667e61fabdab8b24a7ff40942588fee5b
iuc
parents:
diff changeset
4
1
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
5 log10histoPlot <- function(title="", columncounts){
0
582b7bd4ae4c planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 6f73edc667e61fabdab8b24a7ff40942588fee5b
iuc
parents:
diff changeset
6 #' Log10 histogram plot
582b7bd4ae4c planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 6f73edc667e61fabdab8b24a7ff40942588fee5b
iuc
parents:
diff changeset
7 #'
582b7bd4ae4c planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 6f73edc667e61fabdab8b24a7ff40942588fee5b
iuc
parents:
diff changeset
8 #' @param columncounts colSums(input_matrix)
582b7bd4ae4c planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 6f73edc667e61fabdab8b24a7ff40942588fee5b
iuc
parents:
diff changeset
9 #' @param title Title of plot
582b7bd4ae4c planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 6f73edc667e61fabdab8b24a7ff40942588fee5b
iuc
parents:
diff changeset
10 #' @return ggplot grob
582b7bd4ae4c planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 6f73edc667e61fabdab8b24a7ff40942588fee5b
iuc
parents:
diff changeset
11 dfer <- data.frame(colcounts=log10(columncounts))
582b7bd4ae4c planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 6f73edc667e61fabdab8b24a7ff40942588fee5b
iuc
parents:
diff changeset
12 p1 <- ggplot(dfer, aes(x=colcounts)) +
582b7bd4ae4c planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 6f73edc667e61fabdab8b24a7ff40942588fee5b
iuc
parents:
diff changeset
13 geom_histogram(binwidth = 0.05, color="black",fill="white") +
582b7bd4ae4c planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 6f73edc667e61fabdab8b24a7ff40942588fee5b
iuc
parents:
diff changeset
14 theme(plot.title = element_text(hjust = 0.5)) +
582b7bd4ae4c planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 6f73edc667e61fabdab8b24a7ff40942588fee5b
iuc
parents:
diff changeset
15 labs(title=title, y="Frequency", x="Library Size (Log10)")
582b7bd4ae4c planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 6f73edc667e61fabdab8b24a7ff40942588fee5b
iuc
parents:
diff changeset
16
582b7bd4ae4c planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 6f73edc667e61fabdab8b24a7ff40942588fee5b
iuc
parents:
diff changeset
17 return(p1)
582b7bd4ae4c planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 6f73edc667e61fabdab8b24a7ff40942588fee5b
iuc
parents:
diff changeset
18 }
582b7bd4ae4c planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 6f73edc667e61fabdab8b24a7ff40942588fee5b
iuc
parents:
diff changeset
19
1
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
20 ## This is calculated by the first call to contaminationPlot
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
21 ## and then re-used by the second call.
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
22 ylim.max = NULL
0
582b7bd4ae4c planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 6f73edc667e61fabdab8b24a7ff40942588fee5b
iuc
parents:
diff changeset
23
1
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
24 contaminationPlot <- function(title, columndata, barcode.data, plate.data, RAW)
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
25 {
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
26 coldata = data.frame(colsums=columndata)
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
27 maxval = max(coldata)
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
28 # Set once and once only
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
29 if (is.null(ylim.max)){
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
30 ylim.max <<- maxval + 500
0
582b7bd4ae4c planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 6f73edc667e61fabdab8b24a7ff40942588fee5b
iuc
parents:
diff changeset
31 }
582b7bd4ae4c planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 6f73edc667e61fabdab8b24a7ff40942588fee5b
iuc
parents:
diff changeset
32
1
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
33 drawPlates <- function(plate.data){ # 0 384 768
0
582b7bd4ae4c planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 6f73edc667e61fabdab8b24a7ff40942588fee5b
iuc
parents:
diff changeset
34
1
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
35 plate.boundaries <- plate.data["filtered.plates",]
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
36 if (RAW){
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
37 plate.boundaries <- plate.data["unfilter.plates",]
0
582b7bd4ae4c planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 6f73edc667e61fabdab8b24a7ff40942588fee5b
iuc
parents:
diff changeset
38 }
582b7bd4ae4c planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 6f73edc667e61fabdab8b24a7ff40942588fee5b
iuc
parents:
diff changeset
39
1
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
40 plate.minyval <- -200
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
41 plate.color <- "grey"
2
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
42 plate.size <- 2
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
43 plate.text.color <- "#7a0909"
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
44 plate.text.alpha <- 1
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
45 plate.text.height <- -200
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
46 plate.height <- 4 * maxval / 5
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
47 plate.spacing <- 35
1
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
48 plate.height.text <- plate.height - 3000
2
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
49 plate.text.size <- 3.5
1
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
50
2
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
51 ## Connecting bar underneath
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
52 gplot <<- gplot + geom_segment(aes(x=min(unname(unlist(plate.boundaries))), xend=max(unname(unlist(plate.boundaries))),
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
53 y=plate.minyval, yend=plate.minyval), color=plate.color, lty=1, size=plate.size,
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
54 linejoin="round", lineend="round")
1
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
55
2
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
56 ## Overlay text
1
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
57 zzz <- lapply(names(plate.boundaries), function(plate.name){
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
58 plate.num = as.integer(sub("P","",plate.name))
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
59 plate.xval = plate.boundaries[[plate.name]]
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
60
2
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
61 ## ## If not first plate -- inner boundary, print next plate name to the right
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
62 ## if (plate.name != names(plate.boundaries)[length(plate.boundaries)]){
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
63 ## gplot <<- gplot + annotate("text", x=plate.xval + plate.spacing, label=paste("Plate", plate.num + 1),
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
64 ## size=plate.text.size, y=plate.height*0.7, angle=-90,
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
65 ## color=plate.text.color, alpha=plate.text.alpha)
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
66 ## }
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
67 ## ## If not last plate -- inner boundary, print previous name to the left
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
68 ## if (plate.name != names(plate.boundaries)[1]){
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
69 ## gplot <<- gplot + annotate("text", x=plate.xval - plate.spacing, label=paste("Plate", plate.num),
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
70 ## size=plate.text.size, y=plate.height*0.7, angle=90,
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
71 ## color=plate.text.color, alpha=plate.text.alpha)
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
72 ## }
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
73
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
74 gplot <<- gplot + geom_segment(aes(x=plate.xval, xend=plate.xval, y=plate.minyval, yend=plate.height), color=plate.color, lty=1, size=plate.size)
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
75
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
76 if (plate.num > 0){
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
77 ## Print under, between plates
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
78 prev.plate.name <- paste("P", plate.num - 1, sep="")
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
79 prev.plate.xval <- plate.boundaries[[prev.plate.name]]
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
80 p.xval = as.integer((plate.xval + prev.plate.xval)/2)
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
81
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
82 gplot <<- gplot + annotate("text", x=p.xval, label=paste("Plate", plate.num),
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
83 size=plate.text.size, y=plate.text.height-200,
1
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
84 color=plate.text.color, alpha=plate.text.alpha)
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
85 }
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
86 })
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
87
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
88 }
0
582b7bd4ae4c planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 6f73edc667e61fabdab8b24a7ff40942588fee5b
iuc
parents:
diff changeset
89
582b7bd4ae4c planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 6f73edc667e61fabdab8b24a7ff40942588fee5b
iuc
parents:
diff changeset
90
1
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
91 drawBatches <- function(barcode.data, plate.data){
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
92 batch.minyval = -200
2
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
93 divide.color <- "red"
1
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
94 divide.style <- 2 ## dashed
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
95 divide.size <- 0.3
2
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
96 divide.text.size <- 2
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
97 divide.height <- (maxval * 7/8) - 500
1
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
98 boundary.color <- "blue"
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
99 boundary.style <- 1
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
100 boundary.size <- 0.5
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
101 divide.text.true.color <- "blue"
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
102 divide.text.false.color <- "black"
2
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
103 divide.text.name.color <- "#7a0909"
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
104 batch.text.tf.height <- divide.height * 7/8
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
105 batch.text.tf.spacing <- 20
1
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
106 batch.text.alpha <- 0.8
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
107 batch.text.size <- 3
2
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
108 batch.label.text.size <- 4
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
109 batch.height <- maxval
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
110 batch.text.height <- maxval * 7/8
1
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
111 batch.spacing <- 24
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
112
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
113 boundary.pos <- barcode.data["filtered_positions",]
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
114 plate.pos <- unname(unlist(plate.data["filtered.plates",])) ## just want values
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
115
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
116 if (RAW){
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
117 boundary.pos <- barcode.data["unfilter_positions",]
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
118 divider.pos <- barcode.data["filter_in_unfilter",]
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
119 plate.pos <- unname(unlist(plate.data["unfilter.plates",])) ## just want values
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
120 }
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
121
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
122
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
123 zzz <- lapply(names(boundary.pos), function(batch.name){
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
124 batch.num = as.integer(sub("B","",batch.name))
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
125 batch.xval = unname(unlist(boundary.pos[[batch.name]]))
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
126
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
127 # Plot boundary line only if not intersecting with a plate line
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
128 if (!(batch.xval %in% plate.pos)){
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
129 gplot <<- gplot + geom_segment(aes(x=batch.xval, xend=batch.xval, y=batch.minyval, yend=batch.height),
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
130 color=boundary.color, lty=boundary.style, size=boundary.size)
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
131 }
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
132
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
133 ## Plot labels (except P0)
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
134 if (batch.name != "B0"){
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
135 if (RAW){
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
136 divide.xval = unname(unlist(divider.pos[[batch.name]]))
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
137
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
138 ## Plot the divider line
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
139 gplot <<- gplot + geom_segment(aes(x=divide.xval, xend=divide.xval, y=batch.minyval, yend=divide.height),
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
140 color=divide.color, lty=divide.style, size=divide.size)
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
141
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
142 ## Plot the True/False labels
2
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
143 gplot <<- gplot + annotate("text", x=divide.xval - batch.text.tf.spacing, label="False positives",
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
144 size=divide.text.size, y=batch.text.tf.height, angle=+90,
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
145 color=divide.text.false.color, alpha=batch.text.alpha)
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
146 gplot <<- gplot + annotate("text", x=divide.xval + batch.text.tf.spacing, label="True positives",
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
147 size=divide.text.size, y=batch.text.tf.height, angle=-90,
1
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
148 color=divide.text.true.color, alpha=batch.text.alpha)
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
149 ## Plot the Batch names
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
150 gplot <<- gplot + annotate("text", x=divide.xval, label=batch.name,
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
151 size=batch.label.text.size, y=batch.text.height, angle=0,
2
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
152 color=divide.text.name.color, alpha=batch.text.alpha)
1
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
153 } else {
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
154 ## Plot the Batch names between blue lines
2
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
155 ##
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
156 ## We calculate this by taking the middle between current batch blue lines
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
157 ## and previous blue line
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
158 prev.batch.name = paste("B", batch.num - 1, sep="")
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
159 prev.batch.xval = unname(unlist(boundary.pos[[prev.batch.name]]))
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
160
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
161 b.xval <- as.integer((batch.xval + prev.batch.xval)/2)
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
162
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
163 gplot <<- gplot + annotate("text", x=b.xval, label=batch.name,
1
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
164 size=batch.label.text.size, y=batch.text.height, angle=0,
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
165 color = divide.text.name.color, alpha=batch.text.alpha)
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
166 }
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
167 }
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
168 })
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
169 }
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
170
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
171
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
172 plotCells <- function(coldata){
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
173 gplot <<- gplot + geom_point(data=coldata, aes(x=1:nrow(coldata), y=coldata$colsums), pch = 16, cex = 1)
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
174 }
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
175
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
176 plotTheme <- function(){
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
177 gplot <<- gplot + theme(plot.title = element_text(hjust = 0.5),
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
178 axis.ticks.x=element_blank(), axis.ticks.y=element_blank(),
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
179 axis.text.x=element_blank()) +
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
180 labs(title=paste("Contamination Plot\n", title), y="Library Size", x="Barcode Index") +
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
181 coord_cartesian(ylim = c(-200, ylim.max)) +
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
182 scale_x_continuous(breaks=NULL)
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
183 }
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
184
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
185
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
186 gplot <- ggplot()
2
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
187 plotCells(coldata)
1
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
188 drawBatches(barcode.data, plate.data)
2
5ade5cf200da planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
iuc
parents: 1
diff changeset
189 drawPlates(plate.data)
1
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
190 plotTheme()
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
191
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
192 return(gplot)
253c9448f524 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit f967afe562781e5c8ed4e24e9d1e0bc3ebb29401
iuc
parents: 0
diff changeset
193 }