Hello Luis,
Thank you for the suggestion. It appears installing the development version then running gl.filter.maf resolves the issue, but only temporarily.
After initially loading dartR, the functions will work with the test data, then after a run my study data, they will cease to work until I restart R.
Processing genlight object with SNP data
Warning: genlight object contains monomorphic loci
Completed: gl.filter.maf
/// GENLIGHT OBJECT /////////
> gl.filter.maf(study.data)
Error in slot(x, name) : no slot of name "maf" for this object of class "genlight"
This also appears elsewhere in my script.
For example, if I do not include population data gl.filter.maf returns an error (see below). I can generally avoid this error, by adding population data, but then I encounter the aforementioned error.
I've tried removing the population data from the testset, and it functions normally. However, after executing the function on my data, repeating the same function with the testset then returns an error.
> testset.gl@pop <- NULL
> gl.filter.maf(testset.gl)
Starting gl.filter.maf
Processing genlight object with SNP data
Population assignments not detected, individuals assigned to a single population labelled 'pop1'
Warning: genlight object contains monomorphic loci
Completed: gl.filter.maf
/// GENLIGHT OBJECT /////////
# Attempt to run my analysis
[...]
Error in .seppop_internal(x = x, pop = pop, treatOther = treatOther, keepNA = keepNA, :
pop not provided and pop(x) is empty
> gl.filter.maf(testset.gl)
Starting ::
Starting dartR
Starting gl.report.maf
Processing genlight object with SNP data
Starting ::
Starting dartR
Starting gl.report.maf
Error in .seppop_internal(x = x, pop = pop, treatOther = treatOther, keepNA = keepNA, :
pop not provided and pop(x) is empty
7. stop("pop not provided and pop(x) is empty")
6. .seppop_internal(x = x, pop = pop, treatOther = treatOther, keepNA = keepNA,
quiet = quiet, ...)
5. .local(x, ...)
4. seppop(x)
3. seppop(x)
2. dartR::gl.report.maf(x) at gl.filter.maf.R#28
1. gl.filter.maf(testset.gl)
It seems as though running my analysis is somehow compromising the dartR functions, but the only steps that use dartR in this script merely pipe a genelight object to a series of functions.
> x
/// GENLIGHT OBJECT /////////
// 91 genotypes, 104,285 binary SNPs, size: 90.6 Mb
1796565 (18.93 %) missing data
> x %>%
gl.filter.reproducibility(t = genetic_data_parameters$repavg_threshold, v = 3) %>%
gl.filter.callrate(method = "loc", threshold = genetic_data_parameters$locus_callrate_threshold, v = 3) %>%
gl.filter.secondaries(method = genetic_data_parameters$sec_method, v = 3) %>%
gl.filter.maf(threshold = genetic_data_parameters$min_maf, v = 1) %>%
gl.filter.callrate(method = "ind", threshold = genetic_data_parameters$sample_callrate_threshold, v = 3)
Cheers,
Adam