adamewing/bamsurgeon — pull request #22 by andreaswilm (2014-12-16 06:04:31+00:00)
Title: Haplotype/Sequence context aware comparison of indels

Two differently annotated indels can "produce" the same haplotype or sequence, due to the positional ambiguity in indel notation. Simplest example is the deletion of bases at different positions in a homopolymer stretch. Evaluators would normally see two different indels. If one was known to be true, the other would be (wrongly) evaluated as false. The solution to this problem is to insert the indels into their reference sequence context and compare the two resulting mutated sequences. This pull request adds (optional) haplotype or sequence context aware comparison to the evaluation of indel calls (enabled by providing a reference to evaluator.py with -f or --ref)

- Also added --debug option
- Introduces a pysam dependency to be able to read the reference (0.7.5 worked; newer versions esp. 0.8 might not work)
- Was initially part of closed pull request #18

Following is an example of two indels that result in identically mutated sequences (corresponding reference http://www.ncbi.nlm.nih.gov/nuccore/NC_000913.3)
- Sequence context for first indel is: `361131 CGTGCAT`
- Sequence context for first indel is: `4230169 TCTGGCTTTTACGCCGCGCCAGTGGAGGTTGAA`

Truth vcf:

#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	SPIKEIN
NC_000913	361132	.	G	GTG	100	PASS	SOMATIC	GT	0/1
NC_000913	4230170	.	C	CTGGCTTTTACGCCGC	100	PASS	SOMATIC	GT	0/1

Submission vcf:

#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO
NC_000913	361131	.	C	CGT	312	PASS	DP=598;AF=0.202341;SB=45;DP4=256,229,38,83;INDEL
NC_000913	4230169	.	T	TCTGGCTTTTACGCCG	84	PASS	DP=577;AF=0.053726;SB=5;DP4=276,275,19,12;INDEL

Andreas