magnusdv / pedtools

Tools for working with pedigrees in R
GNU General Public License v3.0
23 stars 3 forks source link

`distributeMarkers` and `dist` argument #35

Closed thoree closed 2 months ago

thoree commented 2 years ago

Return an error or only one marker if dist exceeds the the total chromosome length?:

library(pedtools) x = distributeMarkers(nuclearPed(), dist = 3000, prefix = "M") getMap(x)

> CHROM MARKER MB

> 1 1 M1 0

> 2 2 M2 0

> 3 3 M3 0

> 4 4 M4 0

> 5 5 M5 0

> 6 6 M6 0

> 7 7 M7 0

> 8 8 M8 0

> 9 9 M9 0

> 10 10 M10 0

> 11 11 M11 0

> 12 12 M12 0

> 13 13 M13 0

> 14 14 M14 0

> 15 15 M15 0

> 16 16 M16 0

> 17 17 M17 0

> 18 18 M18 0

> 19 19 M19 0

> 20 20 M20 0

> 21 21 M21 0

> 22 22 M22 0

Created on 2022-03-29 by the reprex package (v2.0.1)

magnusdv commented 2 years ago

There are (at least) two natural ways to interprete dist:

1) Imagine the chromosomes being glued together as a long string, and place markers every dist units apart. 2) On each chromosome, place a marker at one end, and then every dist units apart.

Method 1) always gives floor(L/dist) + 1 markers, where L is the sum of chromosome lengths. On the other hand, it uses a nonsensical notion of distance between loci on different chromosomes.

Method 2) always gives at least one marker per chromosome. This is the approach currently implemented.

I guess I could include 1) also if it turns out to be important.