Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #80 from green-striped-gecko/dev
Dev
- Loading branch information
Showing
4 changed files
with
48 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#' Filter loci in a genlight adegenet object based on call rate and population level. | ||
#' | ||
#' This funciton is a convenience function that filters callrate for the set threshold for each population and then returns a genlight object where each loci of every population passes the threshold of the call rate filter. For more details on call rates see gl.filter.callrate. | ||
#' @param x - genlight object to be filtered | ||
#' @param threshold threshold on call rate for loci for each population (see gl.filter.callrate for details.) | ||
#' @return The filtered genlight or genind object | ||
#' @export | ||
#' @examples | ||
#' gg <- gl.filter.callrate.loc.pop(testset.gl, 0.9) | ||
|
||
gl.filter.callrate.loc.pop <- function(x, threshold){ | ||
|
||
pops <- seppop(x) | ||
ll <- lapply(pops, function(x) locNames(gl.filter.callrate(x, method = "loc", threshold = threshold, verbose = 0))) | ||
locall <- Reduce(intersect, ll) | ||
index <- which(locNames(x) %in% locall) | ||
x <- x[ , locall] | ||
x@other$loc.metrics <- x@other$loc.metrics[locall,] | ||
#add to history | ||
nh <- length(x@other$history) | ||
x@other$history[[nh + 1]] <- match.call() | ||
return(x) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.