Finding where a short piece of DNA belongs on a reference is the first step of variant calling. The Smith-Waterman algorithm does it exactly: it fills a matrix of best local scores, one cell per pair of read and reference bases, rewarding matches, penalising mismatches and charging an affine cost for gaps, and then traces back from the best cell to read off the optimal alignment. A single insertion or deletion is cheaper than many separate gaps, so the cost of opening a gap is larger than the cost of extending it.
One read cannot tell a sequencing error from a real variant, so the page aligns many reads and builds a pileup: a column is called only when enough reads agree on the same difference. Change the scoring, the error rate, the coverage and the thresholds to see when real variants are found, missed or imitated by noise. Educational model of the algorithm, not a diagnostic tool.