-
New function
swapGenotypes()
for swapping the genotypes of two individuals. -
New plot argument
line.main
for title placement. -
cousinPed()
andhalfCousinPed()
gain argumentsymmetric
, which if TRUE gives a symmetric shape when plotted (female line on the left side; male line of the right).
-
plot.ped()
gains a new argument,spouseOrder
, to specify the display order of spouses. -
readPed()
andas.ped()
now include aaddMissingFounders
argument, supporting pedigree files where (some or all) founders are not explicitly listed (i.e., entries in thefid
ormid
columns that do not appear in theid
column). -
readPed()
andas.ped()
now also feature asexCodes
argument, accommodating pedigree files where sex is indicated by codes other than the standard 0 (unknown), 1 (male), 2 (female). -
reorderPed()
has improved flexibility, allowing the reordering of a subset of the pedigree. -
selfingPed()
now accepts a vector of ID labels as the first argument. (Previously, only the number of selfings could be given.) -
The plotting argument
showEmpty
, controlling the appearance of missing genotypes, now accepts a function, e.g.leaves()
.
-
getComponent()
behaves better when the pedigree has only one component. -
ped()
checks for illegalsex
entries earlier than before, thus avoiding certain (rare) problems. -
Brush up on code and documentation.
This is a large release with several new features, including a few (relatively minor) 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
). -
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 whenx
is a list of pedigrees. Uselabels(x, unlist = FALSE)
to retain the old behaviour.
-
addChildren(x, ...)
, and its companionsaddSon()
andaddDaughter()
, now works across components ofx
, whenx
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 toaddSon()
andaddDaughter()
, but allows the sex to be set programmatically, also tosex = 0
. -
plot.ped()
gains argumenttextAnnot
allowing highly customisable text annotations around and inside pedigree symbols. -
ancestors()
,descendants()
,commonAncestors()
andcommonDescendants()
gain a new argumentmaxGen
limiting the analysis to the given number of generations. -
transferMarkers()
gains the argumentcheckAttrs
for checking consistency of marker attributes across pedigree components. -
New function
.setSNPfreqs()
for modifying allele frequencies when all markers are biallelic. (Experimental; not yet exported.)
-
addSon()
andaddDaughter()
now fail more gracefully if a parent ID is duplicated. -
Fixed regression error in
selectMarkers()
.
-
New functions
maskPed()
andunmaskPed()
for anonymising pedigree data, and restoring them. -
New function
setAlleleLabels()
for changing the allele labels of a marker. -
The
.pedScaling()
gains argumentsautoScale
andminsize
. -
readPed()
gains argumentcolSkip
, useful e.g., when reading .ped files with an AFF column. -
The
relabel()
function for relabelling individuals now allows the argumentnew
to be a function, taking theold
labels as input. For instance,relabel(x, toupper)
gives upper-case labels for everyone.
- Preserve the class attribute of
MARKERS
when subsetting.
-
The
plot()
method now handles general (unnested) lists ofped
objects. This means that, for instance, withx = list(nuclearPed(1), cousinPed(1), singleton(1))
, the commandplot(x)
simply works. Previously all ped lists had to be handled byplotPedList()
. (This is still needed for finer control of each component, and with nested lists.) -
nMarkers()
andhasMarkers()
have a new argumentcompwise
for more detailed output for ped lists. -
linearPed(0)
now produces a singleton (instead of an error). -
setAfreq()
now automatically updates the mutation model of the affected marker, if present. -
readFreqDatabase()
now accepts frequency files using the long format of MERLIN. -
readFreqDatabase()
gains a logical argumentscale1
, which, if TRUE, scales all vectors to sum 1.
-
New function
singletons()
for creating a list of singletons. -
New S3
summary()
method handling lists of (possibly disconnected) pedigrees. -
setGenotype()
can set the genotype of multiple individuals or markers in the same call. Also, individuals can be specified with selector functions likeleaves()
andfounders()
, as in:nuclearPed() |> addMarker() |> setGenotype(ids = founders, geno = "1/2")
. -
plot.ped()
gains argumenttrimLabs
, defaulting to TRUE, which removes line breaks at the start of ID labels. For example:nuclearPed() |> addMarker(geno = c("a/a", "b/b", NA)) |> plot(marker = 1, labs = "1")
. (Compare withplot(..., trimLabs = F)
.) -
The
showEmpty
argument ofplot.ped()
is more user friendly, allowing for instance:nuclearPed() |> addMarker() |> plot(marker = 1, showEmpty = "1")
. -
readFreqDatabase()
gains an optional argumentdf
, a data frame of allele frequencies in either "list" or "allelic ladder" format. This is useful in cases where the raw data must be read or modified manually for some reason. -
Add CITATION file.
- Forgotten argument
strict
insetAfreq()
for pedlists. - Fix glitch affecting
textAbove
andtextInside
. - Fix
title
in (still experimental)plot.list()
. - Fixed interpretation of marker names in
setMarkers(x, alleleMatrix)
.
-
The pedprobr function
setMutationModel()
has been moved to pedtools and renamed tosetMutmod()
. Unlike its predecessor, this has a new argumentupdate
, allowing to update existing models (i.e., leaving unspecified parameters unchanged) instead of creating new models from scratch. -
In
swapSex()
andsetSex()
, theids
parameter may now be the name of a selector function operating on the input pedigree. This is convenient when piping; for example,x |> setSex(ids = leaves, sex = 0)
sets unknown sex for all leaves ofx
. -
print.ped()
now returns theped
object (not the data frame, as before) invisibly. -
plot.ped()
gains new argumentsfill
,lty
,lwd
andhatchDensity
. -
generations()
have been rewritten, with new parameterwhat
. -
addMarker()
gains argumentlocusAttr
.
-
Fixed a bug in
randomPed()
, which caused the function to run out of mating options sometimes. -
The pedigree plot alignment fails in some cases (see mayoverse/kinship2#13). When this happens the plot method reverts to DAG mode and gives a warning.
-
The
plot.ped()
method has been internally refactored into 5 functions. Three of these calculate various parameters:.pedAlignment()
,.pedScaling()
and.pedAnnotation()
. The remaining two,drawPed()
and.annotatePed()
actually draw stuff on the graphics device. As indicated by the dot prefixes, these functions are primarily intended for internal use. Nevertheless, they are documented and exported, to make them available for other packages requiring special plot methods. (For example, the latest version ofibdsim2::haploDraw()
use this to compute automatic margins.) -
The function
randomPed()
has been completely rewritten, ensuring that the output is always a connected pedigree. The new version takes as input the total pedigree size (n) and the number of founders (f). -
removeIndividuals()
gains an argumentremove
, taking as value either "ancestors" or "descendants" (possibly abbreviated. The default value ("descendants") behaves as the previous version. A typical application ofremove = "ancestors"
is to remove founders, as inlinearPed(2) |> removeIndividuals(1, remove = "anc")
. -
Both
relabel()
andremoveIndividuals()
gain an argumentreturnLabs
. If TRUE, the functions return a vector of the pedigree members about to be modified/removed, instead of actually performing any changes. -
Pedigree construction is generally faster, due to various code improvements. Also,
ped()
gains an argumentdetectLoops
, which if set to FALSE may cut runtime significantly in some cases. -
New function
setFounderInbreeding()
, which is more flexible (and pipe friendly!) than the previousfounderInbreeding<-()
. The latter will continue to exist. -
More informative
summary()
for pedigrees.
This version introduces a number of changes in the pedigree plotting. The alignment of individuals is still done with kinship2
, but the calculation of scaling, margins and symbol sizes are now done in pedtools. As a result, pedigrees plotted with old code may look slightly different.
-
Pedigree symbols should always have the same height/width (e.g., perfect squares for males). Previously, symbols were squished in many cases, sometimes heavily so.
-
Pedigrees now always span the entire plot region, which was often not the case before.
-
Plotting of singletons has been completely rewritten, and is now done in
plot.ped()
. The previous methodplot.singleton()
has been removed. As a result, singleton plots are much more consistent and appear centred in the plot region. -
Some efforts are done to prevent unneeded duplication of founders, for instance in the case of 3/4-siblings:
nuclearPed(2) |> addSon(3) |> addSon(4:5) |> plot()
-
The default plot margins have been set to 1.
-
plotPedList()
is better at guessing relative widths. -
Several minor tweaks in
plotPedList()
in response to changes inplot.ped()
. -
The function
relabel()
now has "asPlot" as default, i.e., using the numerical plot order.
-
Pedigrees can now be plotted as directed acyclic graphs (DAGs), by adding
arrows = TRUE
inplot()
. -
Plotting pedigrees with selfing is now supported, by automatically switching to DAG mode.
-
The argument
margins
inplot()
now accepts a single number, making it more user friendly. The default,margins = 1
corresponds topar(mar = c(1,1,1,1))
.
-
Reset graphical parameters after
plotPedList()
-
New function
avuncularPed()
for creating aunt/uncle - nephew/niece pedigrees. -
New function
addAllele()
for extending the allele set of a marker. -
addSon()
andaddDaughter()
are now more flexible. The previous argumentparent
has been renamed toparents
and accepts one or two parents in any order. -
mergePed()
has been overhauled. In particular the new argumentby
makes it much more user friendly. -
setAfreq()
gains argumentstrict
.
-
Minor improvements of README and vignette.
-
Fixed bug in
setGenotype()
when setting multiple markers. -
Fixed bug ignoring alleles in
distributeMarkers()
.
-
pedtools now depends on R 4.1 (or later) because of the pipe operator
|>
. -
New function
setSNPs()
for creating and attaching a set of SNP markers with given positions and allele frequencies. -
New function
distributeMarkers()
for creating and attaching equal markers evenly across a set of chromosomes (by default, the human autosomes). -
New function
halfSibTriangle()
implementing an interesting breeding pattern.
-
transferMarkers()
now ignores members of unknown sex when checking compatibility. -
Fixed bug in
addMarker()
when input is a list of pedigrees. -
Fixed glitches in
setMap()
.
-
Various improvements in code and docs.
-
Added many tests.
-
Rewrite README example to show piping.
The main theme of this version is to make pedtools
more adapted to piping, e.g., allowing chains of commands like nuclearPed() |> addSon(1) |> addMarker(alleles = 1:2)
.
-
New functions
setAfreq()
,setChrom()
,setGenotype()
,setMarkername()
,setPosition()
for modifying marker attributes. These are alternatives to the previous in-place modifiersafreq<-()
a.s.o.. -
New function
addMarker()
which simplifies that common task of creating and attaching a single marker. The commandaddMarker(x, ...)
is equivalent toaddMarkers(x, marker(x, ...))
. -
The new
addMarker()
accepts ped lists, so that one can write e.g.list(singleton(1), singleton(2)) |> addMarker("1" = "a/b", alleles = c("a", "b"))
-
readPed()
gains the argumentcolSep
, which fixes the previous inability to handle names with spaces. -
New function
descentPaths()
, mostly intended for use in other pedsuite packages. -
relabel(x, new = "generations")
now gives automatic, generation-aware labelling: I-1, I-2, II-1, ... -
generations()
gains argumentmaxOnly
, by default TRUE. If FALSE, the function returns the generation number of each individual.
-
New function
generations()
for counting generations in pedigrees. -
New function
newMarker()
(mostly for internal use). -
plot.ped()
gains a new parametertwins
. -
father()
andmother()
now accepts ped lists as input. -
Added info and links to pedsuite in README.
-
Fixed bug in
getGenotypes()
affecting pedigrees with numerical labels. -
Fixed bug in
doubleCousins()
.
- The rarely-used function
cousins()
(not to be confused withcousinPed()
) is temporarily retracted, since it did not work as intended.
-
New constructor
newPed()
(mainly for internal use). -
New function
foundersFirst()
, moved from the ribd package. -
In
addChildren()
, unspecifiednch
is now allowed, and defaults tolength(ids)
orlength(sex)
. -
transferMarkers()
has a new argumentcheckSex()
, and has been made more efficient by skipping redundant validation steps. -
The functions
swapSex()
,alleles()
andinternalID()
now work for lists of pedigrees. -
getComponent()
gained a new argumenterrorIfUnknown()
.
-
unrelated()
andsiblings()
have been improved and cleaned of bugs. -
Fixed an obscure bug in
plot.singleton()
.
-
getMap(na.action = 1)
is re-implemented and now behaves slightly differently. (This was necessary to improve the handling of linked markers inpedprobr::merlin()
.) -
The order of individuals in
linearPed()
now always follows the "asPlot" pattern, as for the other basic pedigrees. (Missed this in the previous version.)
-
plot.ped()
gains argumentstextInside
,textAbove
andcarrier
. -
transferMarkers()
has new argumentsfromIds
andtoIds
enabling transfer between differently-named individuals. -
In
setMarkers()
and friends, the shortcutlocusAttributes = "snp-12"
may be used to indicate that all supplied markers are SNPs with alleles 1 and 2. Further shortcuts are "snp-ab" and "snp-AB". -
setMap()
is extended to ped lists.
-
Built-in pedigree structures are now labelled according to default plotting order. In particular, this means that pedigrees made by
halfSibPed()
,cousinPed()
andhalfCousinPed()
are ordered differently than before. -
In
plot.ped()
, the parameterskipEmptyGenotypes
is replaced byshowEmpty
, with default valueFALSE
. -
Function
xxxFrequencyDatabase()
have been renamed toxxxFreqDatabase()
-
The marker attribute
posCm
has been removed, to avoid confusion with the physical position. -
marker()
now checks for duplicated allele labels. -
setMarkers()
now checks for duplicated marker names (and allele labels, throughmarker()
; see previous point).
-
readPed()
and friends now automatically recognises allele separator "/" when genotypes are written like "a/b". Other separators must be indicated withsep
as before, e.g.,readPed(..., sep = ",")
. -
New function
getGenotypes()
, which is similar togetAlleles()
, but returns a matrix of genotypes written as "a/b". -
More flexible conversion of pedigrees to data frames, with new arguments
sep
andmissing
inas.data.frame.ped()
. -
New function
setMap()
, facilitating setting chromosome and physical position attributes. -
marker()
has a new argumentgeno
, allowing commands likemarker(nuclearPed(1), geno = c("a/a", NA, "a/b"))
. -
print.marker()
has been overhauled and gives a more coherent output. -
halfSibPed()
has a new argumenttype
, either "paternal" (default) or "maternal". -
reorderPed()
by default orders by numerical value, if all labels are numeric. -
plot.ped()
has a new argumenthint
, which is forwarded tokinship2::plot.pedigree()
. This is necessary in some cases where the automatic plotting fails to give a nice pedigree. An example is given in?plot.ped
. -
plot.ped()
gains argumenthatched
, which will eventually replaceshaded
. -
Added default values allows executing
singleton()
andnuclearPed()
with no input. -
Parts of
plotPedList()
have been restructured. In particular, the new argumentgroups
makes it easier to control grouping and frames. Previous argumentframetitles
has been renamed totitles
, because it also works without frames.
-
The
plot.ped()
argumentid.labels
is now deprecated in favour of the newlabs
. This works almost as before, with some exceptions documented here. Thelabs
argument should be thought of as who should be labelled rather than what are the labels. For example, withx = singleton(1)
, the previousplot(x, id.labels = "2")
would rename the singleton to "2". In contrast,plot(x, labs = "2")
will not show any label (sincex
doesn't have a member named "2"). In generalintersect(labs, labels(x))
determines who gets a label.Another change is that if
labs
is a function, it is now applied to the pedigreex
, not tolabels(x)
. This makes it very easy to apply standard pedigree functions likefemales()
,nonfounders()
andtypedMembers()
, since they can be referred to simply by name:plot(x, labs = females)
. -
The implementation of
doubleCousins()
is improved, and some edge cases smoothed out, but the final ordering of individuals may be different in some cases now. -
writePed()
has been partially rewritten, to make it more similar toreadPed()
. By default, only the "ped" file is written. New logical arguments "famid" and "header" provide further control of this file.Writing files in merlin format (indicated by
merlin = TRUE
) is internally now done in a separate function. This option is rarely needed by end users, but is called by e.g.pedprobr::likelihoodMerlin()
.
-
Genotype assignment in
marker()
is more user-friendly now, allowing inputs likemarker(singleton("s"), s = "A/B")
. Previously, heterozygous genotypes had to be provided allele-wise, e.g.,marker(singleton("s"), s = c("A", "B"))
. The character "/" must be used as allele separator and will always be interpreted as such.
Given the simplicity of the new syntax I recommend that homozygous genotypes are also written out fully, e.g.s = "B/B"
instead of the previous (but still functional)s = "B"
. -
New functions
commonAncestors()
andcommonDescendants()
for finding common ancestors/descendants of members in a pedigree. -
The functions
ancestors()
anddescendants()
have a new logical argument,inclusive
, indicating if the person itself should be included. -
New function
setSex()
. This is inverse togetSex()
in the sense thatsetSex(x, sex = getSex(x, named = T))
is identical tox
, whetherx
is a singleped
object or a list of such (with unique ID labels).
The oldswapSex()
is often more convenient in practise, since it automatically deals with spouses. One situation wheresetSex()
is the only option, is when one wants to assign unknown sex (sex = 0
) to someone. -
New function
setMap()
, which can be used for assigning chromosome and position attributes to marker objects.
-
New function
readFrequencyDatabase()
reads databases. Both list formats and allelic ladders are supported. -
Marker attributes "chrom" and "name" are now easier to get/set in ped lists.
-
The
relabel()
function now also works for ped lists.
-
relabel()
now works correctly in pedigrees with broken loops -
mendelianCheck()
didn't always print as intended
- The
labels()
function now also works for ped lists (returning a list of vectors).
- The previous version of
getSex()
was buggy; this has been rewritten and made more efficient.
-
New functions for extracting marker properties:
emptyMarkers()
andnTyped()
. These are generic, with methods formarker
,ped
andlist
. -
The functions
allowsMutations()
,isXmarker()
andnAlleles()
are now generic, with methods formarker
,ped
andlist
. -
plot.ped()
now accepts functional forms of the argumentsid.labels
,shaded
andstarred
. This simplifies certain plotting tasks, allowing calls likeplot(cousinPed(1), shaded = founders, starred = leaves)
. -
mutmod<-()
now allows to set the same mutation model for multiple markers in one call. -
Many utility functions now operate not only on single pedigrees but also on lists of pedigrees. These include
chrom()
,name()
,selectMarkers()
,setMarkers()
,typedMembers()
anduntypedMembers()
, -
selectMarkers()
and friends now accepts boolean marker selection, meaning that themarkers
argument may be a logical vector (of length equal to the number of attached markers).
readPed()
is now more careful regarding marker names. In particular, it should now preserve all names exactly as given, and raise an error if encountering duplicated names.
- Initial CRAN release.