Skip to content

Commit

Permalink
Increment version to 2.6.0; update NEWS
Browse files Browse the repository at this point in the history
  • Loading branch information
magnusdv committed Mar 30, 2024
1 parent eb832b5 commit 752b571
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: pedtools
Title: Creating and Working with Pedigrees and Marker Data
Version: 2.5.0.9000
Version: 2.6.0
Authors@R:
person("Magnus Dehli", "Vigeland", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-9134-4962"))
Expand Down
12 changes: 7 additions & 5 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
# dev
# pedtools 2.6.0

This is a large release with several new features, including a few (relatively minor) breaking changes.

## Breaking changes

* In pedigree plots, Long labels are now automatically folded to an approximate width of 12 characters by default. Use the new argument `foldLabs` to adjust the folding width, or to switch off folding (`foldLabs = FALSE`).
* In pedigree plots, long labels are now automatically folded to an approximate width of 12 characters by default. Use the new argument `foldLabs` to adjust the folding width, or to switch off folding (`foldLabs = FALSE`).

* When adding children or parents to a pedigree, the default labelling of new individuals has been simplified. The new labels are now always the smallest integers not already in use. (Previous versions used "NN_1", "NN_2", etc for pedigrees with nonnumeric labels.)
* When adding children or parents to a pedigree, the default labelling of new individuals has been simplified. The new labels are now always the smallest integers not already in use. (Previous versions used "NN_1", "NN_2", etc for pedigrees with non-numeric labels.)

* `labels(x)` now always returns a character vector, also when `x` is a list of pedigrees. Use `labels(x, unlist = FALSE)` to retain the old behaviour.

## New features

* `addChildren(x, ...)` and friends now works across components of `x`, when `x` is a list of pedigrees. For instance: `singletons(1:2, sex = 1:2) |> addSon(1:2)`.
* `addChildren(x, ...)`, and its companions `addSon()` and `addDaughter()`, now works across components of `x`, when `x` is a list of pedigrees. For instance, this now works as expected: `singletons(1:2, sex = 1:2) |> addSon(1:2)`.

* New function `addChild()` is similar to `addSon()` and `addDaughter()`, but allows the sex to be set programmatically, also to `sex = 0`.

* `plot.ped()` gains argument `textAnnot` allowing highly customisable text annotations around and inside pedigree symbols.

* `ancestors()`, `descendants()`, `commonAncestors()` and `commonDescendants()` gain a new argument `maxGen` indicating to limit the analysis to a given number of generations.
* `ancestors()`, `descendants()`, `commonAncestors()` and `commonDescendants()` gain a new argument `maxGen` limiting the analysis to the given number of generations.

* `transferMarkers()` gains the argument `checkAttrs` for checking consistency of marker attributes across pedigree components.

Expand Down
2 changes: 1 addition & 1 deletion R/ped_utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ generateLabs = function(x, n = 1, avoid = NULL, prefix = "") {
.mysetdiff(cand, taken)[seq_len(n)]
}

# TODO: Delete?
# TODO: Delete - no longer used. Replaced by generateLabs
# Utility function for generating numbered "NN" labels.
# Returns "NN_i" where i increments largest j occurring as NN_j, NN.j or NN-j in input.
nextNN = function(labs) { # labs a character vector
Expand Down
6 changes: 3 additions & 3 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ listIdentical = function(x) {


# Fold a single string at roughly the given width; try to break at nice places
# TODO: Not optimised (and probably reinventing the wheel here).
# Better idea: Start with strsplit(s, "")
# Not optimised, and probably reinventing the wheel here.
# Perhaps better idea: Start with strsplit(s, "")
smartfold = function(s, width = 10, breakAt = c(' ', '-', '.', ':', ')', ']')) {
width = as.integer(max(width, 2))
nch = nchar(s)
Expand All @@ -153,7 +153,7 @@ smartfold = function(s, width = 10, breakAt = c(' ', '-', '.', ':', ')', ']')) {
res = character(0)
remaining = s
while(nch >= width + 3) {
b = width # default next brea, if no better
b = width # default next break, if no better
for (ch in breakAt) {
pos = gregexpr(ch, remaining, fixed = TRUE)[[1]] |> as.integer() # all positions
goodpos = pos[pos >= width - 2 & pos <= width + 3 & pos <= nch - 3]
Expand Down

0 comments on commit 752b571

Please sign in to comment.