A new block begins at the SNP after the first SNP which is not within blgsize
of the start of the last block.
dat
needs to be ordered first by 'CHR', then by 'POS' or 'cm'
get_block_lengths(dat, blgsize = 0.05, cpp = TRUE, verbose = TRUE)
Data frame with columns 'CHR' and either 'POS' or 'cm'
SNP block size in Morgan. Default is 0.05 (5 cM). If blgsize
is 100 or greater, if will be interpreted as base pair distance rather than centimorgan distance.
Should the faster C++ version be used?
Print progress updates
A numeric vector where the ith element lists the number of SNPs in the ith block.
if (FALSE) {
prefix = 'path/to/packedancestrymap_prefix'
pops = c('pop1', 'pop2', 'pop3')
afdat = packedancestrymap_to_afs(prefix, pops = pops)
block_lengths = get_block_lengths(afdat)
}