This function creates a count table of ChIP sequencing data
(supplied as sorted bam files) using a non-overlapping partition across
the genome.
The fragment length (if not provided) is estimated using the
cross-correlation method of Ramachandran et al (2013). A fragment length
is estimated for each sample, after removing duplicate reads, by taking the
average over all chromosomes in the sample. Estimation is performed at 5 bp
resolution and restricted to a minimum fragment length of 50 bp and maximum
of 600 bp.
The bin size (if not provided) is selected using a procedure by Shimazaki
and Shinomoto (2007) based on minimizing the mean-integrated squared error
for a time-dependent Poisson point process. This procedure is applied to
each ChIP sample (at 5 bp resolution, restricted to a minimum of 50 bp and
maximum of 1000 bp), and the minimum across all ChIP samples is returned as
the bin size.
For a given sample and window, the count is determined as the number of
fragments overlapping the window.