ML Heuristic Search


#NEXUS

[estimates parameters on NJ tree then does heuristic search using those parameter estimates.]
	
[starts PAUP]
begin paup;
	
set 
autoclose     [closes the status window automatically]
nowarntree    [turns off the feature that prompts you to save trees in memory]
nowarnreset   [turns off feature that asks "do you really want to reset the data file"]
torder=right  [specifies the tree order to be ladderized to the right]
flush         [flushes the file buffer]
tcompress=yes [prints trees in a compressed format, which allows you to view large trees in a single page]
defaultmode;  [tells paup to use the default option when a dialog box is opened]


	
	[start writing to log file; replace "your_log" with your log file name]
	log file=your_log.log;
	
	[execute your dataset; replace "your_data" with your data file name]
	execute your_data.nex;
	
	[set criterion to maximum likelihood]
	set criterion=likelihood;
	
	[reconstruct tree using neighbor-joining]
	nj;
	
	[estimate parameters for HKY+I+G on neighbor-joining tree]
	lset [this is HKY+I+G model] nst=2  base=est  tratio=est  rates=gamma  shape=est  pinv=est;
	
	[calculate likelihood scores]
	lscores;
	
	[set parameters to those estimated for neighbor-joining tree]
	lset nst=2 base=previous tratio=previous rates=gamma shape=previous pinv=previous;
	
	[perform a heuristic search with TBR branch swapping and 10 replicates]
	hs addseq=rand nreps=10 swap=tbr;
	
	[savetrees with branchlengths; replace "your_trees" with your tree file name]
	savetrees brlens file=your_trees.tree;
	                     
	[stop writing to log file]
	log stop;
	
	[quit PAUP]
	quit;
end;