Skip to content

Commit

Permalink
On the home run ....
Browse files Browse the repository at this point in the history
  • Loading branch information
biomatix committed Nov 16, 2019
1 parent 2d30eb8 commit 1f531cb
Show file tree
Hide file tree
Showing 67 changed files with 516 additions and 380 deletions.
2 changes: 1 addition & 1 deletion R/gl.assign.r
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ gl.assign <- function (x, unknown, nmin=10, dim=NULL, alpha= 0.05, threshold=0,

if (verbose >= 1){
if(verbose==5){
cat("Starting",funname,"[Build =",build,"\n")
cat("Starting",funname,"[ Build =",build,"]\n")
} else {
cat("Starting",funname,"\n")
}
Expand Down
2 changes: 1 addition & 1 deletion R/gl.collapse.pval.r
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ gl.collapse.pval <- function(fd,

if (verbose >= 1){
if(verbose==5){
cat("Starting",funname,"[Build =",build,"\n")
cat("Starting",funname,"[ Build =",build,"]\n")
} else {
cat("Starting",funname,"\n")
}
Expand Down
2 changes: 1 addition & 1 deletion R/gl.collapse.r
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ gl.collapse <- function(fd,

if (verbose >= 1){
if(verbose==5){
cat("Starting",funname,"[Build =",build,"\n")
cat("Starting",funname,"[ Build =",build,"]\n")
} else {
cat("Starting",funname,"\n")
}
Expand Down
2 changes: 1 addition & 1 deletion R/gl.collapse.recursive.r
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ gl.collapse.recursive <- function(x,

if (verbose >= 1){
if(verbose==5){
cat("Starting",funname,"[Build =",build,"\n")
cat("Starting",funname,"[ Build =",build,"]\n")
} else {
cat("Starting",funname,"\n")
}
Expand Down
12 changes: 9 additions & 3 deletions R/gl.compliance.check.r
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ gl.compliance.check <- function (x, verbose=NULL) {

if (verbose >= 1){
if(verbose==5){
cat("Starting",funname,"[Build =",build,"\n")
cat("Starting",funname,"[ Build =",build,"]\n")
} else {
cat("Starting",funname,"\n")
}
Expand Down Expand Up @@ -108,7 +108,7 @@ gl.compliance.check <- function (x, verbose=NULL) {
if (verbose >= 2){cat(" Checking verbosity flag\n")}
if(is.null(x@other$verbose)){
if (verbose >= 1){cat(" Creating verbosity flag\n")}
x <- utils.reset.verbosity(x,set.verbosity=2,verbose=0)
x <- utils.reset.verbosity(x,value=2,verbose=0)
} else {
if (verbose >= 1){cat(" Verbosity flag confirmed\n")}
}
Expand All @@ -118,7 +118,13 @@ gl.compliance.check <- function (x, verbose=NULL) {
if (verbose >= 2){cat(" Recalculating locus metrics\n")}
x <- gl.recalc.metrics(x,verbose=verbose)

# Check that the individual metricx exist, and if not, create the df
# Check that the number of values in the loc.metrics dataframe is the same as the number of loci

if (nLoc(gl)!=nrow(gl@other$loc.metrics)) {
cat(" The number of rows in the loc.metrics table does not match the number of loci! This is potentially a major problem if there is a mismatch of the loci with the metadata. Trace back to identify the cause.\n")
}

# Check that the individual metrics exist, and if not, create the df

if (verbose >= 2){cat(" Checking for individual metrics\n")}
if(is.null(x@other$loc.metrics)){
Expand Down
2 changes: 1 addition & 1 deletion R/gl.define.pop.r
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ gl.define.pop <- function(x, ind.list, new, verbose=NULL){

if (verbose >= 1){
if(verbose==5){
cat("Starting",funname,"[Build =",build,"\n")
cat("Starting",funname,"[ Build =",build,"]\n")
} else {
cat("Starting",funname,"\n")
}
Expand Down
2 changes: 1 addition & 1 deletion R/gl.dist.ind.r
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ gl.dist.ind <- function(x, method=NULL, plot=TRUE, boxplot="standard", range=1.5

if (verbose >= 1){
if(verbose==5){
cat("Starting",funname,"[Build =",build,"\n")
cat("Starting",funname,"[ Build =",build,"]\n")
} else {
cat("Starting",funname,"\n")
}
Expand Down
2 changes: 1 addition & 1 deletion R/gl.dist.pop.r
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ gl.dist.pop <- function(x, method="euclidean", plot=TRUE, boxplot="standard", ra

if (verbose >= 1){
if(verbose==5){
cat("Starting",funname,"[Build =",build,"\n")
cat("Starting",funname,"[ Build =",build,"]\n")
} else {
cat("Starting",funname,"\n")
}
Expand Down
2 changes: 1 addition & 1 deletion R/gl.drop.ind.r
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ gl.drop.ind <- function(x, ind.list, recalc=FALSE, mono.rm=FALSE, verbose=NULL){

if (verbose >= 1){
if(verbose==5){
cat("Starting",funname,"[Build =",build,"\n")
cat("Starting",funname,"[ Build =",build,"]\n")
} else {
cat("Starting",funname,"\n")
}
Expand Down
2 changes: 1 addition & 1 deletion R/gl.drop.loc.r
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ gl.drop.loc <- function(x, loc.list=NULL, first=NULL, last=NULL, verbose=NULL){

if (verbose >= 1){
if(verbose==5){
cat("Starting",funname,"[Build =",build,"\n")
cat("Starting",funname,"[ Build =",build,"]\n")
} else {
cat("Starting",funname,"\n")
}
Expand Down
2 changes: 1 addition & 1 deletion R/gl.drop.pop.r
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ gl.drop.pop <- function(x, pop.list, as.pop=NULL, recalc=FALSE, mono.rm=FALSE, v

if (verbose >= 1){
if(verbose==5){
cat("Starting",funname,"[Build =",build,"\n")
cat("Starting",funname,"[ Build =",build,"]\n")
} else {
cat("Starting",funname,"\n")
}
Expand Down
32 changes: 21 additions & 11 deletions R/gl.edit.recode.ind.r
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
#' @param outpath -- path where to save the output file [default tempdir(), mandated by CRAN].
#' @param recalc -- Recalculate the locus metadata statistics [default TRUE]
#' @param mono.rm -- Remove monomorphic loci [default TRUE]
#' @param verbose -- verbosity: 0, silent or fatal errors; 1, begin and end; 2, progress log ; 3, progress and results summary; 5, full report [default 2 or as specified using gl.set.verbosity]
#' @return An object of class ("genlight") with the revised individual labels
#' @param verbose -- verbose=0, silent; verbose=1, low verbosity; verbose=2, high verbosity [default 2]
#' @import utils
#' @export
#' @author Arthur Georges (Post to \url{https://groups.google.com/d/forum/dartr})
Expand All @@ -43,30 +43,40 @@

gl.edit.recode.ind <- function(x, out.recode.file=NULL, outpath=tempdir(), recalc=FALSE, mono.rm=FALSE, verbose=NULL){

# TIDY UP FILE SPECS
# TRAP COMMAND, SET VERSION

funname <- match.call()[[1]]
build <- "Jacob"
if (!is.null(out.recode.file)){
outfilespec <- file.path(outpath, out.recode.file)
}

# FLAG SCRIPT START
# set verbosity
if (is.null(verbose) & !is.null(x@other$verbose)) verbose=x@other$verbose
if (is.null(verbose)) verbose=2


# SET VERBOSITY

if (is.null(verbose)){
if(!is.null(x@other$verbose)){
verbose <- x@other$verbose
} else {
verbose <- 2
}
}

if (verbose < 0 | verbose > 5){
cat(" Warning: Parameter 'verbose' must be an integer between 0 [silent] and 5 [full report], set to 2\n")
cat(paste(" Warning: Parameter 'verbose' must be an integer between 0 [silent] and 5 [full report], set to 2\n"))
verbose <- 2
}

# FLAG SCRIPT START

if (verbose >= 1){
cat("Starting",funname,"\n")
if(verbose==5){
cat("Starting",funname,"[ Build =",build,"]\n")
} else {
cat("Starting",funname,"\n")
}
}

# STANDARD ERROR CHECKING
# STANDARD ERROR CHECKING

if(class(x)!="genlight") {
stop("Fatal Error: genlight object required!\n")
Expand Down
30 changes: 20 additions & 10 deletions R/gl.edit.recode.pop.r
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#' @param outpath -- path where to save the output file [default tempdir(), mandated by CRAN].
#' @param recalc -- Recalculate the locus metadata statistics if any individuals are deleted [default TRUE]
#' @param mono.rm -- Remove monomorphic loci [default TRUE]
#' @param verbose -- specify the level of verbosity: 0, silent, fatal errors only; 1, flag function begin and end; 2, progress log ; 3, progress and results summary; 5, full report [default 2]
#' @param verbose -- verbosity: 0, silent or fatal errors; 1, begin and end; 2, progress log ; 3, progress and results summary; 5, full report [default 2 or as specified using gl.set.verbosity]
#' @return An object of class ("genlight") with the revised population assignments
#' @import utils
#' @export
Expand All @@ -43,27 +43,37 @@

gl.edit.recode.pop <- function(x, pop.recode=NULL, out.recode.file=NULL, outpath=tempdir(), recalc=FALSE, mono.rm=FALSE, verbose=NULL) {

# TIDY UP FILE SPECS
# TRAP COMMAND, SET VERSION

funname <- match.call()[[1]]
build <- "Jacob"
if (!is.null(out.recode.file)){
outfilespec <- file.path(outpath, out.recode.file)
}
}

# SET VERBOSITY

# FLAG SCRIPT START
# set verbosity
if (is.null(verbose) & !is.null(x@other$verbose)) verbose=x@other$verbose
if (is.null(verbose)) verbose=2

if (is.null(verbose)){
if(!is.null(x@other$verbose)){
verbose <- x@other$verbose
} else {
verbose <- 2
}
}

if (verbose < 0 | verbose > 5){
cat(" Warning: Parameter 'verbose' must be an integer between 0 [silent] and 5 [full report], set to 2\n")
cat(paste(" Warning: Parameter 'verbose' must be an integer between 0 [silent] and 5 [full report], set to 2\n"))
verbose <- 2
}

# FLAG SCRIPT START

if (verbose >= 1){
cat("Starting",funname,"\n")
if(verbose==5){
cat("Starting",funname,"[ Build =",build,"]\n")
} else {
cat("Starting",funname,"\n")
}
}

# STANDARD ERROR CHECKING
Expand Down
2 changes: 1 addition & 1 deletion R/gl.filter.callrate.r
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@

if (verbose >= 1){
if(verbose==5){
cat("Starting",funname,"[Build =",build,"\n")
cat("Starting",funname,"[ Build =",build,"]\n")
} else {
cat("Starting",funname,"\n")
}
Expand Down
2 changes: 1 addition & 1 deletion R/gl.filter.hamming.r
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ gl.filter.hamming <- function(x, threshold=0.2, rs=5, pb=FALSE, verbose=NULL) {

if (verbose >= 1){
if(verbose==5){
cat("Starting",funname,"[Build =",build,"\n")
cat("Starting",funname,"[ Build =",build,"]\n")
} else {
cat("Starting",funname,"\n")
}
Expand Down
2 changes: 1 addition & 1 deletion R/gl.filter.heterozygosity.r
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ gl.filter.heterozygosity <- function(x, t.upper=0.7, t.lower=0, verbose=NULL) {

if (verbose >= 1){
if(verbose==5){
cat("Starting",funname,"[Build =",build,"\n")
cat("Starting",funname,"[ Build =",build,"]\n")
} else {
cat("Starting",funname,"\n")
}
Expand Down
2 changes: 1 addition & 1 deletion R/gl.filter.hwe.r
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ gl.filter.hwe <- function(x, alpha=0.05, basis="any", bon=TRUE, verbose=NULL) {

if (verbose >= 1){
if(verbose==5){
cat("Starting",funname,"[Build =",build,"\n")
cat("Starting",funname,"[ Build =",build,"]\n")
} else {
cat("Starting",funname,"\n")
}
Expand Down
2 changes: 1 addition & 1 deletion R/gl.filter.maf.r
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ gl.filter.maf <- function(x, threshold=0.01, verbose=NULL) {

if (verbose >= 1){
if(verbose==5){
cat("Starting",funname,"[Build =",build,"\n")
cat("Starting",funname,"[ Build =",build,"]\n")
} else {
cat("Starting",funname,"\n")
}
Expand Down
2 changes: 1 addition & 1 deletion R/gl.filter.monomorphs.r
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ gl.filter.monomorphs <- function (x, verbose=NULL) {

if (verbose >= 1){
if(verbose==5){
cat("Starting",funname,"[Build =",build,"\n")
cat("Starting",funname,"[ Build =",build,"]\n")
} else {
cat("Starting",funname,"\n")
}
Expand Down
2 changes: 1 addition & 1 deletion R/gl.filter.overshoot.r
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ gl.filter.overshoot <- function(x, verbose=NULL) {

if (verbose >= 1){
if(verbose==5){
cat("Starting",funname,"[Build =",build,"\n")
cat("Starting",funname,"[ Build =",build,"]\n")
} else {
cat("Starting",funname,"\n")
}
Expand Down
2 changes: 1 addition & 1 deletion R/gl.filter.pa.r
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ gl.filter.pa<-function(x, pop1, pop2, invers=FALSE, verbose=NULL){

if (verbose >= 1){
if(verbose==5){
cat("Starting",funname,"[Build =",build,"\n")
cat("Starting",funname,"[ Build =",build,"]\n")
} else {
cat("Starting",funname,"\n")
}
Expand Down
2 changes: 1 addition & 1 deletion R/gl.filter.rdepth.r
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ gl.filter.rdepth <- function(x, lower=5, upper=50, verbose=NULL) {

if (verbose >= 1){
if(verbose==5){
cat("Starting",funname,"[Build =",build,"\n")
cat("Starting",funname,"[ Build =",build,"]\n")
} else {
cat("Starting",funname,"\n")
}
Expand Down
2 changes: 1 addition & 1 deletion R/gl.filter.repeatability.r
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ gl.filter.repeatability <- function(x, threshold=0.99, verbose=NULL) {

if (verbose >= 1){
if(verbose==5){
cat("Starting",funname,"[Build =",build,"\n")
cat("Starting",funname,"[ Build =",build,"]\n")
} else {
cat("Starting",funname,"\n")
}
Expand Down
2 changes: 1 addition & 1 deletion R/gl.filter.secondaries.r
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ gl.filter.secondaries <- function(x, method="random", verbose=NULL) {

if (verbose >= 1){
if(verbose==5){
cat("Starting",funname,"[Build =",build,"\n")
cat("Starting",funname,"[ Build =",build,"]\n")
} else {
cat("Starting",funname,"\n")
}
Expand Down
2 changes: 1 addition & 1 deletion R/gl.filter.taglength.r
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ gl.filter.taglength <- function(x, lower=20, upper=69, verbose=NULL) {

if (verbose >= 1){
if(verbose==5){
cat("Starting",funname,"[Build =",build,"\n")
cat("Starting",funname,"[ Build =",build,"]\n")
} else {
cat("Starting",funname,"\n")
}
Expand Down
2 changes: 1 addition & 1 deletion R/gl.fixed.diff.r
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ gl.fixed.diff <- function(x, tloc=0, test=FALSE, delta=0.02, reps=1000, mono.rm=

if (verbose >= 1){
if(verbose==5){
cat("Starting",funname,"[Build =",build,"\n")
cat("Starting",funname,"[ Build =",build,"]\n")
} else {
cat("Starting",funname,"\n")
}
Expand Down
Loading

0 comments on commit 1f531cb

Please sign in to comment.