valr
valr copied to clipboard
option for shuffle to maintain spacing
from the paper:
The p-value and the direction of difference from the null hypothesis (that the positions of
Q
andR
are independent) are obtained by permutation. Each permutation randomizes the query intervals uniformly across the chromosome, maintaining the spacing between intervals.
emphasis added. seems like a reasonable option for bed_shuffle()
.
the easiest way to do this would be:
- calculate interval spacing
- pick a random start for the first interval
- use the spacings to set the coordinates for the other intervals.
would need to deal with spacing per chromosome, and also make sure that all intervals on a chrom are in-bounds, given the random start.
for simplicity, the above should probably ignore incl
and excl
params. and issue a message to that effect.
Could also pick a random offset with the spacing dists, using that as the first and then circling back when the end is reached.
closing for now