forked from shendurelab/LACHESIS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQuickDotplot.POA.R
executable file
·69 lines (49 loc) · 2.91 KB
/
QuickDotplot.POA.R
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
64
65
66
67
68
#!/net/gs/vol3/software/modules-sw/R/2.15.1/Linux/RHEL6/x86_64/bin/Rscript
# The above "shebang" allows this file to be self-executing
///////////////////////////////////////////////////////////////////////////////
// //
// This software and its documentation are copyright (c) 2014-2015 by Joshua //
// N. Burton and the University of Washington. All rights are reserved. //
// //
// THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS //
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF //
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. //
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY //
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT //
// OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR //
// THE USE OR OTHER DEALINGS IN THE SOFTWARE. //
// //
///////////////////////////////////////////////////////////////////////////////
# QuickDotplot.POA.R
#
# The "POA" stands for "PlotOrderAccuracy" and refers to the evaluation function Reporter::PlotOrderAccuracy().
#
# This R script was generated by the Perl command QuickDotplot, at
# Wed Apr 17 10:45:25 2013
# Specifically, the command was:
# < directory=/net/gs/vol2/home/jnburton/vol10/src/HiC >
# QuickDotplot reporter
library( ggplot2, quietly=TRUE ) # ggplot
dotplot.file <- 'QuickDotplot.POA.txt'
jpeg.file <- '~/public_html/POA.jpg'
# Read the dotplot file.
dotplot <- read.table( dotplot.file, header=FALSE )
# Re-order the error types so that the color mapping is consistent between dotplots.
# The error names are defined in Reporter::PlotOrderAccuracy().
err_colors <- c( "awesome", "err_orient", "err_order", "err_order_orient", "err_interchrom", "err_interchrom_orient", "err_interchrom_order", "err_interchrom_order_orient" )
dotplot$colors <- factor( dotplot[,3], levels = err_colors )
dot.size <- ceiling( 50 / sqrt( dim(dotplot)[1] ) )
# Load the data into a ggplot object.
p <- ggplot( dotplot, aes( x=V1, y=V2 ) )
p <- p + theme_bw()
# Plot the points, and load in the colors, if any were given.
p <- p + geom_point( size = dot.size, aes( col=colors ) )
if ( dim( table( dotplot[,3] ) ) <= 10 ) {
p <- p + scale_colour_manual(values=c('gray75','gold2','#5555FF','#338800','red2','darkorange4','purple','black')) # color map; matches the factor above
}
# Assign text labels.
p <- p + ggtitle( "QuickDotplot showing errors in contig ordering" )
p <- p + xlab("")
p <- p + ylab("")
# Save the plot to the jpeg file. Adjust the width to make room for a legend, if there is one.
suppressWarnings( ggsave( filename=jpeg.file, plot=p, width=20, height=20 ) )