Class to downsample a BAM file while respecting that we should either get rid
of both ends of a pair or neither end of the pair. In addition, this program uses the read-name
and extracts the position within the tile whence the read came from. The downsampling is based on this position.
Note 1: This is technology and read-name dependent. If your read-names do not have coordinate information, or if your
BAM contains reads from multiple technologies (flowcell versions, sequencing machines) this will not work properly.
This has been designed with Illumina MiSeq/HiSeq in mind.
Note 2: The downsampling is _not_ random. It is deterministically dependent on the position of the read within its tile. Specifically,
it draws out an ellipse that covers a FRACTION fraction of the area and each of the edges and uses this to determine whether to keep the
record. Since reads with the same name have the same position (mates, secondary and supplemental alignments), the decision will be the same for all of them.
Finally, the code has been designed to simulate sequencing less as accurately as possible, not for getting an exact downsample fraction.
In particular, since the reads may be distributed non-evenly within the lanes/tiles, the resulting downsampling percentage will not be accurately
determined by the input argument FRACTION. One should re-MarkDuplicates after downsampling in order to "expose" the duplicates whose representative has
been downsampled away.