This function splits a large matrix into smaller blocks with cols_per_chunk columns per block, and saves them as .rds files with prefix prefix

split_mat(mat, cols_per_chunk, prefix, overwrite = TRUE, verbose = TRUE)

Arguments

mat

The matrix to be split

cols_per_chunk

Number of columns per block

prefix

Prefix of output files

overwrite

Overwrite existing files (default TRUE)

verbose

Print progress updates

Examples

if (FALSE) {
afdat = packedancestrymap_to_afs('path/to/packedancestrymap_prefix', allpopulations)
split_mat(afdat$afs, cols_per_chunk = 20, prefix = 'afdat_split_v42.1/afs')
}