###number of reads per sample (figS3) barnames<-c('pstI','EcoRI','MS1.1 10 cyc.','MS1.2 10 cyc.','MS2.1 10 cyc.','MS2.2 10 cyc.','MS1.1 20 cyc.','MS1.2 20 cyc.' ,'MS2.1 20 cyc.','MS2.2 20 cyc.','MS1.1 30 cyc.','MS1.2 30 cyc.','MS2.1 30 cyc.','MS3.2 30 cyc.','MS1.1 40 cyc.','MS1.2 40 cyc.' ,'MS2.1 40 cyc.','MS2.2 40 cyc.') barnames<-c('pstI','EcoRI','C1.1 10 cyc.','C1.2 10 cyc.','C2.1 10 cyc.','C2.2 10 cyc.','C1.1 20 cyc.','C1.2 20 cyc.' ,'C2.1 20 cyc.','C2.2 20 cyc.','C1.1 30 cyc.','C1.2 30 cyc.','C2.1 30 cyc.','C2.2 30 cyc.','C1.1 40 cyc.','C1.2 40 cyc.' ,'C2.1 40 cyc.','C2.2 40 cyc.') readnrs<-unlist(lapply(gogo,length)) reads_sorted<-readnrs[c(1,2,3,5,4,6,7,9,8,10,11,13,12,14,15,17,16,18)] par(las=2) barplot(reads_sorted,names.arg=barnames,cex.names=.7,ylab='Nr. reads',cex.axis=.8) ################################################ ###summarize densities ###30x2 rp1<-ret.perc(ecoRI_2x30_l,lms=2) rp2<-ret.perc(c10_241_2x30_l,c10_242_2x30_l,lms=2) rp4<-ret.perc(c20_241_2x30_l,c20_242_2x30_l,lms=2) rp6<-ret.perc(c30_241_2x30_l,c30_242_2x30_l,lms=2) rp8<-ret.perc(c40_241_2x30_l,c40_242_2x30_l,lms=2) ###20x4 rp1.2<-ret.perc(pstI_4x20_l,lms=4) rp2.2<-ret.perc(c10_131_4x20_l,c10_132_4x20_l,lms=4) rp4.2<-ret.perc(c20_131_4x20_l,c20_132_4x20_l,lms=4) rp6.2<-ret.perc(c30_131_4x20_l,c30_132_4x20_l,lms=4) rp8.2<-ret.perc(c40_131_4x20_l,c40_132_4x20_l,lms=4) ###10x4 rp1.3<-ret.perc(pstI_4x10_l,ecoRI_4x10_l,lms=4) rp2.3<-ret.perc(c10_131_4x10_l,c10_132_4x10_l,c10_241_4x10_l,c10_242_4x10_l,lms=4) rp4.3<-ret.perc(c20_131_4x10_l,c20_132_4x10_l,c20_241_4x10_l,c20_242_4x10_l,lms=4) rp6.3<-ret.perc(c30_131_4x10_l,c30_132_4x10_l,c30_241_4x10_l,c30_242_4x10_l,lms=4) rp8.3<-ret.perc(c40_131_4x10_l,c40_132_4x10_l,c40_241_4x10_l,c40_242_4x10_l,lms=4) ###Panel plot (Fig 1) windows(8,4) layout(matrix(c(1,1,1,2,3,4),ncol=3,byrow=T),heights=c(1,5,5,5)) layout.show(4) par(mar=c(0,0,0,0)) plot(1:10,1:10,type='n',xlab='',ylab='',axes=F) legend(2.5,8,legend=c('No PCR','10 cycles','20 cycles','30 cycles','40 cycles'),bg=colors()[250],ncol=5,pch=16,pt.cex=2,col=1:5,cex=1.5) par(mar=c(4,4,1,1)) plot(rp1[1,],rp1[2,],xlim=c(38,70),pch=16,axes=F,type='n',xlab='Microsatellite length',ylab='Proportion of reads') axis(2) axis(1,at=seq(38,70,by=2)) abline(v=seq(38,70,by=4),lty=3,col=colors()[152]) abline(h=c(0,.1,.2,.3,.4,.5),lty=3,col=colors()[152]) abline(v=60,lty=2,col=1) points(rp1[1,],rp1[2,],pch=16) points(rp2[1,],rp2[2,],pch=16,col=2) points(rp4[1,],rp4[2,],pch=16,col=3) points(rp6[1,],rp6[2,],pch=16,col=4) points(rp8[1,],rp8[2,],pch=16,col=5) text(40,.55,'A',font=2,cex=1.5) plot(rp1.2[1,],rp1.2[2,],xlim=c(50,100),pch=16,axes=F,type='n',xlab='Microsatellite length',ylab='Proportion of reads') axis(2) axis(1,at=seq(52,100,by=4)) abline(v=seq(52,100,by=8),lty=3,col=colors()[152]) abline(h=c(0,.2,.4,.6,.8),lty=3,col=colors()[152]) abline(v=80,lty=2,col=1) points(rp1.2[1,],rp1.2[2,],pch=16,cex=1) points(rp2.2[1,],rp2.2[2,],pch=16,col=2,cex=1) points(rp4.2[1,],rp4.2[2,],pch=16,col=3,cex=1) points(rp6.2[1,],rp6.2[2,],pch=16,col=4,cex=1) points(rp8.2[1,],rp8.2[2,],pch=16,col=5,cex=1) text(54,.89,'B',font=2,cex=1.5) plot(rp1.3[1,],rp1.3[2,],xlim=c(24,52),pch=16,axes=F,type='n',xlab='Microsatellite length',ylab='Proportion of reads') axis(2) axis(1,at=seq(24,52,by=4)) abline(v=seq(24,52,by=8),lty=3,col=colors()[152]) abline(h=c(0,.2,.4,.6,.8,1),lty=3,col=colors()[152]) abline(v=40,lty=2,col=1) points(rp1.3[1,],rp1.3[2,],pch=16,cex=1) points(rp2.3[1,],rp2.3[2,],pch=16,col=2,cex=1) points(rp4.3[1,],rp4.3[2,],pch=16,col=3,cex=1) points(rp6.3[1,],rp6.3[2,],pch=16,col=4,cex=1) points(rp8.3[1,],rp8.3[2,],pch=16,col=5,cex=1) text(26,.99,'C',font=2,cex=1.5) ########################################################## ###summarize counts ###no pcr controls np1<-table(c(pstI_4x10_l,ecoRI_4x10_l))/2 np1<-np1[np1>1] np2<-table(pstI_4x20_l) np2<-np2[np2>1] np3<-table(ecoRI_2x30_l) np3<-np3[np3>1] ###figure 2 windows(7,3) par(mfrow=c(1,3)) par(cex.axis=1) par(las=1) par(mar=c(3,3,3,1)) plot(names(np3),np3,type='h',lwd=3,axes=F,main='A') axis(2);axis(1,at=find.tix(np3,target=60)) plot(names(np2),np2,type='h',lwd=3,axes=F,main='B') axis(2);axis(1,at=find.tix(np2,target=80)) plot(names(np1),np1,type='h',lwd=3,axes=F,main='C') axis(2);axis(1,at=find.tix(np1,target=40)) ###PCR treated e1<-table(c(c10_241_2x30_l,c10_242_2x30_l))/2 e1<-e1[e1>1] e2<-table(c(c10_131_4x20_l,c10_132_4x20_l))/2 e2<-e2[e2>1] e3<-table(c(c10_131_4x10_l,c10_132_4x10_l,c10_241_4x10_l,c10_242_4x10_l))/4 e3<-e3[e3>1] e4<-table(c(c20_241_2x30_l,c20_242_2x30_l))/2 e4<-e4[e4>1] e5<-table(c(c20_131_4x20_l,c20_132_4x20_l))/2 e5<-e5[e5>1] e6<-table(c(c20_131_4x10_l,c20_132_4x10_l,c20_241_4x10_l,c20_242_4x10_l))/4 e6<-e6[e6>1] e7<-table(c(c30_241_2x30_l,c30_242_2x30_l))/2 e7<-e7[e7>1] e8<-table(c(c30_131_4x20_l,c30_132_4x20_l))/2 e8<-e8[e8>1] e9<-table(c(c30_131_4x10_l,c30_132_4x10_l,c30_241_4x10_l,c30_242_4x10_l))/4 e9<-e9[e9>1] e10<-table(c(c40_241_2x30_l,c40_242_2x30_l))/2 e10<-e10[e10>1] e11<-table(c(c40_131_4x20_l,c40_132_4x20_l))/2 e11<-e11[e11>1] e12<-table(c(c40_131_4x10_l,c40_132_4x10_l,c40_241_4x10_l,c40_242_4x10_l))/4 e12<-e12[e12>1] ###figure 3 par(mfrow=c(4,3)) par(cex.axis=1) par(las=0) par(mar=c(3,3,2,1)) plot(names(e1),e1,type='h',lwd=3,axes=F,main='A') axis(2);axis(1,at=find.tix(e1,int=4,target=60)) plot(names(e2),e2,type='h',lwd=3,axes=F,main='B') axis(2);axis(1,at=find.tix(e2,target=80)) plot(names(e3),e3,type='h',lwd=3,axes=F,main='C') axis(2);axis(1,at=find.tix(e3,target=40)) plot(names(e4),e4,type='h',lwd=3,axes=F,main='D') axis(2);axis(1,at=find.tix(e4,int=4,target=60)) plot(names(e5),e5,type='h',lwd=3,axes=F,main='E') axis(2);axis(1,at=find.tix(e5,int=4,target=80)) plot(names(e6),e6,type='h',lwd=3,axes=F,main='F') axis(2);axis(1,at=find.tix(e6,target=40)) plot(names(e7),e7,type='h',lwd=3,axes=F,main='G') axis(2);axis(1,at=find.tix(e7,int=4,target=60)) plot(names(e8),e8,type='h',lwd=3,axes=F,main='H') axis(2);axis(1,at=find.tix(e8,int=4,target=80)) plot(names(e9),e9,type='h',lwd=3,axes=F,main='I') axis(2);axis(1,at=find.tix(e9,target=40)) plot(names(e10),e10,type='h',lwd=3,axes=F,main='J') axis(2);axis(1,at=find.tix(e10,int=4,target=60)) plot(names(e11),e11,type='h',lwd=3,axes=F,main='K') axis(2);axis(1,at=find.tix(e11,int=4,target=80)) plot(names(e12),e12,type='h',lwd=3,axes=F,main='L') axis(2);axis(1,at=find.tix(e12,target=40)) ########################################################### ###absolute deviation from target length a1<-fix.var(pstI_4x20_l,80) a2m<-fix.var(c(c10_131_4x20_l,c10_132_4x20_l),80) a2<-fix.var(c10_131_4x20_l,80) a3<-fix.var(c10_132_4x20_l,80) a4m<-fix.var(c(c20_131_4x20_l,c20_132_4x20_l),80) a4<-fix.var(c20_131_4x20_l,80) a5<-fix.var(c20_132_4x20_l,80) a6m<-fix.var(c(c30_131_4x20_l,c30_132_4x20_l),80) a6<-fix.var(c30_131_4x20_l,80) a7<-fix.var(c30_132_4x20_l,80) a8m<-fix.var(c(c40_131_4x20_l,c40_132_4x20_l),80) a8<-fix.var(c40_131_4x20_l,80) a9<-fix.var(c40_132_4x20_l,80) facA<-c(rep('a',length(a1)),rep('b',length(a2m)),rep('c',length(a4m)),rep('d',length(a6m)),rep('e',length(a8m))) nA<-c(rep(0,length(a1)),rep(10,length(a2m)),rep(20,length(a4m)),rep(30,length(a6m)),rep(40,length(a8m))) A_ape<-c(a1,a2m,a4m,a6m,a8m) nA_jitter<-jitter(nA,factor=2)[A_ape<=32] A_ape<-A_ape[A_ape<=32] a_jitter<-jitter(A_ape,factor=1) wilcox.test(a1,a2m) wilcox.test(a1,a4m) wilcox.test(a1,a6m) wilcox.test(a1,a8m) ############### b1m<-fix.var(c(pstI_4x10_l,ecoRI_4x10_l),40) b1<-fix.var(pstI_4x10_l,40) b2<-fix.var(ecoRI_4x10_l,40) b3m<-fix.var(c(c10_131_4x10_l,c10_132_4x10_l,c10_241_4x10_l,c10_242_4x10_l),40) b3<-fix.var(c10_131_4x10_l,40) b4<-fix.var(c10_132_4x10_l,40) b5<-fix.var(c10_241_4x10_l,40) b6<-fix.var(c10_242_4x10_l,40) b7m<-fix.var(c(c20_131_4x10_l,c20_132_4x10_l,c20_241_4x10_l,c20_242_4x10_l),40) b7<-fix.var(c20_131_4x10_l,40) b8<-fix.var(c20_132_4x10_l,40) b9<-fix.var(c20_241_4x10_l,40) b10<-fix.var(c20_242_4x10_l,40) b11m<-fix.var(c(c30_131_4x10_l,c30_132_4x10_l,c30_241_4x10_l,c30_242_4x10_l),40) b11<-fix.var(c30_131_4x10_l,40) b12<-fix.var(c30_132_4x10_l,40) b13<-fix.var(c30_241_4x10_l,40) b14<-fix.var(c30_242_4x10_l,40) b15m<-fix.var(c(c40_131_4x10_l,c40_132_4x10_l,c40_241_4x10_l,c40_242_4x10_l),40) b15<-fix.var(c40_131_4x10_l,40) b16<-fix.var(c40_132_4x10_l,40) b17<-fix.var(c40_241_4x10_l,40) b18<-fix.var(c40_242_4x10_l,40) facB<-c(rep('a',length(b1m)),rep('b',length(b3m)),rep('c',length(b7m)),rep('d',length(b11m)),rep('e',length(b15m))) nB<-c(rep(0,length(b1m)),rep(10,length(b3m)),rep(20,length(b7m)),rep(30,length(b11m)),rep(40,length(b15m))) wilcox.test(b1m,b3m) wilcox.test(b1m,b7m) wilcox.test(b1m,b11m) wilcox.test(b1m,b15m) B_ape<-c(b1m,b3m,b7m,b11m,b15m) nB_jitter<-jitter(nB,factor=2)[B_ape<=16] B_ape<-B_ape[B_ape<=16] b_jitter<-jitter(B_ape,factor=1) ################## c1<-fix.var(ecoRI_2x30_l,60) c2m<-fix.var(c(c10_241_2x30_l,c10_242_2x30_l),60) c2<-fix.var(c10_241_2x30_l,60) c3<-fix.var(c10_242_2x30_l,60) c4m<-fix.var(c(c20_241_2x30_l,c20_242_2x30_l),60) c4<-fix.var(c20_241_2x30_l,60) c5<-fix.var(c20_242_2x30_l,60) c6m<-fix.var(c(c30_241_2x30_l,c30_242_2x30_l),60) c6<-fix.var(c30_241_2x30_l,60) c7<-fix.var(c30_242_2x30_l,60) c8m<-fix.var(c(c40_241_2x30_l,c40_242_2x30_l),60) c8<-fix.var(c40_241_2x30_l,60) c9<-fix.var(c40_242_2x30_l,60) facC<-c(rep('a',length(c1)),rep('b',length(c2)),rep('c',length(c4)),rep('d',length(c6)),rep('e',length(c8))) nC<-c(rep(0,length(c1)),rep(10,length(c2m)),rep(20,length(c4m)),rep(30,length(c6m)),rep(40,length(c8m))) nCm<-c(rep(0,length(c1)),rep(10,length(c2)),rep(10,length(c3)),rep(20,length(c4)),rep(20,length(c5)), rep(30,length(c6)),rep(30,length(c7)),rep(40,length(c8)),rep(40,length(c9))) wilcox.test(c1,c2m) wilcox.test(c1,c4m) wilcox.test(c1,c6m) wilcox.test(c1,c8m) C_ape<-c(c1,c2m,c4m,c6m,c8m) length(C_ape) nC_jitter<-jitter(nC,factor=2)[C_ape<=22] C_ape<-C_ape[C_ape<=22] c_jitter<-jitter(C_ape,factor=1) ###absolute error density plot (figS24) windows(10,5) par(mfrow=c(1,3)) par(mar=c(4,4,3,0.5)) plot(nC_jitter,c_jitter,pch=16,cex=.05,col=1,axes=F,xlab='# PCR cycles',ylab='Absolute error (bp)',main='A') box();axis(1) axis(2,at=seq(0,26,by=2)) lines(c(-4,4),c(mean(c1),mean(c1)),col=2,lwd=2) lines(c(6,14),c(mean(c2m),mean(c2m)),col=2,lwd=2) lines(c(16,24),c(mean(c4m),mean(c4m)),col=2,lwd=2) lines(c(26,34),c(mean(c6m),mean(c6m)),col=2,lwd=2) lines(c(36,44),c(mean(c8m),mean(c8m)),col=2,lwd=2) plot(nA_jitter,a_jitter,pch=16,cex=.05,col=1,axes=F,xlab='# PCR cycles',ylab='Absolute error (bp)',main='B') box();axis(1) axis(2,at=seq(0,32,by=4)) lines(c(-4,4),c(mean(a1),mean(a1)),col=2,lwd=2) lines(c(6,14),c(mean(a2m),mean(a2m)),col=2,lwd=2) lines(c(16,24),c(mean(a4m),mean(a4m)),col=2,lwd=2) lines(c(26,34),c(mean(a6m),mean(a6m)),col=2,lwd=2) lines(c(36,44),c(mean(a8m),mean(a8m)),col=2,lwd=2) plot(nB_jitter,b_jitter,pch=16,cex=.05,col=1,axes=F,xlab='# PCR cycles',ylab='Absolute error (bp)',main='C') box();axis(1) axis(2,at=seq(0,28,by=4)) lines(c(-4,4),c(mean(b1),mean(b1)),col=2,lwd=2) lines(c(6,14),c(mean(b3m),mean(b3m)),col=2,lwd=2) lines(c(16,24),c(mean(b7m),mean(b7m)),col=2,lwd=2) lines(c(26,34),c(mean(b11m),mean(b11m)),col=2,lwd=2) lines(c(36,44),c(mean(b15m),mean(b15m)),col=2,lwd=2) ########################################### ###shannon entropy sa1<-shannon(pstI_4x20_l) sa2<-shannon(c10_131_4x20_l) sa3<-shannon(c10_132_4x20_l) sa4<-shannon(c20_131_4x20_l) sa5<-shannon(c20_132_4x20_l) sa6<-shannon(c30_131_4x20_l) sa7<-shannon(c30_132_4x20_l) sa8<-shannon(c40_131_4x20_l) sa9<-shannon(c40_132_4x20_l) sb1<-shannon(pstI_4x10_l) sb2<-shannon(ecoRI_4x10_l) sb3<-shannon(c10_131_4x10_l) sb4<-shannon(c10_132_4x10_l) sb5<-shannon(c10_241_4x10_l) sb6<-shannon(c10_242_4x10_l) sb7<-shannon(c20_131_4x10_l) sb8<-shannon(c20_132_4x10_l) sb9<-shannon(c20_241_4x10_l) sb10<-shannon(c20_242_4x10_l) sb11<-shannon(c30_131_4x10_l) sb12<-shannon(c30_132_4x10_l) sb13<-shannon(c30_241_4x10_l) sb14<-shannon(c30_242_4x10_l) sb15<-shannon(c40_131_4x10_l) sb16<-shannon(c40_132_4x10_l) sb17<-shannon(c40_241_4x10_l) sb18<-shannon(c40_242_4x10_l) sc1<-shannon(ecoRI_2x30_l) sc2<-shannon(c10_241_2x30_l) sc3<-shannon(c10_242_2x30_l) sc4<-shannon(c20_241_2x30_l) sc5<-shannon(c20_242_2x30_l) sc6<-shannon(c30_241_2x30_l) sc7<-shannon(c30_242_2x30_l) sc8<-shannon(c40_241_2x30_l) sc9<-shannon(c40_242_2x30_l) s_distr_4x20<-c(sa1,sa2,sa3,sa4,sa5,sa6,sa7,sa8,sa9) cyc_4x20<-c(0,10,10,20,20,30,30,40,40) s_distr_4x10<-c(sb1,sb2,sb3,sb4,sb5,sb6,sb7,sb8,sb9,sb10,sb11,sb12,sb13,sb14,sb15,sb16,sb17,sb18) cyc_4x10<-c(0,0,rep(10,4),rep(20,4),rep(30,4),rep(40,4)) s_distr_2x30<-c(sc1,sc2,sc3,sc4,sc5,sc6,sc7,sc8,sc9) ###shannon vs pcr gams library(mgcv) gam1<-gam(s_distr_2x30~s(cyc_4x20,k=3)) summary(gam1) gam1.2<-gam(s_distr_2x30[-1]~s(cyc_4x20[-1],k=3)) summary(gam1.2) gam2<-gam(s_distr_4x20~s(cyc_4x20,k=3)) summary(gam2) gam2.2<-gam(s_distr_4x20[-1]~s(cyc_4x20[-1],k=3)) summary(gam2.2) gam3<-gam(s_distr_4x10~s(cyc_4x10,k=3)) summary(gam3) gam3.2<-gam(s_distr_4x10[-c(1,2)]~s(cyc_4x10[-c(1,2)],k=3)) summary(gam3.2) ###Shannon entropy gam plots (fig S26) windows(8,7) par(mfrow=c(2,3)) par(mar=c(4,4,3,0.5)) plot(gam1,residuals=T,pch=16,shade=T,ylab='Shannon entropy',xlab='Nr. PCR cycles',shift=mean(s_distr_2x30),main='A',cex=1.5) plot(gam2,residuals=T,pch=16,shade=T,ylab='Shannon entropy',xlab='Nr. PCR cycles',shift=mean(s_distr_4x20),main='B',cex=1.5) plot(gam3,residuals=T,pch=16,shade=T,ylab='Shannon entropy',xlab='Nr. PCR cycles',shift=mean(s_distr_4x10),main='C',cex=1.5) plot(gam1.2,residuals=T,pch=16,shade=T,ylab='Shannon entropy',xlab='Nr. PCR cycles',shift=mean(s_distr_2x30[-1]),main='D',cex=1.5) plot(gam2.2,residuals=T,pch=16,shade=T,ylab='Shannon entropy',xlab='Nr. PCR cycles',shift=mean(s_distr_4x20[-1]),main='E',cex=1.5) plot(gam3.2,residuals=T,pch=16,shade=T,ylab='Shannon entropy',xlab='Nr. PCR cycles',shift=mean(s_distr_4x10[-c(1,2)]),main='F',cex=1.5) ####################################################### ###percent correct allele size pa1<-pct.corr(pstI_4x20_l,80) pa2<-pct.corr(c10_131_4x20_l,80) pa3<-pct.corr(c10_132_4x20_l,80) pa4<-pct.corr(c20_131_4x20_l,80) pa5<-pct.corr(c20_132_4x20_l,80) pa6<-pct.corr(c30_131_4x20_l,80) pa7<-pct.corr(c30_132_4x20_l,80) pa8<-pct.corr(c40_131_4x20_l,80) pa9<-pct.corr(c40_132_4x20_l,80) p80<-c(pa1,pa2,pa3,pa4,pa5,pa6,pa7,pa8,pa9) pb1<-pct.corr(pstI_4x10_l,40) pb2<-pct.corr(ecoRI_4x10_l,40) pb3<-pct.corr(c10_131_4x10_l,40) pb4<-pct.corr(c10_132_4x10_l,40) pb5<-pct.corr(c10_241_4x10_l,40) pb6<-pct.corr(c10_242_4x10_l,40) pb7<-pct.corr(c20_131_4x10_l,40) pb8<-pct.corr(c20_132_4x10_l,40) pb9<-pct.corr(c20_241_4x10_l,40) pb10<-pct.corr(c20_242_4x10_l,40) pb11<-pct.corr(c30_131_4x10_l,40) pb12<-pct.corr(c30_132_4x10_l,40) pb13<-pct.corr(c30_241_4x10_l,40) pb14<-pct.corr(c30_242_4x10_l,40) pb15<-pct.corr(c40_131_4x10_l,40) pb16<-pct.corr(c40_132_4x10_l,40) pb17<-pct.corr(c40_241_4x10_l,40) pb18<-pct.corr(c40_242_4x10_l,40) p40<-rbind(pb1,pb2,pb3,pb4,pb5,pb6,pb7,pb8,pb9,pb10,pb11,pb12,pb13,pb14,pb15,pb16,pb17,pb18) pc1<-pct.corr(ecoRI_2x30_l,60) pc2<-pct.corr(c10_241_2x30_l,60) pc3<-pct.corr(c10_242_2x30_l,60) pc4<-pct.corr(c20_241_2x30_l,60) pc5<-pct.corr(c20_242_2x30_l,60) pc6<-pct.corr(c30_241_2x30_l,60) pc7<-pct.corr(c30_242_2x30_l,60) pc8<-pct.corr(c40_241_2x30_l,60) pc9<-pct.corr(c40_242_2x30_l,60) p60<-rbind(pc1,pc2,pc3,pc4,pc5,pc6,pc7,pc8,pc9) pgam1<-gam(p80~s(cyc_4x20,k=3)) summary(pgam1) pgam2<-gam(p40~s(cyc_4x10,k=3)) summary(pgam2) pgam3<-gam(p60~s(cyc_4x20,k=3)) summary(pgam3) pgam1.2<-gam(p80[-1]~s(cyc_4x20[-1],k=3)) summary(pgam1.2) pgam2.2<-gam(p40[-c(1,2)]~s(cyc_4x10[-c(1,2)],k=3)) summary(pgam2.2) pgam3.2<-gam(p60[-1]~s(cyc_4x20[-1],k=3)) summary(pgam3.2) ###percent on target gam plots (Fig S25) windows(8,7) par(mfrow=c(2,3)) par(mar=c(4,4,3,0.5)) plot(pgam3,residuals=T,pch=16,shift=mean(p60),shade=T,cex=1.5,ylab='% target length',xlab='Nr. PCR cycles',main='A') plot(pgam1,residuals=T,pch=16,shift=mean(p80),shade=T,cex=1.5,ylab='% target length',xlab='Nr. PCR cycles',main='B') plot(pgam2,residuals=T,pch=16,shift=mean(p40),shade=T,cex=1.5,ylab='% target length',xlab='Nr. PCR cycles',main='C') plot(pgam3.2,residuals=T,pch=16,shift=mean(p60),shade=T,cex=1.5,ylab='% target length',xlab='Nr. PCR cycles',main='D') plot(pgam1.2,residuals=T,pch=16,shift=mean(p80),shade=T,cex=1.5,ylab='% target length',xlab='Nr. PCR cycles',main='E') plot(pgam2.2,residuals=T,pch=16,shift=mean(p40),shade=T,cex=1.5,ylab='% target length',xlab='Nr. PCR cycles',main='F') ############################################################### ###pct on target and shannon entropy (Fig 4) windows(8,5) par(mfrow=c(1,2)) par(mar=c(4,4,3,0.5)) plot(cyc_4x20,p80,pch=16,ylim=c(35,100),cex=1,ylab='% target length',xlab='# PCR cycles',main='A') points(cyc_4x10,p40,pch=16,col=2,cex=1) points(cyc_4x20,p60,pch=16,col=3,cex=1) abline(h=mean(p80),lty=2);abline(h=mean(p40),lty=2,col=2);abline(h=mean(p60),lty=2,col=3) legend(25,60,legend=c('30 x CA','20 x ATCT','10 x ATCT'),col=c(3,1,2),pch=16,pt.cex=1,cex=.8) plot(cyc_4x20,s_distr_4x20,pch=16,ylim=c(0,2),cex=1,ylab='Shannon entropy',xlab='# PCR cycles',main='B') points(cyc_4x10,s_distr_4x10,pch=16,col=2,cex=1) points(cyc_4x20,s_distr_2x30,pch=16,col=3,cex=1) abline(h=mean(s_distr_4x20),lty=2);abline(h=mean(s_distr_4x10),lty=2,col=2);abline(h=mean(s_distr_2x30),lty=2,col=3) legend(25,.3,legend=c('30 x CA','20 x ATCT','10 x ATCT'),col=c(3,1,2),pch=16,pt.cex=1,cex=.8) ############################################################### ###Single nucleotide slippage is more common forward than backward fa1<-fwd.slip(pstI_4x20_l,80) fa2<-fwd.slip(c10_131_4x20_l,80) fa3<-fwd.slip(c10_132_4x20_l,80) fa4<-fwd.slip(c20_131_4x20_l,80) fa5<-fwd.slip(c20_132_4x20_l,80) fa6<-fwd.slip(c30_131_4x20_l,80) fa7<-fwd.slip(c30_132_4x20_l,80) fa8<-fwd.slip(c40_131_4x20_l,80) fa9<-fwd.slip(c40_132_4x20_l,80) f80<-rbind(fa1,fa2,fa3,fa4,fa5,fa6,fa7,fa8,fa9) wilcox.test(f80[,1],f80[,2],paired=T) fb1<-fwd.slip(pstI_4x10_l,40) fb2<-fwd.slip(ecoRI_4x10_l,40) fb3<-fwd.slip(c10_131_4x10_l,40) fb4<-fwd.slip(c10_132_4x10_l,40) fb5<-fwd.slip(c10_241_4x10_l,40) fb6<-fwd.slip(c10_242_4x10_l,40) fb7<-fwd.slip(c20_131_4x10_l,40) fb8<-fwd.slip(c20_132_4x10_l,40) fb9<-fwd.slip(c20_241_4x10_l,40) fb10<-fwd.slip(c20_242_4x10_l,40) fb11<-fwd.slip(c30_131_4x10_l,40) fb12<-fwd.slip(c30_132_4x10_l,40) fb13<-fwd.slip(c30_241_4x10_l,40) fb14<-fwd.slip(c30_242_4x10_l,40) fb15<-fwd.slip(c40_131_4x10_l,40) fb16<-fwd.slip(c40_132_4x10_l,40) fb17<-fwd.slip(c40_241_4x10_l,40) fb18<-fwd.slip(c40_242_4x10_l,40) f40<-rbind(fb1,fb2,fb3,fb4,fb5,fb6,fb7,fb8,fb9,fb10,fb11,fb12,fb13,fb14,fb15,fb16,fb17,fb18) wilcox.test(f40[,1],f40[,2],paired=T) fc1<-fwd.slip(ecoRI_2x30_l,60) fc2<-fwd.slip(c10_241_2x30_l,60) fc3<-fwd.slip(c10_242_2x30_l,60) fc4<-fwd.slip(c20_241_2x30_l,60) fc5<-fwd.slip(c20_242_2x30_l,60) fc6<-fwd.slip(c30_241_2x30_l,60) fc7<-fwd.slip(c30_242_2x30_l,60) fc8<-fwd.slip(c40_241_2x30_l,60) fc9<-fwd.slip(c40_242_2x30_l,60) f60<-rbind(fc1,fc2,fc3,fc4,fc5,fc6,fc7,fc8,fc9) wilcox.test(f60[,1],f60[,2],paired=T) ###single nc slippage (figS29) fs<-c(c(f60),c(f80),c(f40)) facs<-c(rep('a',9),rep('b',9),rep('c',9),rep('d',9),rep('e',18),rep('f',18)) windows(5,5) boxplot(fs~facs,ylab='% of total reads',names=c('I','D','I','D','I','D'),col=c(3,3,'grey','grey',2,2)) legend(0.5,.5,legend=c('30 x CA','20 x ATCT','10 x ATCT'),fill=c(3,'grey',2),cex=.7) ###################################################### ###forward vs backward slippage fbc1.1<-fbc(ecoRI_2x30_l,60,2) fbc1.2<-fbc(c10_241_2x30_l,60,2) fbc1.3<-fbc(c10_242_2x30_l,60,2) fbc1.4<-fbc(c20_241_2x30_l,60,2) fbc1.5<-fbc(c20_242_2x30_l,60,2) fbc1.6<-fbc(c30_241_2x30_l,60,2) fbc1.7<-fbc(c30_242_2x30_l,60,2) fbc1.8<-fbc(c40_241_2x30_l,60,2) fbc1.9<-fbc(c40_242_2x30_l,60,2) tot1<-rbind(fbc1.1[1,],fbc1.2[1,],fbc1.3[1,],fbc1.4[1,],fbc1.5[1,],fbc1.6[1,],fbc1.7[1,],fbc1.8[1,],fbc1.9[1,]) jump1<-rbind(fbc1.1[2,],fbc1.2[2,],fbc1.3[2,],fbc1.4[2,],fbc1.5[2,],fbc1.6[2,],fbc1.7[2,],fbc1.8[2,],fbc1.9[2,]) sing1<-rbind(fbc1.1[3,],fbc1.2[3,],fbc1.3[3,],fbc1.4[3,],fbc1.5[3,],fbc1.6[3,],fbc1.7[3,],fbc1.8[3,],fbc1.9[3,]) wilcox.test(tot1[,1],tot1[,2],paired=T) wilcox.test(jump1[,1],jump1[,2],paired=T) wilcox.test(sing1[,1],sing1[,2],paired=T) ###gams fbmod1.f<-gam(sing1[,1]~s(cyc_4x20,k=3)) fbmod1.b<-gam(sing1[,2]~s(cyc_4x20,k=3)) summary(fbmod1.f) summary(fbmod1.b) fbmod1.fj<-gam(jump1[,1]~s(cyc_4x20,k=3)) fbmod1.bj<-gam(jump1[,2]~s(cyc_4x20,k=3)) summary(fbmod1.fj) summary(fbmod1.bj) fbmod1.fjnc<-gam(jump1[,1][-1]~s(cyc_4x20[-1],k=3)) fbmod1.bjnc<-gam(jump1[,2][-1]~s(cyc_4x20[-1],k=3)) summary(fbmod1.fjnc) summary(fbmod1.bjnc) ###fwd to bwd ratios mean(jump1[,2]/jump1[,1]) mean(sing1[,2]/sing1[,1]) mean(rowSums(jump1)/rowSums(sing1)) wilcox.test(rowSums(jump1),rowSums(sing1),paired=T) ####20x4 fbc2.1<-fbc(pstI_4x20_l,80,4) fbc2.2<-fbc(c10_131_4x20_l,80,4) fbc2.3<-fbc(c10_132_4x20_l,80,4) fbc2.4<-fbc(c20_131_4x20_l,80,4) fbc2.5<-fbc(c20_132_4x20_l,80,4) fbc2.6<-fbc(c30_131_4x20_l,80,4) fbc2.7<-fbc(c30_132_4x20_l,80,4) fbc2.8<-fbc(c40_131_4x20_l,80,4) fbc2.9<-fbc(c40_132_4x20_l,80,4) tot2<-rbind(fbc2.1[1,],fbc2.2[1,],fbc2.3[1,],fbc2.4[1,],fbc2.5[1,],fbc2.6[1,],fbc2.7[1,],fbc2.8[1,],fbc2.9[1,]) jump2<-rbind(fbc2.1[2,],fbc2.2[2,],fbc2.3[2,],fbc2.4[2,],fbc2.5[2,],fbc2.6[2,],fbc2.7[2,],fbc2.8[2,],fbc2.9[2,]) sing2<-rbind(fbc2.1[3,],fbc2.2[3,],fbc2.3[3,],fbc2.4[3,],fbc2.5[3,],fbc2.6[3,],fbc2.7[3,],fbc2.8[3,],fbc2.9[3,]) wilcox.test(tot2[,1],tot2[,2],paired=T) wilcox.test(jump2[,1],jump2[,2],paired=T) wilcox.test(sing2[,1],sing2[,2],paired=T) ###gams fbmod2.f<-gam(sing2[,1]~s(cyc_4x20,k=3)) fbmod2.b<-gam(sing2[,2]~s(cyc_4x20,k=3)) summary(fbmod2.f) summary(fbmod2.b) fbmod2.fj<-gam(jump2[,1]~s(cyc_4x20,k=3)) fbmod2.bj<-gam(jump2[,2]~s(cyc_4x20,k=3)) summary(fbmod2.fj) summary(fbmod2.bj) fbmod2.fjnc<-gam(jump2[,1][-1]~s(cyc_4x20[-1],k=3)) fbmod2.bjnc<-gam(jump2[,2][-1]~s(cyc_4x20[-1],k=3)) summary(fbmod2.fjnc) summary(fbmod2.bjnc) ###ratios mean(jump2[,2]/jump2[,1]) mean(sing2[,2]/sing2[,1]) mean(rowSums(jump2)/rowSums(sing2)) wilcox.test(rowSums(jump2),rowSums(sing2),paired=T) ###10x4 fbc3.1<-fbc(pstI_4x10_l,40,4) fbc3.2<-fbc(ecoRI_4x10_l,40,4) fbc3.3<-fbc(c10_131_4x10_l,40,4) fbc3.4<-fbc(c10_132_4x10_l,40,4) fbc3.5<-fbc(c10_241_4x10_l,40,4) fbc3.6<-fbc(c10_242_4x10_l,40,4) fbc3.7<-fbc(c20_131_4x10_l,40,4) fbc3.8<-fbc(c20_132_4x10_l,40,4) fbc3.9<-fbc(c20_241_4x10_l,40,4) fbc3.10<-fbc(c20_242_4x10_l,40,4) fbc3.11<-fbc(c30_131_4x10_l,40,4) fbc3.12<-fbc(c30_132_4x10_l,40,4) fbc3.13<-fbc(c30_241_4x10_l,40,4) fbc3.14<-fbc(c30_242_4x10_l,40,4) fbc3.15<-fbc(c40_131_4x10_l,40,4) fbc3.16<-fbc(c40_132_4x10_l,40,4) fbc3.17<-fbc(c40_241_4x10_l,40,4) fbc3.18<-fbc(c40_242_4x10_l,40,4) tot3<-rbind(fbc3.1[1,],fbc3.2[1,],fbc3.3[1,],fbc3.4[1,],fbc3.5[1,],fbc3.6[1,],fbc3.7[1,],fbc3.8[1,],fbc3.9[1,], fbc3.10[1,],fbc3.11[1,],fbc3.12[1,],fbc3.13[1,],fbc3.14[1,],fbc3.15[1,],fbc3.16[1,],fbc3.17[1,],fbc3.18[1,]) jump3<-rbind(fbc3.1[2,],fbc3.2[2,],fbc3.3[2,],fbc3.4[2,],fbc3.5[2,],fbc3.6[2,],fbc3.7[2,],fbc3.8[2,],fbc3.9[2,], fbc3.10[2,],fbc3.11[2,],fbc3.12[2,],fbc3.13[2,],fbc3.14[2,],fbc3.15[2,],fbc3.16[2,],fbc3.17[2,],fbc3.18[2,]) sing3<-rbind(fbc3.1[3,],fbc3.2[3,],fbc3.3[3,],fbc3.4[3,],fbc3.5[3,],fbc3.6[3,],fbc3.7[3,],fbc3.8[3,],fbc3.9[3,], fbc3.10[3,],fbc3.11[3,],fbc3.12[3,],fbc3.13[3,],fbc3.14[3,],fbc3.15[3,],fbc3.16[3,],fbc3.17[3,],fbc3.18[3,]) wilcox.test(tot3[,1],tot3[,2],paired=T) wilcox.test(jump3[,1],jump3[,2],paired=T) wilcox.test(sing3[,1],sing3[,2],paired=T) ###gams fbmod3.f<-gam(sing3[,1]~s(cyc_4x10,k=3)) fbmod3.b<-gam(sing3[,2]~s(cyc_4x10,k=3)) summary(fbmod3.f) summary(fbmod3.b) fbmod3.fj<-gam(jump3[,1]~s(cyc_4x10,k=3)) fbmod3.bj<-gam(jump3[,2]~s(cyc_4x10,k=3)) summary(fbmod3.fj) summary(fbmod3.bj) fbmod3.fjnc<-gam(jump3[,1][-c(1,2)]~s(cyc_4x10[-c(1,2)],k=3)) fbmod3.bjnc<-gam(jump3[,2][-c(1,2)]~s(cyc_4x10[-c(1,2)],k=3)) summary(fbmod3.fjnc) summary(fbmod3.bjnc) ###ratios mean(jump3[,2]/jump3[,1]) mean(sing3[,2]/sing3[,1]) mean(rowSums(jump3)/rowSums(sing3)) wilcox.test(rowSums(jump3),rowSums(sing3),paired=T) ###plots ###non-stepwise errors vs pcr regime (figS30) windows(8,7) par(mfrow=c(2,3)) par(mar=c(4,4,3,0.5)) plot(fbmod1.f,residuals=T,pch=16,shade=T,ylab='% of total reads',xlab='Nr. PCR cycles',shift=mean(sing1[,1]),main='A',cex=1.5) plot(fbmod2.f,residuals=T,pch=16,shade=T,ylab='% of total reads',xlab='Nr. PCR cycles',shift=mean(sing2[,1]),main='B',cex=1.5) plot(fbmod3.f,residuals=T,pch=16,shade=T,ylab='% of total reads',xlab='Nr. PCR cycles',shift=mean(sing3[,1]),main='C',cex=1.5) plot(fbmod1.b,residuals=T,pch=16,shade=T,ylab='% of total reads',xlab='Nr. PCR cycles',shift=mean(sing1[,2]),main='D',cex=1.5) plot(fbmod2.b,residuals=T,pch=16,shade=T,ylab='% of total reads',xlab='Nr. PCR cycles',shift=mean(sing2[,2]),main='E',cex=1.5) plot(fbmod3.b,residuals=T,pch=16,shade=T,ylab='% of total reads',xlab='Nr. PCR cycles',shift=mean(sing3[,2]),main='F',cex=1.5) ###indel slippage vs. pcr regime including no-pcr control (figS27) windows(8,7) par(mfrow=c(2,3)) par(mar=c(4,4,3,0.5)) plot(fbmod1.bj,residuals=T,pch=16,shade=T,ylab='% of reads',xlab='Nr. PCR cycles',shift=mean(jump1[,2]),main='A',cex=1.5) plot(fbmod2.bj,residuals=T,pch=16,shade=T,ylab='% of reads',xlab='Nr. PCR cycles',shift=mean(jump2[,2]),main='B',cex=1.5) plot(fbmod3.bj,residuals=T,pch=16,shade=T,ylab='% of reads',xlab='Nr. PCR cycles',shift=mean(jump3[,2]),main='C',cex=1.5) plot(fbmod1.fj,residuals=T,pch=16,shade=T,ylab='% of reads',xlab='Nr. PCR cycles',shift=mean(jump1[,1]),main='D',cex=1.5) plot(fbmod2.fj,residuals=T,pch=16,shade=T,ylab='% of reads',xlab='Nr. PCR cycles',shift=mean(jump2[,1]),main='E',cex=1.5) plot(fbmod3.fj,residuals=T,pch=16,shade=T,ylab='% of reads',xlab='Nr. PCR cycles',shift=mean(jump3[,1]),main='F',cex=1.5) ###indel slippage vs. pcr regime without no-pcr control (figS28) windows(8,7) par(mfrow=c(2,3)) par(mar=c(4,4,3,0.5)) plot(fbmod1.bjnc,residuals=T,pch=16,shade=T,ylab='% of reads',xlab='Nr. PCR cycles',shift=mean(jump1[,2][-1]),main='A',cex=1.5) plot(fbmod2.bjnc,residuals=T,pch=16,shade=T,ylab='% of reads',xlab='Nr. PCR cycles',shift=mean(jump2[,2][-1]),main='B',cex=1.5) plot(fbmod3.bjnc,residuals=T,pch=16,shade=T,ylab='% of reads',xlab='Nr. PCR cycles',shift=mean(jump3[,2][-c(1,2)]),main='C',cex=1.5) plot(fbmod1.fjnc,residuals=T,pch=16,shade=T,ylab='% of reads',xlab='Nr. PCR cycles',shift=mean(jump1[,1][-1]),main='D',cex=1.5) plot(fbmod2.fjnc,residuals=T,pch=16,shade=T,ylab='% of reads',xlab='Nr. PCR cycles',shift=mean(jump2[,1][-1]),main='E',cex=1.5) plot(fbmod3.fjnc,residuals=T,pch=16,shade=T,ylab='% of reads',xlab='Nr. PCR cycles',shift=mean(jump3[,1][-c(1,2)]),main='F',cex=1.5) ################################################################## ###indel rates in spacers ###both constructs id_rates_all<-rbind(ecoRI_s_id,pstI_s_id, c10_131_s_id,c10_132_s_id,c10_241_s_id,c10_242_s_id,c20_131_s_id,c20_132_s_id, c20_241_s_id,c20_242_s_id,c30_131_s_id,c30_132_s_id,c30_241_s_id,c30_242_s_id, c40_131_s_id,c40_132_s_id,c40_241_s_id,c40_242_s_id) ###construct 1 id_rates_c1<-rbind(ecoRI_s_id, c10_131_s_id,c10_132_s_id,c20_131_s_id,c20_132_s_id, c30_131_s_id,c30_132_s_id,c40_131_s_id,c40_132_s_id) ###construct 2 id_rates_c2<-rbind(pstI_s_id,c10_241_s_id,c10_242_s_id, c20_241_s_id,c20_242_s_id,c30_241_s_id,c30_242_s_id,c40_241_s_id,c40_242_s_id) ###indels vs pcr (figS31) tot_cyc<-c(0,0,rep(10,4),rep(20,4),rep(30,4),rep(40,4)) windows() plot(tot_cyc,id_rates_all[,3],ylab='% of total reads',xlab='Nr. PCR cycles',pch=16,cex=1.5) tot_mod<-lm(id_rates_all[,3]~tot_cyc) summary(tot_mod) abline(tot_mod) text(5,7.5,expression(paste(R^2,' = 0.35'))) text(5,7.3,expression(paste(beta,' = 0.04'))) ###deletions vs insertions (Fig 5) windows(8,5) layout(matrix(c(1,2,3),ncol=3,byrow=T),widths=c(2,2,1)) layout.show(3) par(las=2) par(mar=c(6,4,2,1)) boxplot(c(jump1,jump2,jump3)~c(rep('a',9),rep('b',9),rep('c',9),rep('d',9),rep('e',18),rep('f',18)),ylab='% of total reads',main='A',names=c('30xCA-I','30xCA-D','20xATCT-I','20xATCT-D','10xATCT-I','10xATCT-D')) boxplot(c(sing1,sing2,sing3)~c(rep('a',9),rep('b',9),rep('c',9),rep('d',9),rep('e',18),rep('f',18)),ylab='% of total reads',main='B',names=c('30xCA-I','30xCA-D','20xATCT-I','20xATCT-D','10xATCT-I','10xATCT-D')) boxplot(id_rates_all[,1:2],ylab='% of total reads',names=c('Linker-I','Linker-D'),main='C') ###normalized for sequence length (figS32) ###indels per nucleotide windows() par(cex.axis=.8) par(las=2) boxplot(c(sing1/6000,sing2/8000,sing3/4000,c(id_rates_all[,4:5]))~c(rep('a',9),rep('b',9),rep('c',9),rep('d',9),rep('e',18),rep('f',18),rep('g',18),rep('h',18)) ,ylab='Per base indel rate',names=c('30xCA-I','30xCA-D','20xATCT-I','20xATCT-D','10xATCT-I','10xATCT-D','Linker-I','Linker-D')) ################################################################# ###Full data barcharts (figs S4-S23) #figS4 windows(4,4) par(las=2) par(mar=c(3,3,3,1)) par(cex.axis=.8) barplot(table(ecoRI_2x30_l)) #figS5 windows(8,4) par(mfrow=c(1,2)) par(las=2) par(mar=c(3,3,3,1)) par(cex.axis=.8) barplot(table(c10_241_2x30_l),main='A') barplot(table(c10_242_2x30_l),main='B') #figS6 barplot(table(c20_241_2x30_l),main='A') barplot(table(c20_242_2x30_l),main='B') #figS7 barplot(table(c30_241_2x30_l),main='A') barplot(table(c30_242_2x30_l),main='B') #figS8 barplot(table(c40_241_2x30_l),main='A') barplot(table(c40_242_2x30_l),main='B') #figS9 windows(4,4) par(las=2) par(mar=c(3,3,3,1)) par(cex.axis=.8) barplot(table(pstI_4x20_l)) #figS10 windows(8,4) par(mfrow=c(1,2)) par(las=2) par(mar=c(3,3,3,1)) par(cex.axis=.8) barplot(table(c10_131_4x20_l),main='A') barplot(table(c10_132_4x20_l),main='B') #figS11 windows(10,4) par(mfrow=c(1,2)) par(las=2) par(mar=c(3,3,3,1)) par(cex.axis=.7) barplot(table(c20_131_4x20_l),main='A') barplot(table(c20_132_4x20_l),main='B') #figS12 windows(8,4) par(mfrow=c(1,2)) par(las=2) par(mar=c(3,3,3,1)) par(cex.axis=.7) barplot(table(c30_131_4x20_l),main='A') barplot(table(c30_132_4x20_l),main='B') #figS13 barplot(table(c40_131_4x20_l),main='A') barplot(table(c40_132_4x20_l),main='B') #figS14 windows(4,4) par(las=2) par(mar=c(3,3,3,1)) par(cex.axis=.8) barplot(table(pstI_4x10_l)) #figS15 windows(8,4) par(mfrow=c(1,2)) par(las=2) par(mar=c(3,3,3,1)) par(cex.axis=.8) barplot(table(c10_131_4x10_l),main='A') barplot(table(c10_132_4x10_l),main='B') #figS16 barplot(table(c20_131_4x10_l),main='A') barplot(table(c20_132_4x10_l),main='B') #figS17 barplot(table(c30_131_4x10_l),main='A') barplot(table(c30_132_4x10_l),main='B') #figS18 barplot(table(c40_131_4x10_l),main='A') barplot(table(c40_132_4x10_l),main='B') #figS19 windows(4,4) par(las=2) par(mar=c(3,3,3,1)) par(cex.axis=.8) barplot(table(ecoRI_4x10_l)) #figS20 windows(8,4) par(mfrow=c(1,2)) par(las=2) par(mar=c(3,3,3,1)) par(cex.axis=.8) barplot(table(c10_241_4x10_l),main='A') barplot(table(c10_242_4x10_l),main='B') #figS21 barplot(table(c20_241_4x10_l),main='A') barplot(table(c20_242_4x10_l),main='B') #figS22 barplot(table(c30_241_4x10_l),main='A') barplot(table(c30_242_4x10_l),main='B') #figS23 barplot(table(c40_241_4x10_l),main='A') barplot(table(c40_242_4x10_l),main='B') ###compare 10xATCT scoring fidelity between constructs d1_1<-fix.var(c(c10_131_4x10_l,c10_132_4x10_l),40) d1_4<-fix.var(c(c10_241_4x10_l,c10_242_4x10_l),40) wilcox.test(d1_1,d1_4) d2_1<-fix.var(c(c20_131_4x10_l,c20_132_4x10_l),40) d2_4<-fix.var(c(c20_241_4x10_l,c20_242_4x10_l),40) wilcox.test(d2_1,d2_4) d3_1<-fix.var(c(c30_131_4x10_l,c30_132_4x10_l),40) d3_4<-fix.var(c(c30_241_4x10_l,c30_242_4x10_l),40) wilcox.test(d3_1,d3_4) d4_1<-fix.var(c(c40_131_4x10_l,c40_132_4x10_l),40) d4_4<-fix.var(c(c40_241_4x10_l,c40_242_4x10_l),40) wilcox.test(d4_1,d4_4) ###Look for PCR saturation ###Qbit x3. x100 dilution. concentrations in ng/ml. Construct 1. x10pcr_1<-c(231,269,263)*0.1 x20pcr_1<-c(407,401,446)*0.1 x30pcr_1<-c(496,510,510)*0.1 x40pcr_1<-c(530,520,500)*0.1 c1_pcr<-rbind(x10pcr_1,x20pcr_1,x30pcr_1,x40pcr_1) c1_pcr_m<-rowMeans(c1_pcr) c1_pcr_se<-apply(c1_pcr,1,function(x)sd(x)/sqrt(3)) pcr_cyc<-c(10,20,30,40) windows(8,4) par(mfrow=c(1,2)) plot(pcr_cyc,c1_pcr_m,ylab="Concentration (ng/ul)",xlab="# PCR cycles",pch=16,ylim=c(23,53),cex=1,main='A') for(i in 1:4){ lines(c(pcr_cyc[i],pcr_cyc[i]),c(c1_pcr_m[i]-c1_pcr_se[i],c1_pcr_m[i]+c1_pcr_se[i])) } ###Qbit x3. x100 dilution. concentrations in ng/ml. Construct 2. x10pcr_2<-c(65,67,61)*0.1 x20pcr_2<-c(117,118,128)*0.1 x30pcr_2<-c(363,383,379)*0.1 x40pcr_2<-c(425,422,444)*0.1 c2_pcr<-rbind(x10pcr_2,x20pcr_2,x30pcr_2,x40pcr_2) c2_pcr_m<-rowMeans(c2_pcr) c2_pcr_se<-apply(c2_pcr,1,function(x)sd(x)/sqrt(3)) plot(pcr_cyc,c2_pcr_m,ylab="Concentration (ng/ul)",xlab="# PCR cycles",pch=16,cex=1,main='B') for(i in 1:4){ lines(c(pcr_cyc[i],pcr_cyc[i]),c(c2_pcr_m[i]-c2_pcr_se[i],c2_pcr_m[i]+c2_pcr_se[i])) } ###################################################### ###single nc slippage (figS29) updated fs<-c(c(f60),c(f80),c(f40),c(id_rates_all[,7:8])) facs<-c(rep('a',9),rep('b',9),rep('c',9),rep('d',9),rep('e',18),rep('f',18),rep('g',18),rep('h',18)) windows(5,5) boxplot(fs~facs,ylab='% of total reads',names=c('I','D','I','D','I','D','I','D'),col=c(3,3,'grey','grey',2,2,4,4)) legend(0.5,5,legend=c('30 x CA','20 x ATCT','10 x ATCT','Linker'),fill=c(3,'grey',2,4),cex=.7) wilcox.test(id_rates_all[,7],id_rates_all[,8],paired=T) ######################################### ####Figures 1-3 with minimal legends ###Panel plot (Fig 1) windows(8,4) layout(matrix(c(1,1,1,2,3,4),ncol=3,byrow=T),heights=c(1,5,5,5)) layout.show(4) par(mar=c(0,0,0,0)) plot(1:10,1:10,type='n',xlab='',ylab='',axes=F) legend(2.5,8,legend=c('No PCR','10 cycles','20 cycles','30 cycles','40 cycles'),bg=colors()[250],ncol=5,pch=16,pt.cex=2,col=1:5,cex=1.5) par(mar=c(4,4,1,1)) plot(rp1[1,],rp1[2,],xlim=c(38,70),pch=16,axes=F,type='n',xlab='Microsatellite length',ylab='Proportion of reads') axis(2) axis(1,at=seq(38,70,by=2)) abline(v=seq(38,70,by=4),lty=3,col=colors()[152]) abline(h=c(0,.1,.2,.3,.4,.5),lty=3,col=colors()[152]) abline(v=60,lty=2,col=1) points(rp1[1,],rp1[2,],pch=16) points(rp2[1,],rp2[2,],pch=16,col=2) points(rp4[1,],rp4[2,],pch=16,col=3) points(rp6[1,],rp6[2,],pch=16,col=4) points(rp8[1,],rp8[2,],pch=16,col=5) text(40,.55,'A',font=2,cex=1.5) text(42,.45,'30xCA',font=2) plot(rp1.2[1,],rp1.2[2,],xlim=c(50,100),pch=16,axes=F,type='n',xlab='Microsatellite length',ylab='Proportion of reads') axis(2) axis(1,at=seq(52,100,by=4)) abline(v=seq(52,100,by=8),lty=3,col=colors()[152]) abline(h=c(0,.2,.4,.6,.8),lty=3,col=colors()[152]) abline(v=80,lty=2,col=1) points(rp1.2[1,],rp1.2[2,],pch=16,cex=1) points(rp2.2[1,],rp2.2[2,],pch=16,col=2,cex=1) points(rp4.2[1,],rp4.2[2,],pch=16,col=3,cex=1) points(rp6.2[1,],rp6.2[2,],pch=16,col=4,cex=1) points(rp8.2[1,],rp8.2[2,],pch=16,col=5,cex=1) text(54,.89,'B',font=2,cex=1.5) text(58,.7,'20xATCT',font=2) plot(rp1.3[1,],rp1.3[2,],xlim=c(24,52),pch=16,axes=F,type='n',xlab='Microsatellite length',ylab='Proportion of reads') axis(2) axis(1,at=seq(24,52,by=4)) abline(v=seq(24,52,by=8),lty=3,col=colors()[152]) abline(h=c(0,.2,.4,.6,.8,1),lty=3,col=colors()[152]) abline(v=40,lty=2,col=1) points(rp1.3[1,],rp1.3[2,],pch=16,cex=1) points(rp2.3[1,],rp2.3[2,],pch=16,col=2,cex=1) points(rp4.3[1,],rp4.3[2,],pch=16,col=3,cex=1) points(rp6.3[1,],rp6.3[2,],pch=16,col=4,cex=1) points(rp8.3[1,],rp8.3[2,],pch=16,col=5,cex=1) text(26,.99,'C',font=2,cex=1.5) text(30,.7,'10xATCT',font=2) ########################################################## ###figure 2 windows(7,3) par(mfrow=c(1,3)) par(cex.axis=1) par(las=1) par(mar=c(3,3,3,1)) plot(names(np3),np3,type='h',lwd=3,axes=F,main='A') axis(2);axis(1,at=find.tix(np3,target=60)) text(55,1300,'30xCA') plot(names(np2),np2,type='h',lwd=3,axes=F,main='B') axis(2);axis(1,at=find.tix(np2,target=80)) text(72,2250,'20xATCT') plot(names(np1),np1,type='h',lwd=3,axes=F,main='C') axis(2);axis(1,at=find.tix(np1,target=40)) text(37.5,2250,'10xATCT') ###figure 3 par(mfrow=c(4,3)) par(cex.axis=1) par(las=0) par(mar=c(3,3,2,1)) plot(names(e1),e1,type='h',lwd=3,axes=F,main='A') axis(2);axis(1,at=find.tix(e1,int=4,target=60)) text(53,250,'30xCA');text(53,200,'10 cyc.') plot(names(e2),e2,type='h',lwd=3,axes=F,main='B') axis(2);axis(1,at=find.tix(e2,target=80)) text(62,300,'20xATCT');text(62,250,'10 cyc.') plot(names(e3),e3,type='h',lwd=3,axes=F,main='C') axis(2);axis(1,at=find.tix(e3,target=40)) text(34,450,'10xATCT');text(34,380,'10 cyc.') plot(names(e4),e4,type='h',lwd=3,axes=F,main='D') axis(2);axis(1,at=find.tix(e4,int=4,target=60)) text(51,600,'30xCA');text(51,500,'20 cyc.') plot(names(e5),e5,type='h',lwd=3,axes=F,main='E') axis(2);axis(1,at=find.tix(e5,int=4,target=80)) text(56,2500,'20xATCT');text(56,2000,'20 cyc.') plot(names(e6),e6,type='h',lwd=3,axes=F,main='F') axis(2);axis(1,at=find.tix(e6,target=40)) text(35,2300,'10xATCT');text(35,1900,'20 cyc.') plot(names(e7),e7,type='h',lwd=3,axes=F,main='G') axis(2);axis(1,at=find.tix(e7,int=4,target=60)) text(45,500,'30xCA');text(45,400,'30 cyc.') plot(names(e8),e8,type='h',lwd=3,axes=F,main='H') axis(2);axis(1,at=find.tix(e8,int=4,target=80)) text(62,600,'20xATCT');text(62,500,'30 cyc.') plot(names(e9),e9,type='h',lwd=3,axes=F,main='I') axis(2);axis(1,at=find.tix(e9,target=40)) text(35,1000,'10xATCT');text(35,850,'30 cyc.') plot(names(e10),e10,type='h',lwd=3,axes=F,main='J') axis(2);axis(1,at=find.tix(e10,int=4,target=60)) text(53,200,'30xCA');text(53,165,'40 cyc.') plot(names(e11),e11,type='h',lwd=3,axes=F,main='K') axis(2);axis(1,at=find.tix(e11,int=4,target=80)) text(72,400,'20xATCT');text(72,340,'40 cyc.') plot(names(e12),e12,type='h',lwd=3,axes=F,main='L') axis(2);axis(1,at=find.tix(e12,target=40)) text(37.5,500,'10xATCT');text(37.5,400,'40 cyc.')