Nothing
#' GetHpltTable() function
#'
#' \code{\link{GetHpltTable}} uses the output files produced by the HpltFind()
#' function to produce a table with the mean proportion of incongruent sequences
#' for each nest. If the mean proportion of incongruent sequences is generally
#' low, but certain nests have many incongruent sequences, biological reasons
#' may be causing the mismatches, e.g. extra-pair fertilizations or
#' recombination events.
#'
#' If you publish data or results produced with MHCtools, please cite both of
#' the following references:
#' Roved, J. (2022). MHCtools: Analysis of MHC data in non-model species. Cran.
#' Roved, J. (2024). MHCtools 1.5: Analysis of MHC sequencing data in R. In S.
#' Boegel (Ed.), HLA Typing: Methods and Protocols (2nd ed., pp. 275–295).
#' Humana Press. https://doi.org/10.1007/978-1-0716-3874-3_18
#'
#' @param filepath is a user defined path to the folder where the output files
#' from the HpltFind() function have been saved.
#' @return A table with the mean proportion of incongruent sequences for each
#' nest.
#' @seealso \code{\link{HpltFind}}; \code{\link{GetHpltStats}}
#' @examples
#' filepath <- system.file("extdata/HpltFindOut/", package="MHCtools")
#' GetHpltTable(filepath)
#' @export
GetHpltTable <- function(filepath) {
# Get the file names of the .Rds output generated by the HpltFind function
file_names <- dir(filepath)
# Sort the file names by nest number
file_names <- file_names[order(as.numeric(gsub("[^0-9]", "", file_names)))]
mean_props <- numeric()
# Extract the mean proportion of incongruent sequences for each nest
for(i in 1:length(file_names)) {
mean_props[i] <- readRDS(file.path(filepath, file_names[i]))$Mean_prop_incongr_seqs
}
# List the observed mean proportions of incongruent sequences for each nest
Table_obs_means <- as.data.frame(cbind(file_names, mean_props))
Table_obs_means
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.