BamGenotypeCheck

From Genome Analysis Wiki
Revision as of 11:06, 21 June 2010 by Pha (talk | contribs) (total rewrite - new program)
Jump to navigationJump to search

Why genotypeIDcheck?

When sequencing data arrives from the sequencer machines, several types of errors or contaminations can creep in.

The most serious error that can occur is that the actual sample name for the sample gets swapped with a different sample. In this case, what we think is one person's sequencing data is actually another. Although they are confidential, in some cases, they are intended to be part of a family, and such an error causes problems in later analysis.

Also, since we typically genotype the same samples along with running a full sequence of them, we want to know that the genotyping information matches the sequence, otherwise again, we will find errors in later analysis.

Another set of problems occurs when the actual biological sample is contaminated in some way. It could be the case, for example, that certain common laboratory contaminates will be included in the sequencing data - knowing approximately how much of such contaminants exist (e.g. yeast) is useful.

So, the program genotypeIDcheck was written in order to discover if problems such as these exist, and if so, report them to the user.

To work, genotypeIDcheck needs a) a list of sorted, calibrated BAM files to check, b) a genome reference to check against, c) a pedigree that describes the samples being checked.

On output, genotypeIDcheck shows, for each read group in each BAM file, the individual in the pedigree that comes statistically closest to matching the reads in the read group, and the degree to how close that relationship is. In addition, marker coverage of three different classes of markers is shown for that individual as well.

Basic Usage Example

Here is an example of how genotypeIDcheck works:

  genotypeIDcheck  -r /data/local/ref/karma.ref/human.g1k.v37.fa \
             -k BAMfiles.txt -p test.ped -d test.dat -m test.map

Command Line Options

Input Files

-r  KARMA genome reference
-k  a filename that contains a list of BAM files to check
-a  pedigree Allele Frequency file
-p  pedigree .ped file
-d  pedigree .dat file
-m  pedigree .map file

Output Options

-c [int]  stop after reading [int] filtered sequence reads
-C [int]  stop after reading [int] reads, filtered or not
-v  verbose output

Filtering

-b [int]  exclude marker positions with base quality less than [int]
-M [int]  exclude all reads with map quality less than [int]
-F [int]  set custom BAM flags filter (not implemented at the moment)

Other Options

-e [float]  set minimum error estimate to [float]


Principle of Operation

For computational and output purposes, we consider each read group sample in each BAM file to be distinct from all others.

For each aligned sample, we calculate the probability that the sample is from each individual in the pedigree according to five different probabilities of being identical by descent. So from the base quality (again, assuming calibrated base qualities), the given base in the read, the marker corresponding reference base and genotype chip read data, you can compute the probability of that individual being the one in the sample for the given probability of IBD.

What you actually want is the multiple of theses probabilities taken across all reads in the sample. This becomes impractically small, so we instead sum the logs of the probabilities.

After the sample is read, the sample in the pedigree that contains the highest log-sum of computed Pibd values is assumed to have the strongest relationship to that sample. The ID of the corresponding pedigree sample name is printed, the sample name indicated in the read group is printed, and coverage information is also printed.

For more about the mathematical details, see the page Verifying Sample Identities - Implementation

TODO