Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
178 changes: 89 additions & 89 deletions R/RcppExports.R
Original file line number Diff line number Diff line change
@@ -1,89 +1,89 @@
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
#' Calculate IBD probabilities
#'
#' Calculate IBD probabilities for different types of populations.
#'
#' IBD probabilities can be calculated for many different types of populations.
#' In the following table all supported populations are listed. Note that the
#' value of x in the population types is variable, with its maximum value
#' depicted in the last column.
#'
#' | __Population type__ | __Cross__ | __Description__ | __max. x__ |
#' | ------ | ----------------- | -------------------------------------- | --- |
#' | DH | biparental | doubled haploid population | |
#' | Fx | biparental | Fx population (F1, followed by x-1 generations of selfing) | 8 |
#' | FxDH | biparental | Fx, followed by DH generation | 8 |
#' | BCx | biparental | backcross, second parent is recurrent parent | 9 |
#' | BCxDH | biparental | BCx, followed by DH generation | 9 |
#' | BC1Sx | biparental | BC1, followed by x generations of selfing | 7 |
#' | BC1SxDH | biparental | BC1, followed by x generations of selfing and DH | 6 |
#' | C3 | three-way | three way cross: (AxB) x C | |
#' | C3DH | three-way | C3, followed by DH generation | |
#' | C3Sx | three-way | C3, followed by x generations of selfing | 7 |
#' | C3SxDH | three-way | C3, followed by x generations of selfing and DH generation | 6 |
#' | C4 | four-way | four-way cross: (AxB) x (CxD) | |
#' | C4DH | four-way | C4, followed by DH generation | |
#' | C4Sx | four-way | C4, followed by x generations of selfing | 6 |
#' | C4SxDH | four-way | C4, followed by x generations of selfing and DH generation | 6 |
#'
#' @param popType A character string indicating the type of population. One of
#' DH, Fx, FxDH, BCx, BCxDH, BC1Sx, BC1SxDH, C3, C3DH, C3Sx, C3SxDH, C4, C4DH,
#' C4Sx, C4SxDH (see Details).
#' @param markerFile A character string indicating the location of the file with
#' genotypic information for the population. The file should be in
#' tab-delimited format with a header containing marker names.
#' @param mapFile A character string indicating the location of the map file
#' for the population. The file should be in tab-delimited format. It should
#' consist of exactly three columns, marker, chromosome and position. There
#' should be no header. The positions in the file should be in centimorgan.
#' @param evalPos A data.frame with evaluation positions to which the
#' calculations should be limited.
#' @param evalDist An optional numerical value indicating the maximum
#' distance for marker positions. Extra markers will be added based on the
#' value of \code{grid}.
#' @param grid Should the extra markers that are added to assure the a
#' maximum distince of \code{evalDist} be on a grid (\code{TRUE}) or in between
#' marker existing marker positions (\code{FALSE}).
#' @param verbose Should messages indicating the progress of the process be
#' printed?
#'
#' @returns An object of class \code{IBDprob}, a \code{list} with five elements,
#' \describe{
#' \item{map}{a \code{data.frame} with chromosome and position of the markers.}
#' \item{markers}{a 3-dimensional \code{array} of IBD probabilities with
#' genotypes, markers and parents as array dimensions.}
#' \item{parents}{the parents.}
#' \item{popType}{the population type.}
#' }
#'
#' @examples
#' ## Compute IBD probabilities for Steptoe Morex.
#' SxMIBD <- calcIBD(popType = "DH",
#' markerFile = system.file("extdata/SxM", "SxM_geno.txt",
#' package = "statgenIBD"),
#' mapFile = system.file("extdata/SxM", "SxM_map.txt",
#' package = "statgenIBD"))
#'
#' ## Check summary.
#' summary(SxMIBD)
#'
#' ## Compute IBD probabilities for Steptoe Morex.
#' ## Add extra evaluation positions in between exiting marker positions
#' ## to assure evaluation positions are at most 5 cM apart.
#' SxMIBD_Ext <- calcIBD(popType = "DH",
#' markerFile = system.file("extdata/SxM", "SxM_geno.txt",
#' package = "statgenIBD"),
#' mapFile = system.file("extdata/SxM", "SxM_map.txt",
#' package = "statgenIBD"),
#' evalDist = 5)
#'
#' ## Check summary.
#' summary(SxMIBD_Ext)
#'
#' @export
calcIBD <- function(popType, markerFile, mapFile, evalPos = NULL, evalDist = NULL, grid = TRUE, verbose = FALSE) {
.Call(`_statgenIBD_calcIBD`, popType, markerFile, mapFile, evalPos, evalDist, grid, verbose)
}
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#' Calculate IBD probabilities
#'
#' Calculate IBD probabilities for different types of populations.
#'
#' IBD probabilities can be calculated for many different types of populations.
#' In the following table all supported populations are listed. Note that the
#' value of x in the population types is variable, with its maximum value
#' depicted in the last column.
#'
#' | __Population type__ | __Cross__ | __Description__ | __max. x__ |
#' | ------ | ----------------- | -------------------------------------- | --- |
#' | DH | biparental | doubled haploid population | |
#' | Fx | biparental | Fx population (F1, followed by x-1 generations of selfing) | 8 |
#' | FxDH | biparental | Fx, followed by DH generation | 8 |
#' | BCx | biparental | backcross, second parent is recurrent parent | 9 |
#' | BCxDH | biparental | BCx, followed by DH generation | 9 |
#' | BC1Sx | biparental | BC1, followed by x generations of selfing | 7 |
#' | BC1SxDH | biparental | BC1, followed by x generations of selfing and DH | 6 |
#' | C3 | three-way | three way cross: (AxB) x C | |
#' | C3DH | three-way | C3, followed by DH generation | |
#' | C3Sx | three-way | C3, followed by x generations of selfing | 7 |
#' | C3SxDH | three-way | C3, followed by x generations of selfing and DH generation | 6 |
#' | C4 | four-way | four-way cross: (AxB) x (CxD) | |
#' | C4DH | four-way | C4, followed by DH generation | |
#' | C4Sx | four-way | C4, followed by x generations of selfing | 6 |
#' | C4SxDH | four-way | C4, followed by x generations of selfing and DH generation | 6 |
#'
#' @param popType A character string indicating the type of population. One of
#' DH, Fx, FxDH, BCx, BCxDH, BC1Sx, BC1SxDH, C3, C3DH, C3Sx, C3SxDH, C4, C4DH,
#' C4Sx, C4SxDH (see Details).
#' @param markerFile A character string indicating the location of the file with
#' genotypic information for the population. The file should be in
#' tab-delimited format with a header containing marker names.
#' @param mapFile A character string indicating the location of the map file
#' for the population. The file should be in tab-delimited format. It should
#' consist of exactly three columns, marker, chromosome and position. There
#' should be no header. The positions in the file should be in centimorgan.
#' @param evalPos A data.frame with evaluation positions to which the
#' calculations should be limited.
#' @param evalDist An optional numerical value indicating the maximum
#' distance for marker positions. Extra markers will be added based on the
#' value of \code{grid}.
#' @param grid Should the extra markers that are added to assure the a
#' maximum distince of \code{evalDist} be on a grid (\code{TRUE}) or in between
#' marker existing marker positions (\code{FALSE}).
#' @param verbose Should messages indicating the progress of the process be
#' printed?
#'
#' @returns An object of class \code{IBDprob}, a \code{list} with five elements,
#' \describe{
#' \item{map}{a \code{data.frame} with chromosome and position of the markers.}
#' \item{markers}{a 3-dimensional \code{array} of IBD probabilities with
#' genotypes, markers and parents as array dimensions.}
#' \item{parents}{the parents.}
#' \item{popType}{the population type.}
#' }
#'
#' @examples
#' ## Compute IBD probabilities for Steptoe Morex.
#' SxMIBD <- calcIBD(popType = "DH",
#' markerFile = system.file("extdata/SxM", "SxM_geno.txt",
#' package = "statgenIBD"),
#' mapFile = system.file("extdata/SxM", "SxM_map.txt",
#' package = "statgenIBD"))
#'
#' ## Check summary.
#' summary(SxMIBD)
#'
#' ## Compute IBD probabilities for Steptoe Morex.
#' ## Add extra evaluation positions in between exiting marker positions
#' ## to assure evaluation positions are at most 5 cM apart.
#' SxMIBD_Ext <- calcIBD(popType = "DH",
#' markerFile = system.file("extdata/SxM", "SxM_geno.txt",
#' package = "statgenIBD"),
#' mapFile = system.file("extdata/SxM", "SxM_map.txt",
#' package = "statgenIBD"),
#' evalDist = 5)
#'
#' ## Check summary.
#' summary(SxMIBD_Ext)
#'
#' @export
calcIBD <- function(popType, markerFile, mapFile, evalPos = NULL, evalDist = NULL, grid = TRUE, verbose = FALSE) {
.Call(`_statgenIBD_calcIBD`, popType, markerFile, mapFile, evalPos, evalDist, grid, verbose)
}

80 changes: 40 additions & 40 deletions src/RcppExports.cpp
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
// Generated by using Rcpp::compileAttributes() -> do not edit by hand
// Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
#include <RcppArmadillo.h>
#include <Rcpp.h>
using namespace Rcpp;
#ifdef RCPP_USE_GLOBAL_ROSTREAM
Rcpp::Rostream<true>& Rcpp::Rcout = Rcpp::Rcpp_cout_get();
Rcpp::Rostream<false>& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get();
#endif
// calcIBD
List calcIBD(CharacterVector& popType, CharacterVector& markerFile, CharacterVector& mapFile, Nullable<DataFrame&> evalPos, Nullable<NumericVector&> evalDist, const bool& grid, const bool& verbose);
RcppExport SEXP _statgenIBD_calcIBD(SEXP popTypeSEXP, SEXP markerFileSEXP, SEXP mapFileSEXP, SEXP evalPosSEXP, SEXP evalDistSEXP, SEXP gridSEXP, SEXP verboseSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< CharacterVector& >::type popType(popTypeSEXP);
Rcpp::traits::input_parameter< CharacterVector& >::type markerFile(markerFileSEXP);
Rcpp::traits::input_parameter< CharacterVector& >::type mapFile(mapFileSEXP);
Rcpp::traits::input_parameter< Nullable<DataFrame&> >::type evalPos(evalPosSEXP);
Rcpp::traits::input_parameter< Nullable<NumericVector&> >::type evalDist(evalDistSEXP);
Rcpp::traits::input_parameter< const bool& >::type grid(gridSEXP);
Rcpp::traits::input_parameter< const bool& >::type verbose(verboseSEXP);
rcpp_result_gen = Rcpp::wrap(calcIBD(popType, markerFile, mapFile, evalPos, evalDist, grid, verbose));
return rcpp_result_gen;
END_RCPP
}
static const R_CallMethodDef CallEntries[] = {
{"_statgenIBD_calcIBD", (DL_FUNC) &_statgenIBD_calcIBD, 7},
{NULL, NULL, 0}
};
RcppExport void R_init_statgenIBD(DllInfo *dll) {
R_registerRoutines(dll, NULL, CallEntries, NULL, NULL);
R_useDynamicSymbols(dll, FALSE);
}
// Generated by using Rcpp::compileAttributes() -> do not edit by hand
// Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#include <RcppArmadillo.h>
#include <Rcpp.h>

using namespace Rcpp;

#ifdef RCPP_USE_GLOBAL_ROSTREAM
Rcpp::Rostream<true>& Rcpp::Rcout = Rcpp::Rcpp_cout_get();
Rcpp::Rostream<false>& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get();
#endif

// calcIBD
List calcIBD(CharacterVector& popType, CharacterVector& markerFile, CharacterVector& mapFile, Nullable<DataFrame> evalPos, Nullable<NumericVector> evalDist, const bool& grid, const bool& verbose);
RcppExport SEXP _statgenIBD_calcIBD(SEXP popTypeSEXP, SEXP markerFileSEXP, SEXP mapFileSEXP, SEXP evalPosSEXP, SEXP evalDistSEXP, SEXP gridSEXP, SEXP verboseSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< CharacterVector& >::type popType(popTypeSEXP);
Rcpp::traits::input_parameter< CharacterVector& >::type markerFile(markerFileSEXP);
Rcpp::traits::input_parameter< CharacterVector& >::type mapFile(mapFileSEXP);
Rcpp::traits::input_parameter< Nullable<DataFrame> >::type evalPos(evalPosSEXP);
Rcpp::traits::input_parameter< Nullable<NumericVector> >::type evalDist(evalDistSEXP);
Rcpp::traits::input_parameter< const bool& >::type grid(gridSEXP);
Rcpp::traits::input_parameter< const bool& >::type verbose(verboseSEXP);
rcpp_result_gen = Rcpp::wrap(calcIBD(popType, markerFile, mapFile, evalPos, evalDist, grid, verbose));
return rcpp_result_gen;
END_RCPP
}

static const R_CallMethodDef CallEntries[] = {
{"_statgenIBD_calcIBD", (DL_FUNC) &_statgenIBD_calcIBD, 7},
{NULL, NULL, 0}
};

RcppExport void R_init_statgenIBD(DllInfo *dll) {
R_registerRoutines(dll, NULL, CallEntries, NULL, NULL);
R_useDynamicSymbols(dll, FALSE);
}
6 changes: 3 additions & 3 deletions src/calcIBD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ using namespace ibd;
List calcIBD(CharacterVector& popType,
CharacterVector& markerFile,
CharacterVector& mapFile,
Nullable<DataFrame&> evalPos = R_NilValue,
Nullable<NumericVector&> evalDist = R_NilValue,
Nullable<DataFrame> evalPos = R_NilValue,
Nullable<NumericVector> evalDist = R_NilValue,
const bool& grid = true,
const bool& verbose = false)
{
Expand All @@ -126,7 +126,7 @@ List calcIBD(CharacterVector& popType,
_poptype,
Rcpp::as<std::string>(markerFile),
Rcpp::as<std::string>(mapFile),
evalPos,
Rcpp::DataFrame(evalPos),
max_step_size,
grid,
verbose);
Expand Down