File: plotHaplotypes.R

package info (click to toggle)
libvcflib 1.0.12%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 70,520 kB
  • sloc: cpp: 39,837; python: 532; perl: 474; ansic: 317; ruby: 295; sh: 254; lisp: 148; makefile: 123; javascript: 94
file content (29 lines) | stat: -rwxr-xr-x 664 bytes parent folder | download | duplicates (3)
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
# plot results
#
#usage:  nohup R --vanilla < plotPfst --args plotHapOutput.txt

cmd_args <- commandArgs(trailingOnly = TRUE)


imageHap<-function(x){

	pngName<-paste(c(x, format(Sys.time(), "%a%b%d_%H_%M_%S.pdf")), collapse="_")

	dat<-read.table( x[1], header=FALSE )
	pos<-dat[,1]
	dat<-dat[,2:length(dat)]
	print(head(dat))
	hd<-dist(t(dat), method="binary")
	or<-hclust(hd)
	or$labels<-1:length(dat)
	print(or$labels)
	
	pdf(pngName, width=9, height=8)
	par(mfrow=c(2,1))
	image(1-as.matrix(dat[,or$order]), yaxt="n", xaxt="n", ylab="Haplotypes", xlab="SNP", cex.lab=1.1)
	plot(or, main="", cex=1.1, lwd=2, sub="", xlab="")
	dev.off()

}

imageHap(cmd_args)