Post date: Jan 31, 2014 5:12:30 PM
R code to generate integer-based allele counts.
load("autoc.rwsp")
ninds<-table(pops[,1])
aftmix<-matrix(NA,nrow=15069,ncol=66*2)
for(i in 1:66){
aftmix[,x[i]]<-round(afcommon[,i] * ninds[i],0)
aftmix[,(x[i]+1)]<-ninds[i]-aftmix[,x[i]]
}
write.table(aftmix,file="../trmx_snpfile_LycCommon.txt",row.names=F,col.names=F,quote=F)
Perl script cleans up file and gzip to compress as required
perl makeTreeMixIn.pl
gzip trmx_in.txt
Key steps in the analysis:
Estimate ML tree without migration
Set root (how important is this?)
Add migration events based on residuals
Jackknife procedure to test whether hypothesized migration events significantly improve the fit of the data (this is in no way a test of the overall fit of the data to the full model)
You should only retain significant migration events but it is not advised to keep adding migration events until they are no longer significant. One possibility is to plot the residual variance (or PVE) to identify a point where little is gained by adding additional migration events.