Skip to content

Commit

Permalink
Remove as.segsites function
Browse files Browse the repository at this point in the history
  • Loading branch information
paulstaab authored and mergify[bot] committed Jan 19, 2020
1 parent b9fca16 commit f511bb6
Show file tree
Hide file tree
Showing 11 changed files with 10 additions and 100 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: coala
Version: 0.5.4
Version: 0.6.0
License: MIT + file LICENSE
Title: A Framework for Coalescent Simulation
Authors@R: c(
Expand Down
3 changes: 0 additions & 3 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
S3method("+",coalmodelpart)
S3method("[",segsites)
S3method(as.matrix,segsites)
S3method(as.segsites,default)
S3method(as.segsites,list)
S3method(conv_to_ms_arg,default)
S3method(conv_to_ms_arg,files_feat)
S3method(conv_to_ms_arg,growth)
Expand Down Expand Up @@ -74,7 +72,6 @@ export(activate_ms)
export(activate_msms)
export(activate_scrm)
export(activate_seqgen)
export(as.segsites)
export(calc_sumstats_from_data)
export(check_model)
export(coal_model)
Expand Down
5 changes: 3 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
coala 0.5.4
coala 0.6.0
===========

* Removes the option to import data import via PopGenome, as PopGenome is not on
CRAN anymore.
CRAN anymore. Also removes the `as.segsites` function, as it does not do anything
anymore without the PopGenome import option (#205).



Expand Down
1 change: 1 addition & 0 deletions R/model.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#' can be simulated using the \code{\link[=simulate.coalmodel]{simulate}} function.
#'
#' @inheritParams feat_sample
#' @aliases coalmodelpart
#' @param sample_size Defines the number of populations and the number of
#' individual sampled from each population. Given as an integer vector where
#' each entry gives the number of individuals sampled from the corresponding
Expand Down
32 changes: 0 additions & 32 deletions R/segsites.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#'
#' @name segsites
#' @author Paul Staab
#' @seealso For converting biological data to segsites: \code{\link{as.segsites}}
#' @examples
#' snps <- matrix(c(1, 0, 0,
#' 1, 1, 0,
Expand Down Expand Up @@ -117,34 +116,3 @@ create_locus_trio <- function(left, middle, right) {
check = FALSE)
})
}


#' Convert genetic data to coala's internal format
#'
#' This function can be used to convert the genomic data formats used in other
#' packages to calculate coala's segregating sites object. This is useful for
#' calculating the summary statistics of biological data using the
#' \code{\link{calc_sumstats_from_data}} function.
#'
#' Currently, only the package \pkg{PopGenome} is supported, see
#' \code{\link{as.segsites.GENOME}} for details.
#'
#' @param data The data object that is converted.
#' @param ... Additional arguments specific for the used package.
#'
#' @return A list of segregating sites objects.
#' @seealso Further instructions are provided in the `coala-data-import` vignette
#' @seealso For information about segsites: \code{\link{segsites}}
#' @export
as.segsites <- function(data, ...) UseMethod("as.segsites")

#' @export
as.segsites.default <- function(data, ...) { #nolint
stop("Unknown data format")
}

#' @export
as.segsites.list <- function(data, ...) { #nolint
assert_that(all(vapply(data, is_segsites, logical(1))))
data
}
9 changes: 2 additions & 7 deletions R/sumstat.R
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,7 @@ calc_sumstats_from_sim <- function(seg_sites, trees, files, model,
#' @param model The coala model. The summary statistics present in this model
#' will be calculated. The model should fit to the data, in particular
#' regarding the number of loci and haploids.
#' @param segsites_list Either a list of \code{segsites} objects, or an object
#' that can be converted using \code{\link{as.segsites}}. It is possible
#' to specify additional argument for the conversion using the \code{...}
#' argument.
#' @param segsites_list A list of \code{segsites} objects
#' @param tree_list Not yet implemented.
#' @param trios If your model is using locus trios, then you
#' can create these by combining individual loci. This is a list that defines
Expand All @@ -155,8 +152,7 @@ calc_sumstats_from_sim <- function(seg_sites, trees, files, model,
#' summary statistics is locus in the provided data that corresponds to the
#' number. If three numbers are provided, the locus for calculation is created
#' by combining the corresponding three loci from the given data.
#' @param ... Additional arguments that will be passed to
#' \code{\link{as.segsites}}.
#' @param ... Ignored
#' @export
#' @examples
#' segsites <- create_segsites(matrix(c(1, 0, 0,
Expand Down Expand Up @@ -195,7 +191,6 @@ calc_sumstats_from_data <- function(model,
}

if (!is.null(segsites_list)) {
segsites_list <- as.segsites(segsites_list, ...)
if (!all(vapply(segsites_list, is_segsites, logical(1)))) {
stop("Incorrect or missing data in list of segregating sites")
}
Expand Down
31 changes: 0 additions & 31 deletions man/as.segsites.Rd

This file was deleted.

8 changes: 2 additions & 6 deletions man/calc_sumstats_from_data.Rd

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

1 change: 1 addition & 0 deletions man/coal_model.Rd

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

3 changes: 0 additions & 3 deletions man/segsites.Rd

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

15 changes: 0 additions & 15 deletions tests/testthat/test-import-popgenome.R

This file was deleted.

0 comments on commit f511bb6

Please sign in to comment.