hamming distance analysis of duplex tags
python
matplotlib
python2 '$__tool_directory__/hd.py' --inputFile '$inputFile' --inputName1 '$inputFile.name' --sample_size $sampleSize --subset_tag $subsetTag --nproc $nproc $onlyDCS $rel_freq --minFS $minFS --maxFS $maxFS
$nr_above_bars --output_pdf $output_pdf --output_tabular $output_tabular --output_chimeras_tabular $output_chimeras_tabular
`_ as a measure of similarity. In this context the Hamming distance is simply the number of differences between two tags.
**Input**
This tools expects a tabular file with the tags of all families, their sizes and information about forward (ab) and reverse (ba) strands::
1 AAAAAAAAAAAATGTTGGAATCTT ba
10 AAAAAAAAAAAGGCGGTCCACCCC ab
28 AAAAAAAAAAATGGTATGGACCGA ab
.. class:: infomark
**How to generate the input**
The first step of the `Du Novo Analysis Pipeline `_ is the **Make Families** tool that produces output in this form::
1 2 3 4
------------------------------------------------------
AAAAAAAAAAAAAAATAGCTCGAT ba read1 CGCTACGTGACTGGGTCATG
AAAAAAAAAAAAAAATAGCTCGAT ba read2 CGCTACGTGACTGGGTCATG
AAAAAAAAAAAAAAATAGCTCGAT ba read3 CGCTACGTGACTGGGTCATG
we only need columns 1 and 2. These two columns can be extracted from this dataset using **Cut** tool::
1 2
---------------------------
AAAAAAAAAAAAAAATAGCTCGAT ba
AAAAAAAAAAAAAAATAGCTCGAT ba
AAAAAAAAAAAAAAATAGCTCGAT ba
now one needs to count the number of unique occurencies of each tag. This is done using **Unique lines** tool, which would add an additional column containg counts (column 1)::
1 2 3
-----------------------------
3 AAAAAAAAAAAAAAATAGCTCGAT ba
these data can now be used in this tool.
**Output**
The output is one PDF file with the plots of the Hamming distance, a tabular file with the data of the plot for each dataset and a tabular file with the chimeric tags. The PDF file contains several panles:
1. This first page contains a graph representing the Hamming distance stratified by their family sizes.
2. The second page contains the same informations as the first page but it is plotted the other way around: a family size distribution which is stratified by the Hamming distance.
3. The third page contains the **first step** of the **chimera analysis**: HDs of the individual parts of the tags and their sums. First the tags are splitted into two halves (notated as a and b in the graph) and the minimum HD for part a (=HD a) is calculated. In the next step the data is subsetted by selecting only those tags that showed the minimum HD in half a. The HD of the second half is then calculated by comparing the b halves of the sample to the subset of halves from one step before and look for the maximum HD (=HD b'). Finally, the same approach is repeated but starts this time with the calculation of the minimum HD of part b (=HD b) followed by the calculation of the maximum HD of part a (=HD a') to identify all possible chimeras in the dataset.
4. The fourth page contains the **second step** of the **chimera analysis**: the absolute difference between the partial HDs (=delta HD). The HD of a chimeric reads is normally very different between its halves and therefore, the difference (=absolute delta) between those HDs should be very large, which would make it possible to identify chimeras from true molecules. To get a more accurate number of chimeric tags, the absolute difference that contributed to the maximum relative difference will be choosen since the calculation of the HDs of the parts was performed twice for each tag in the third step.
5. The fifth page contains the **third step** of the **chimera analysis**: the relative differences of the partial HDs (=relative delta HD). Since it is not known whether the absolute difference originates due to a low and a very large HD in both halves or one half is completely identical (HD=0) to a second molecule, the relative difference is calculated by dividing the absolute difference by the HD of the whole tag (=sum of the partial HDs). To get a more accurate number of chimeric tags, the maximum value will be choosen since the calculation of the HDs of the parts was performed twice for each tag in the third step. The plot can be interpreted as the following:
- Low relative differences indicate that the total HD is almost equal split up into partial HDs. This case would be expected, if all tags originate from different molecules.
- Higher relative differences occur either due to low total HDs and/or larger absolute differences, both things that indicate that 2 tags were originally the same tag.
- A relative difference of 1 means that one part of the tags is identical. Since it is very unlikely that by chance two different tags have a HD of 0 between one of their parts, the HDs in the other part are probably artificially introduced (chimeric reads).
6. The sixth page contains a graph representing the **HD of the chimeric tags** which is at the same time the HD of the non-identical halves of the chimeric tags with a relative difference of 1 from the previous page.
7. The last page is only generated when the parameter "only DCS in the analysis?" is **False**. The graph represents the **HD of the chimeric tags** which is at the same time the HD of the non-identical halves of the chimeric tags and indicates if they can form a DCS or not.
.. class:: infomark
**Note:**
It is possible that both halves of a chimera show a HD of 0 from two different tags. This means that their halves are identical to two different tags in one part of the tag and therefore, they show different HDs in the second part of the tag. In such a case the maximum HD will be selected in the plots but they are notated as the following example in the output file containing the chimeric tags (the identical part of the tag is marked with an asterix):
e.g. AAAAAAAAAAAT ATTCACCCTTGT
***AAAAAAAAAAAT*** ATCATAGACTCT and AAAAAAAAAAAA ***ATTCACCCTTGT***
**About Author**
Author: Monika Heinzl
Department: Institute of Bioinformatics, Johannes Kepler University Linz, Austria
Contact: monika.heinzl@edumail.at
]]>
@misc{duplex,
author = {Heinzl, Monika},
year = {2018},
title = {Development of algorithms for the analysis of duplex sequencing data}
}