Releases: StoreyLab/bnpsd
Releases · StoreyLab/bnpsd
6th CRAN release: new tree intermediate subpopulations option, tree fitting, broad row/col name transfers, bug fixes
6th CRAN release: new tree intermediate subpopulations option, tree fitting, broad row/col name transfers, bug fixes
Latest
bnpsd 1.2.3.9000 (2021-02-16)
- Documentation updates:
- Fixed links to functions, in many cases these were broken because of incompatible mixed Rd and markdown syntax (now markdown is used more fully).
bnpsd 1.3.0.9000 (2021-03-24)
- Added support for intermediate subpopulations related by a tree
- New function
draw_p_subpops_treeis the tree version ofdraw_p_subpops. - New function
coanc_treecalculates the true coancestry matrix corresponding to the subpopulations related by a tree. - Function
draw_all_admixhas new argumenttree_subpopsthat can be used in place ofinbr_subpops(to simulated subpopulation allele frequencies usingdraw_p_subpops_treeinstead ofdraw_p_subpops). - Note: These other functions work for trees (without change) because they accept arbitrary coancestry matrices (param
coanc_subpops) as input, so they work if they are passed the matrix thatcoanc_treereturns:coanc_admix,fst_admix,admix_prop_1d_linear,admix_prop_1d_circular.
- New function
- Functions
admix_prop_1d_linearandadmix_prop_1d_circular, whensigmais missing (and therefore fit to a desiredcoanc_subpops,fst, andbias_coeff), now additionally return multiplicativefactorused to rescalecoanc_subpops.
bnpsd 1.3.1.9000 (2021-04-17)
It's Fangorn Forest around here with all the tree updates!
- Added these functions:
fit_treefor fitting trees to coancestry matrices!scale_treeto easily scale coancestry trees and check for out-of-bounds values.tree_additivefor calculating "additive" edges for probabilistic edge coancestry trees, and also the reverse function .- This already existed as an internal, unexported function used mainly by
coanc_tree, but now it's renamed, exported, and well documented!
- This already existed as an internal, unexported function used mainly by
- Added support of
$root.edgeto treephyloobjects passed to these functions:coanc_tree: edge is a shared covariance value affecting all subpopulations.draw_all_admixanddraw_p_subpops_tree: if root edge is present, functions warn that it will be ignored.
- Functions
admix_prop_1d_linearandadmix_prop_1d_circular: debugged an edge case wheresigmais small but not zero and numerically-calculated densities all come out to zero in a given row of theadmix_proportionsmatrix (foradmix_prop_1d_circularinfinite values also arise), which used to lead to NAs upon row normalization; now for those rows, the closest ancestry (by coordinate distance) gets assigned the full admixture fraction (just as for independent subpopulations/sigma = 0).
bnpsd 1.3.2.9000 (2021-04-22)
- Updated various functions to transfer names between inputs and outputs as it makes sense
- Functions
admix_prop_1d_linear,admix_prop_1d_circularnow copy names from the inputcoanc_subpops(vector and matrix versions, only required when fittingbias_coeff) to the columns of the outputadmix_proportionsmatrix. - Function
draw_genotypes_admixnow copies row and column names from input matrixp_ind(or rownames fromp_indand column names from the rownames ofadmix_proportionswhen the latter is provided) to output genotype matrix - Function
draw_p_subpopsnow copies names fromp_ancto rows, names frominbr_subpopsto columns, when present and of the right dimensions. - Function
draw_p_subpops_treenow copies names fromp_ancto rows. Names fromtree_subpopswere already copied to columns before. - All other functions already transferred names as desired/appropriate. Tests were added for these functions to ensure that this is so.
- Functions
- Updated various functions to stop if there are paired names for two objects that are both non-NULL and disagree, as this suggests that the data is misaligned or incompatible.
- Functions
coanc_admixandfst_admixstop if the column names ofadmix_proportionsand the names ofcoanc_subpopsdisagree. - Function
draw_all_admixstops if the column names ofadmix_proportionsand the names of eitherinbr_subpopsortree_subpopsdisagree. - Function
draw_genotypes_admix, whenadmix_proportionsis passed, stops if the column names ofadmix_proportionsandp_inddisagree. - Function
make_p_ind_admixstops if the column names ofadmix_proportionsandp_subpopsdisagree.
- Functions
- Function
tree_additivenow has optionforce, which whenTRUEsimply proceeds without stopping if additive edges were already present (intree$edge.length.add, which is ignored and overwritten).
bnpsd 1.3.3.9000 (2021-04-29)
New functions and bug fixes dealing with reordering tree edges and tips.
- Added function
tree_reindex_tipsfor ensuring that tip order agrees in both the internal labels vector and the edge matrix.
Such lack of agreement is generally possible (technically the tree is the same for arbitrary orders of edges in the edge matrix).
However, such a disagreement causes visual disagreement in plots (for example, trees are plotted in the order of the edge matrix, versus coancestry matrices are ordered as in the tip labels vector instead), which can now be fixed in general. - Added function
tree_reorderfor reordering tree edges and tips to agree as much as possible with a desired tip order.
The heuristic finds the exact solution if it exists, otherwise returns a reasonable order close to the desired order.
Tip order in labels and edge matrix agree (viatree_reindex_tips). - Function
fit_treenow outputs trees with tip order that better agrees with the input data, and tip order in labels vector and edge matrix now agree (viatree_reorder). - Several functions now work with trees whose edges are arbitrarily ordered, particularly when they do not move out from the root (i.e. reverse postorder):
- Function
tree_additive.
Before this bug fix, some trees could trigger the error message "Error: Node index 6 was not assigned coancestry from root! (unexpected)", where "6" could be other numbers. - Function
draw_p_subpops_tree.
Before this bug fix, some trees could trigger the error message "Error: The root node index intree_subpops$edge(9) does not matchk_subpops + 1(6) wherek_subpopsis the number of tips! Is thetree_subpopsobject malformed?", where "9" and "6" could be other numbers. Other possible error messages contain "Parent node index 6 has not yet been processed ..." or "Child" instead of "Parent", where "6" could be other numbers. - Internal functions used by
fit_treehad related fixes, but overallfit_treeappears to have had no bugs because users cannot provide trees, and the tree-building algorithm does not produce scrambled edges that would have caused problems.
- Function
bnpsd 1.3.4.9000 (2021-05-12)
- Functions
fixed_locianddraw_all_admixhave a new parametermaf_minthat, when greater than zero, allows for treating rare variants as fixed.
Indraw_all_admix, this now allows for simulating loci with frequency-based ascertainment bias.
bnpsd 1.3.5.9000 (2021-05-14)
- Fixed a rare bug in
draw_all_admixthat could cause a "stack overflow" error.
The function used to call itself recursively ifrequire_polymorphic_loci = TRUE, and in cases where there are very rare allele frequencies or highmaf_minthe number of recursions could be so large that it triggered this error.
Now the function has awhileloop, and does not recurse more than one level at the time; there is no limit to the number of iterations and no errors occur inherently due to large numbers of iterations.
bnpsd 1.3.6.9000 (2021-06-02)
- Function
fit_treeinternally simplified to usestats::hclust, which also results in a small runtime gain.
The new code (whenmethod = "mcquitty", which is default) gives the same answers as before (in other words, the original algorithm was a special case of hierarchical clustering).- New option
methodis passed tohclust.
Although allhclustmethods are allowed, for this application the only ones that make sense are "mcquitty" (WPGMA) and "average" (UPGMA).
In internal evaluations, both algorithms had similar accuracy and runtime, but only "mcquitty" exactly recapitulates the original algorithm.
- New option
bnpsd 1.3.7.9000 (2021-06-04)
- Updated citations in
inst/CITATION(missed last time I updated them in other locations).
bnpsd 1.3.8.9000 (2021-06-21)
- Added function
undiff_affor creating "undifferentiated" allele frequency distributions based on real data but with a lower variance (more concentrated around 0.5) according to a given FST, useful for simulating data trying to match real data. - Added
LICENSE.md. - Reformatted this
NEWS.mdslightly to improve its automatic parsing.
bnpsd 1.3.9.9000 (2021-06-22)
- Function
undiff_af:- Added several useful informative statistics to return list:
F_max,V_in,V_out,V_mix, andalpha. - Debugged
distr = "auto"cases where mixing variance ended up being smaller than required due to roundoff errors (alphais now larger than given in direct formula byeps = 10 * .Machine$double.eps, which is also a new option.
- Added several useful informative statistics to return list:
bnpsd 1.3.10.9000 (2021-06-22)
- Function
draw_all_admixadded optionp_anc_distrfor passing custom ancestral allele frequency distributions (as vector or function).
This differs from the similar preexisting optionp_anc, which fixed ancestral allele frequencies per locus to those values.
These two options behave differently when loci have to be re-drawn due to being fixed or having too-low MAFs: passingp_ancnever changes those values, whereas passingp_anc_distrresults in drawing new values as necessary.
The new option is more natural biologically and results in re-drawing fixed loci less often.
bnpsd 1.3.11.9000 (2021-07-01)
- Function
undiff_afrenamed parameterFtokinship_mean, and updated all documentation to reflect the correction that ...
5th CRAN release: Improved documentation, minor updates
2020-01-08 - bnpsd 1.2.1.9000
- Added option
p_ancto functiondraw_all_admix, to specify desired ancestral allele frequencies instead of having the code generate it randomly (default). - Added details for documentation of function
draw_p_subpops.R, clarifying that inputp_anccan be scalar.
2021-01-21 - bnpsd 1.2.2.9000
- Function
draw_all_admix: when optionp_ancis provided as scalar andwant_p_anc = TRUE, now the return value is always a vector (in this case the input scalar value repeatedm_locitimes). The previous behavior was to returnp_ancas scalar if that was the input, which could be problematic for downstream applications.
2021-02-11 - bnpsd 1.2.3
- 5th CRAN submission
- Functions
admix_prop_1d_linearandadmix_prop_1d_circularhad these changes:- The optional parameters
bias_coeff,coanc_subpopsandfstnow have default values (ofNA,NULL, andNA, respectively) instead of missing, and these "missing" values can be passed to get the same behavior as if they hadn't been passed at all. - Their documentation has been clarified.
- Improved internal code to handle edge case
bias_coeff = 1(to fix an issue only observed on Apple M1).
- The optional parameters
- Function
admix_prop_indep_subpops: default value for the optional parametersubpopsis now made more clear in arguments definition. - Simplified documentation (most functions) by clarifying language, using markdown roxygen, and replacing all LaTeX equations with simpler code equations.
- Updated paper citations in
DESCRIPTION,README.mdand the vignette, to point to the published method in PLoS Genetics.
4th CRAN release: better mem usage, removed deprecated function names
2019-06-05 - bnpsd 1.1.2
- Non-code changes:
- Edited .Rbuildignore to stop ignoring README; also removed non-existent files from list
- Removed unused .travis.yml and bnpsd.Rproj files
2019-08-13 - bnpsd 1.1.2.9000
- Improved memory efficiency of default
draw_genotypes_admix- Old approach was by default very memory-hungry (created IAF matrix whole when admixture proportions were provided).
Thelow_memoption could be set but filled slowly by locus only. - New approach is always low-memory (so the explicit option was removed).
This was made faster by filling by individual when there are fewer individuals than loci, or filling by locus otherwise, therefore always vectorizing as much as possible.
Test showed this was always as fast as the original full memory approach, so the latter was removed as an option.
- Old approach was by default very memory-hungry (created IAF matrix whole when admixture proportions were provided).
draw_all_admixis also now automatically low-memory wheneverwant_p_ind = FALSE, and the explicitlow_memoption has also been removed.- Updated documentation to use RMarkdown
- Other code tidying
2019-09-06 - bnpsd 1.1.3.9000
- Added option
betain functiondraw_p_ancto trigger a symmetric Beta distribution for the ancestral allele frequencies, with the desired shape parameter.
Thebetaoption can also be set on the wrapper functiondraw_all_admix.
This option allows simulation of a distribution heavier on rare variants (whenbetais much smaller than 1), more similar to real human data.
2019-12-17 - bnpsd 1.2.0
- Fourth CRAN submission.
- Removed deprecated function names:
q1dc,q1d,qis,coanc,rbnpsd,rgeno,rpanc,rpint,rpiaf. - Moved logo to
man/figures/ - Minor Roxygen-related updates.
2020-01-08 - bnpsd 1.2.1
- Fourth CRAN submission, second attempt.
- Fixed a rare bug in
bias_coeff_admix_fit, which caused it to die if the desired bias coefficient was an extreme value (particularly1).
The error message was:f() values at end points not of opposite sign.
The actual bug was not observed in the regular R build, but rather in a limited precision setting where R was configured with--disable-long-double.
3rd CRAN release, massive naming style normalization
2019-02-13 - bnpsd 1.0.4.9000
- Converted the vignette from PDF to HTML
2019-04-11 - bnpsd 1.0.5.9000
qisnow returns a numeric admixture proportions matrix (used to be logical).q1dandq1dcnow handlesigma = 0special case.q1dandq1dcnow provide more informative out-of-bounds messages whensigmais missing (andsis provided)sigmaroot finding inq1dandq1dc(whensis provided) is now more robust, explicitly tested at boundaries (mins > 0achieved atsigma = 0and maxs = 1achieved atsigma = Inf).- Removed arguments
intervalandtolfrom bothq1dandq1dc(users would never need to set them now that procedure is more robust).
- Removed arguments
- Updated coding style, renamed some internal functions and variables.
2019-04-16 - bnpsd 1.1.0.9000
- Renamed most functions for clarity:
coanc->coanc_admixq1d->admix_prop_1d_linearq1dc->admix_prop_1d_circularqis->admix_prop_indep_subpopsrpanc->draw_p_ancrpint->draw_p_subpopsrpiaf->make_p_ind_admixrgeno->draw_genotypes_admixrbnpsd->draw_all_admixfst->fst_admix(no deprecated version available in this case, to eliminate conflict withpopkin::fst)- Functions with old names remain for now as deprecated functions (to be removed in the future).
- Renamed several recurrent argument names for clarity:
Q->admix_proportionsF->coanc_subpops(if general matrix is accepted),inbr_subpops(vector or scalar versions required)s->bias_coeffw->weightsTheta->coancestrym->m_locin->n_indk->k_subpopspAnc->p_ancB->p_subpopsP->p_ind- Deprecated functions still accept old argument names.
- Fixed a
sigma = 0bug inadmix_prop_1d_circular. - Changed default values for
draw_all_admix(compared to deprecatedrbnpsd, which retains old defaults):require_polymorphic_loci(oldnoFixed) is nowTRUEby default.want_p_indandwant_p_subpops(oldwantPandwantB) are nowFALSEby default.- Names (following above conventions) and order of items in return list changed.
draw_p_subpopsnow admits scalar inputsp_ancandinbr_subpops, while number of loci and number of subpopulations can be provided as additional options.- Added more input checks to functions, informative error messages.
- Updated documentation, particularly on whether intermediate subpopulation coancestries are accepted generally (
coanc_subpops) or if the diagonal matrix case is required (specified as vector or scalarinbr_subpops).
2019-05-15 - bnpsd 1.1.1
- Third CRAN submission.
- Added ORCIDs to authors.
- Corrected doc typos.
- Adjusted layout of subpopulations and individuals (default limits) for circular 1D geography (
admix_prop_1d_circular) to prevent overlapping individuals on the edges, and to better agree visually with the linear version (admix_prop_1d_linear).
Second CRAN accepted submission
2018-02-01 - bnpsd 1.0.1.9000
- README.md now contains instructions for installing from CRAN as well as from GitHub.
2019-02-06 - bnpsd 1.0.2.9000
-
Added option
noFixedto functionrbnpsdto redraw loci that were drawn fixed for a single allele.
These loci are not polymorphic so they would normally not be considered in analyses. -
Added function
fixed_locito test for fixed loci within rbnpsd.
2019-02-07 - bnpsd 1.0.3.9000
- Added function
coanc_to_kinshipto easily obtain kinship matrices from coancestry matrices.
2019-02-11 - bnpsd 1.0.4
- Second CRAN submission.
First CRAN accepted submission
2017-09-11 - bnpsd 1.0.0.9000
- Public release!
2018-01-15 - bnpsd 1.0.1
- Minor non-code changes for first CRAN submission.