How is a principal component analysis for population structure made from a bam or other alignment file?
In general, the process works as such:


Variants are found at a number of loci in each sample (missing loci are often imputed).
Each sample is scored at each locus, often according to the number of copies of the reference allele that it has (so, 0-2).
The resulting matrix is used for PCA.