Removes CpG sites from the object if they overlap with common SNPs

remove_snps(
  m,
  populations = NULL,
  maf_threshold = 0.01,
  reduce_filtering = FALSE,
  forced = FALSE,
  keep = FALSE,
  n_chunks = 1,
  n_cores = 1
)

Arguments

m

methrix object

populations

Populations to use. Default is all.

maf_threshold

The frequency threshold, above which the SNPs will be removed. Default is 0.01

reduce_filtering

If TRUE, the SNPs with a MAF < 0.1 will be evaluated and only the highly variable ones will be removed. Default FALSE.

forced

the reduce_filtering is not recommended with less than 10 samples, but can be forced. Default is FALSE.

keep

Do you want to keep the sites that were filtered out? In this case, the function will return with a list of wo methrix objects.

n_chunks

Number of chunks to split the methrix object in case it is very large. Can only be used if input data is in HDF5 format. Default = 1.

n_cores

Number of parallel instances. Can only be used if input data is in HDF5 format. n_cores should be less than or equal to n_chunks. If n_chunks is not specified, then n_chunks is initialized to be equal to n_cores. Default = 1.

Value

methrix object or a list of methrix objects

Details

Takes methrix object and removes common SNPs. SNPs overlapping with a CpG site and have a minor allele frequency (MAF) above a threshold in any of the populations used will be selected and the corresponding CpG sites will be removed from the methrix object. With the reduce_filtering option, SNPs with MAP < 0.1 will be further evaluated. If they show low variance in the dataset, there is probably no genotype variability in the population, therefore the corresponding CpG site won't be removed. Please keep in mind that variance thresholds are

Examples

data('methrix_data') remove_snps(m = methrix_data, maf_threshold=0.01)
#> Used SNP database: MafDb.1Kgenomes.phase3.hs37d5.
#> Number of SNPs removed:
#> chr N #> 1: chr21 42 #> 2: chr22 39
#> Sum:
#> [1] 81
#> -Finished in: 3.061s elapsed (3.026s cpu)
#> An object of class methrix #> n_CpGs: 662 #> n_samples: 4 #> is_h5: FALSE #> Reference: hg19