source tree location: src/hg/randomPlacement/
It helps to draw a picture as you read this to see how it works. (to be done: add image to demonstrate)
- You have a set of non-overlapping items of varying length that are currently sitting on the genome in their initial locations. These are defined with a bed file.
- There is a set of "bounding regions" that define where these items are not allowed to be. The items are allowed to exist anywhere in the gaps between these bounding regions. When the randomization simulation is done, these gaps between the bounding regions are where they are allowed to be randomly placed. They always remain non-overlapping as they are randomly placed. These bounding regions are defined with a bed file.
- The distance measurement is done between all the placed items and their nearest neighbor bounding region. They are measured as they initially sit, and after randomized placement to determine if they have a different measurement after randomization. The distance measured is from either end of the placed item, whichever is closer to one of the bounding region elements.
- As an alternative for distance measurement instead of to the bounding regions, a third bed file can be given that is used as items to measure distance to while still within the limitation of being placed inside the bounding regions.