Skip to content

Commit

Permalink
Update bitwise.dist documentation to fix #119
Browse files Browse the repository at this point in the history
  • Loading branch information
zkamvar committed Feb 6, 2017
1 parent 3fc03cb commit b4b0bd3
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 9 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: poppr
Type: Package
Title: Genetic Analysis of Populations with Mixed Reproduction
Version: 2.3.0.99-24
Version: 2.3.0.99-25
Date: 2017-02-05
Authors@R: c(person(c("Zhian", "N."), "Kamvar", role = c("cre", "aut"),
email = "zkamvar@gmail.com"),
Expand Down
6 changes: 6 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ BUG FIX
* The error given when a genlight object is passed to `poppr()` now correctly
identifies the substitute function as `diversity_stats()` and not diversity
table (see https://github.com/grunwaldlab/poppr/issues/123).

MISC
----

* The documentation for `bitwise.dist()` clarifies the role of the
`differences_only` flag (see https://github.com/grunwaldlab/poppr/issues/119).

poppr 2.3.0
===========
Expand Down
18 changes: 14 additions & 4 deletions R/bitwise.r
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
#' Calculate a dissimilarity distance matrix for SNP data.
#'
#' This function performs the same task as \code{\link{diss.dist}}, calculating
#' the number of allelic differences between two samples.
#' the fraction or number of different alleles between two genlight or snpclone
#' objects.
#'
#' @param x a \code{\link{genlight}}, \code{\link{genind}},
#' \code{\link{genclone}}, or \code{\link{snpclone}} object.
Expand All @@ -63,9 +64,10 @@
#' with anything. \code{FALSE} forces missing data to not match with any other
#' information.
#'
#' @param differences_only \code{logical}. Determines whether the matrix should
#' count differences or distances. For instance, 0 to 2 would be a distance of
#' 2 but a difference of 1.
#' @param differences_only \code{logical}. When \code{differences_only = TRUE},
#' the output will reflect the number of different loci. The default setting,
#' \code{differences_only = FALSE}, reflects the number of different alleles.
#' Note: this has no effect on haploid organisms since 1 locus = 1 allele.
#'
#' @param threads The maximum number of parallel threads to be used within this
#' function. A value of 0 (default) will attempt to use as many threads as
Expand All @@ -79,6 +81,9 @@
#' depending on its application. The most familiar name might be the Hamming
#' distance, or the number of differences between two strings.
#'
#' @note If the user supplies a \code{genind} or \code{genclone} object,
#' \code{\link{prevosti.dist}} will be used for calculation.
#'
#' @return A dist object containing pairwise distances between samples.
#'
#' @author Zhian N. Kamvar, Jonah C. Brooks
Expand All @@ -93,8 +98,13 @@
#' set.seed(999)
#' x <- glSim(n.ind = 10, n.snp.nonstruc = 5e2, n.snp.struc = 5e2, ploidy = 2)
#' x
#' # Assess fraction of different alleles (finer measure, usually the most sensible)
#' system.time(xd <- bitwise.dist(x))
#' xd
#'
#' # Assess fraction of different loci (coarse measure)
#' system.time(xdt <- bitwise.dist(x, differences_only = TRUE))
#' xdt
#==============================================================================#
bitwise.dist <- function(x, percent = TRUE, mat = FALSE, missing_match = TRUE,
differences_only = FALSE, threads = 0){
Expand Down
19 changes: 15 additions & 4 deletions man/bitwise.dist.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b4b0bd3

Please sign in to comment.