I've found more success with the POPBAM source from github. (I used commit 0cdbacc2fd869e0b65a64bf5ff38ca1c21f41657
)
The important thing to note, though, is the header adjustment you need to do in order for POPBAM to recognize your samples. From http://popbam.sourceforge.net/:
To enable POPBAM to perform population-level analyses, it is first necessary to modify the input BAM file header. Users must add the "PO" tag to the header line for each read group. The "PO" tag can be any string, as long as the string is identical between samples from the same population. One example may be that a BAM file has three read groups (R21, R22, and R25). The R22 and R25 read groups are from two different lines of Drosophila melanogaster called "MEL01" and "MEL02", while the third read group, R21, is from a single line of D. simulans called "SIM01". Below is an example of the BAM header including the "PO" tag:
@RG ID:R22 SM:MEL01 PO:MEL
@RG ID:R25 SM:MEL02 PO:MEL
@RG ID:R21 SM:SIM01 PO:SIM
First, be sure to include readgroup information:
samtools merge -rh group1.header.txt group1.bam CD3674.bam CD3688.bam CD3692.bam CD3700.bam CD3719.bam
group1.header.txt:
@HD VN:1.3 SO:coordinate
@SQ SN:NC_009089 LN:4290252 AS:NC_009089
@RG ID:CD3674 SM:CD3674 PO:CD3674
@RG ID:CD3688 SM:CD3688 PO:CD3688
@RG ID:CD3692 SM:CD3692 PO:CD3692
@RG ID:CD3700 SM:CD3700 PO:CD3700
@RG ID:CD3719 SM:CD3719 PO:CD3719
And finally, run as so:
popbam tree -f ref.fasta NC_009089:1-42000000 -o group1.txt > group1.tree
(As far as I can tell, the region is required, the -o output file is ignored, and output is written to stdout.)
Thanks for the answer. I'm using retargeted sequencing on small number of targets (30 genes), so I'm assuming it won't be a big problem.
When you mention a consensus sequence, you mean using stuff like pileup to generate it?
Pileup might work. There are plenty of tools that go from pileup to consensus (varscan, gakt...)