diff --git a/R/gscramble2newhybrids.R b/R/gscramble2newhybrids.R index 08d750b..a02d3fb 100644 --- a/R/gscramble2newhybrids.R +++ b/R/gscramble2newhybrids.R @@ -20,7 +20,9 @@ #' @param s a single regular expressions that matches individuals that #' should be given the -s option. For example "SH|CCT" #' @param retain a vector of loci to retain. -#' @param outfile path to the file to write the newhybrids data set to. +#' @param outfile path to the file to write the newhybrids data set to. For CRAN +#' compliance, this is, by default, a temp file. But you can change it to be +#' anything valid. #' @details This function relies a lot on some tidyverse functions #' for pivoting, etc. As such, it is not intended for data sets with #' tens of thousands of markers. You oughtn't be using NewHybrids with @@ -31,6 +33,12 @@ #' - `allele_names`: Allele names. #' @export #' @examples +#' # get output from segments2markers(): +#' example("segments2markers") +#' # copy that result to a new variable +#' M <- s2m_result +#' +#' # then run it #' gscramble2newhybrids(M, M_meta) gscramble2newhybrids <- function( M, @@ -38,7 +46,7 @@ gscramble2newhybrids <- function( z = NULL, s = NULL, retain = NULL, - outfile = "gscram-newhybs.txt" + outfile = tempfile() ) { headers <- paste(rep(M_meta$variant_id, each = 2), "____", c(1,2), sep = "") diff --git a/cran-comments.md b/cran-comments.md index 4b342c0..7095bb0 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,11 +1,25 @@ ## R CMD check results -## Test environments +* Local + - macOS 12.7.2, using R 4.3.1 + + 0 errors | 0 warnings | 0 notes * Using GitHub Actions - macOS 12.7.1 21G920, R 4.3.2 + + 0 errors | 0 warnings | 0 notes + - ubuntu latest (22.04.3), devel, using R Under development (unstable) (2024-02-05 r85863) + + 0 errors | 0 warnings | 0 notes + - ubuntu latest (22.04.3), release, using R 4.3.2 (2023-10-31) + + 0 errors | 0 warnings | 0 notes + - ubuntu latest (22.04.3), old-rel1, using R 4.2.3 (2023-03-15) + + 0 errors | 0 warnings | 0 notes + - windows latest (Microsoft Windows Server 2022 10.0.20348) using R 4.3.2 (2023-10-31 ucrt) + + 0 errors | 0 warnings | 0 notes -## R CMD check results + +* check_win() + - release + - devel MAC, local: 0 errors | 0 warnings | 1 notes - 1 note = GNU make is a SystemRequirements (this is for RcppParallel) @@ -42,8 +56,3 @@ Currently no known reverse dependencies ## User Notices -* This release fixes a few NOTES that Kurt Hornik emailed me about. - -0 errors | 0 warnings | 1 note - -* This is a new release. diff --git a/man/gscramble2newhybrids.Rd b/man/gscramble2newhybrids.Rd index f50617c..765c1f8 100644 --- a/man/gscramble2newhybrids.Rd +++ b/man/gscramble2newhybrids.Rd @@ -10,7 +10,7 @@ gscramble2newhybrids( z = NULL, s = NULL, retain = NULL, - outfile = "gscram-newhybs.txt" + outfile = tempfile() ) } \arguments{ @@ -31,7 +31,17 @@ should be given the -s option. For example "SH|CCT"} \item{retain}{a vector of loci to retain.} -\item{outfile}{path to the file to write the newhybrids data set to.} +\item{outfile}{path to the file to write the newhybrids data set to. For CRAN +compliance, this is, by default, a temp file. But you can change it to be +anything valid.} +} +\value{ +A list with three components: +\itemize{ +\item \code{outfile}: outfile name of saved data. +\item \code{genos}: Genotypes +\item \code{allele_names}: Allele names. +} } \description{ This function turns character-based alleles into integers @@ -47,3 +57,12 @@ for pivoting, etc. As such, it is not intended for data sets with tens of thousands of markers. You oughtn't be using NewHybrids with so many markers, anyway! } +\examples{ +# get output from segments2markers(): +example("segments2markers") +# copy that result to a new variable +M <- s2m_result + +# then run it +gscramble2newhybrids(M, M_meta) +} diff --git a/man/plink_map2rec_rates.Rd b/man/plink_map2rec_rates.Rd index d765257..99c8d22 100644 --- a/man/plink_map2rec_rates.Rd +++ b/man/plink_map2rec_rates.Rd @@ -31,6 +31,9 @@ add those in a tibble with columns \code{chrom} and \code{bp} where \code{chrom} must be a numeric vector of the number of base pairs of length of each chromosome.} } +\value{ +A tibble that provides the recombination rates for the segments of the genome. +} \description{ This is a convenience function to convert PLINK map format to the format used in the gscramble \code{RecRates} object. By default, diff --git a/man/segments2markers.Rd b/man/segments2markers.Rd index 5dae82e..4f77dd9 100644 --- a/man/segments2markers.Rd +++ b/man/segments2markers.Rd @@ -43,6 +43,16 @@ individual. (If \code{preserve_haplotypes = TRUE} then the gene copies are not permuted within individuals. You should only ever use \code{preserve_haplotypes = TRUE} if you have phased data.)} } +\value{ +A list with three components: +\itemize{ +\item \code{ret_geno}: A character matrix where each row is an individual and each pair of +columns are the alleles at a locus, thus it is N x 2L where N is the number of +individuals and L is the number of markers. +\item \code{ret_ids}: A tibble providing the individual meta data with columns \code{groups} and \code{indiv}. +\item \code{hyb_Qs}: A tibble of the admixture Q values. +} +} \description{ Map alleles from scrambled founders to the sampled segments from a GSP. }