A generic engine for comparing tree-structured objects
Compares two record-oriented files, itemizing specific difference between equivalent records in the two files. Reports both itemized and summarized differences.
The GATK contains a summarizing difference engine that compares hierarchical data structures to emit:
The GATK contains a private walker DiffObjects that allows you access to the DiffEngine capabilities on the command line. Simply provide the walker with the master and test files and it will emit summarized differences for you.
The reason for this system is that it allows you to compare two structured files -- such as BAMs and VCFs -- for common differences among them. This is primarily useful in regression testing or optimization, where you want to ensure that the differences are those that you expect and not any others.
The DiffObjectsWalker works with BAM or VCF files.
The DiffEngine system compares to two hierarchical data structures for specific differences in the values of named nodes. Suppose I have two trees:
Tree1=(A=1 B=(C=2 D=3)) Tree2=(A=1 B=(C=3 D=3 E=4)) Tree3=(A=1 B=(C=4 D=3 E=4))
where every node in the tree is named, or is a raw value (here all leaf values are integers). The DiffEngine traverses these data structures by name, identifies equivalent nodes by fully qualified names (Tree1.A is distinct from Tree2.A, and determines where their values are equal (Tree1.A=1, Tree2.A=1, so they are). These itemized differences are listed as:
Tree1.B.C=2 != Tree2.B.C=3 Tree1.B.C=2 != Tree3.B.C=4 Tree2.B.C=3 != Tree3.B.C=4 Tree1.B.E=MISSING != Tree2.B.E=4
This conceptually very similar to the output of the unix command line tool diff. What's nice about DiffEngine though is that it computes similarity among the itemized differences and displays the count of differences names in the system. In the above example, the field C is not equal three times, while the missing E in Tree1 occurs only once. So the summary is:
*.B.C : 3 *.B.E : 1
where the * operator indicates that any named field matches. This output is sorted by counts, and provides an immediate picture of the commonly occurring differences among the files.
Below is a detailed example of two VCF fields that differ because of a bug in the AC, AF, and AN counting routines, detected by the integrationtest integration (more below). You can see that in the although there are many specific instances of these differences between the two files, the summarized differences provide an immediate picture that the AC, AF, and AN fields are the major causes of the differences.
[testng] path count [testng] *.*.*.AC 6 [testng] *.*.*.AF 6 [testng] *.*.*.AN 6 [testng] 64b991fd3850f83614518f7d71f0532f.integrationtest.20:10000000.AC 1 [testng] 64b991fd3850f83614518f7d71f0532f.integrationtest.20:10000000.AF 1 [testng] 64b991fd3850f83614518f7d71f0532f.integrationtest.20:10000000.AN 1 [testng] 64b991fd3850f83614518f7d71f0532f.integrationtest.20:10000117.AC 1 [testng] 64b991fd3850f83614518f7d71f0532f.integrationtest.20:10000117.AF 1 [testng] 64b991fd3850f83614518f7d71f0532f.integrationtest.20:10000117.AN 1 [testng] 64b991fd3850f83614518f7d71f0532f.integrationtest.20:10000211.AC 1 [testng] 64b991fd3850f83614518f7d71f0532f.integrationtest.20:10000211.AF 1 [testng] 64b991fd3850f83614518f7d71f0532f.integrationtest.20:10000211.AN 1 [testng] 64b991fd3850f83614518f7d71f0532f.integrationtest.20:10000598.AC 1
Because this is a walker, it requires that you pass a reference file. However the reference is not actually used, so it does not matter what you pass as reference.
These Read Filters are automatically applied to the data by the Engine before processing by DiffObjects.
The arguments described in the entries below can be supplied to this tool to modify its behavior. For example, the -L argument directs the GATK engine restricts processing to specific genomic intervals (this is an Engine capability and is therefore available to all GATK walkers).
This table summarizes the command-line arguments that are specific to this tool. For details, see the list further down below the table.
|--master||File||NA||Master file: expected results|
|--test||File||NA||Test file: new results to compare to the master file|
|--doPairwise||boolean||false||If provided, we will compute the minimum pairwise differences to summary, which can be extremely expensive|
|--iterations||int||1||Number of iterations to perform, should be 1 unless you are doing memory testing|
|--maxCount1Diffs||int||0||Max. number of diffs occuring exactly once in the file to process|
|--maxDiffs||int||0||Max. number of diffs to process|
|--maxObjectsToRead||int||-1||Max. number of objects to read from the files. -1 [default] means unlimited|
|--maxRawDiffsToSummarize||int||-1||Max. number of differences to include in the summary. -1 [default] means unlimited|
|--minCountForDiff||int||1||Min number of observations for a records to display|
|--out||PrintStream||stdout||File to which results should be written|
|--showItemizedDifferences||boolean||false||Should we enumerate all differences between the files?|
Arguments in this list are specific to this tool. Keep in mind that other arguments are available that are shared with other tools (e.g. command-line GATK arguments); see Inherited arguments above.
If provided, we will compute the minimum pairwise differences to summary, which can be extremely expensive.
Number of iterations to perform, should be 1 unless you are doing memory testing.
Master file: expected results. The master file against which we will compare test. This is one of the two required files to do the comparison. Conceptually master is the original file contained the expected results, but this doesn't currently have an impact on the calculations, but might in the future.
Max. number of diffs occuring exactly once in the file to process. The maximum number of singleton (occurs exactly once between the two files) to display when writing out the summary. Only applies if maxDiffs hasn't been exceeded. For example, if maxDiffs is 10 and maxCount1Diffs is 2 and there are 20 diffs with count > 1, then only 10 are shown, all of which have count above 1.
Max. number of diffs to process. The max number of differences to display when summarizing. For example, if there are 10M differences, but maxDiffs is 10, then the comparison aborts after first ten summarized differences are shown. Note that the system shows differences sorted by frequency, so these 10 would be the most common between the two files. A value of 0 means show all possible differences.
Max. number of objects to read from the files. -1 [default] means unlimited. The engine will read at most this number of objects from each of master and test files. This reduces the memory requirements for DiffObjects but does limit you to comparing at most this number of objects
Max. number of differences to include in the summary. -1 [default] means unlimited.
Min number of observations for a records to display. Only differences that occur more than minCountForDiff are displayed. For example, if minCountForDiff is 10, then a difference must occur at least 10 times between the two files to be shown.
File to which results should be written. Writes out a file of the DiffEngine format: See http://www.broadinstitute.org/gatk/guide/article?id=1299 for details.
Should we enumerate all differences between the files?. If provided, the system will write out the summarized, individual differences. May lead to enormous outputs, depending on how many differences are found. Note these are not sorted in any way, so if you have 10M common differences in the files, you will see 10M records, whereas the final summarize will just list the difference and its count of 10M.
Test file: new results to compare to the master file. The test file against which we will compare to the master. This is one of the two required files to do the comparison. Conceptually test is the derived file from master, but this doesn't currently have an impact on the calculations, but might in the future.
GATK version 2.5-2-gdb4546e built at 2013/05/01 09:32:36.