prest <- function(f1) { # Written by Daniel E. Weeks (weeks@pitt.edu) # # Purpose: To draw out the relationship triangles for a prest_out2 file. # Title will be the p0, p1, and p2 sharing # Subtitle will be the ped, per1, per2, relationship, number of markers, and EIBD p-value. # Input: # a 'prest_out2' output file generated by the PREST program. # Usage: # > source("prest.r") # > postscript(paper="letter",horizontal=F) # > prest("prest_out2") # > dev.off() # a <- read.table(f1,header=F); alength <- dim(a)[2]; if (alength == 16) { names(a) <- c("ped","per1","per2","rel","num","eibd","p0","p1","p2","pval1","pval2","pval3","pv1","pv2","pv3","pv4"); } else { names(a) <- c("ped","per1","per2","rel","num","eibd","p0","p1","p2","pval1","pval2","pval3"); } attach(a); # This sets up a 5 rows x 3 columns grid of graphs per page. par(mfcol=c(5,3)); for (i in 1:length(ped)) tri(p0[i],p1[i],ped[i],per1[i],per2[i],rel[i],num[i],pval1[i],p2[i]); } tri <- function(z0,z1,ped,per1,per2,rel,num,pval1,p2) # R code for drawing the relationship triange of # Elizabeth Thompson { z2 <- 1.0 - z0 - z1; x <- c(0.0000,0.5774,1.1547,0.0000) y <- c(0.0,1.0,0.0,0.0) plot(x,y,type="l",xlab="",ylab="") x2 <- (z0/1.7321 + z1/0.8660) y2 <- z0 points(x2,y2) t <- paste(z0,z1,p2); s <- paste(ped,per1,per2,rel,num,pval1); # Place a cross at the full sib position. title(t,sub=s); s1 <- 0.7217007; s2 <- 0.25; points(s1,s2,pch=3); # Place a cross at the half sib position. s1 <- 0.8660341; s2 <- 0.5; points(s1,s2,pch=3); text(s1+0.12,s2,"HS"); # text(0.5873339,1.015,"U"); list(z0 = z0, z1 = z1, z2 = 1.0 - z0 -z1, x = x2, y = y2); }