Skip to content

Commit

Permalink
Changing the the verb of the function's title to third person.
Browse files Browse the repository at this point in the history
Add check for duplicated names.
  • Loading branch information
mijangos81 committed Nov 5, 2021
1 parent 61dbf4b commit c074331
Show file tree
Hide file tree
Showing 194 changed files with 331 additions and 279 deletions.
2 changes: 1 addition & 1 deletion R/gl.amova.r
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Performs AMOVA using genlight data.
#' Performs AMOVA using genlight data
#'
#' This script performs an AMOVA based on the genetic distance matrix from
#' stamppNeisD() [package StAMPP] using the amova() function from the package
Expand Down
2 changes: 1 addition & 1 deletion R/gl.assign.pa.r
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#' @name gl.assign.pa
#' @title Eliminate populations as possible source populations for an individual
#' @title Eliminates populations as possible source populations for an individual
#' of unknown provenance, using private alleles
#' @description
#' This script eliminates from consideration as putative source populations,
Expand Down
2 changes: 1 addition & 1 deletion R/gl.check.verbosity.r
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' A function to check the current global verbosity
#' Checks the current global verbosity
#'
#' The verbosity can be set in one of two ways -- (a) explicitly by the user by
#' passing a value using the parameter verbose= in a function, or (b) by setting
Expand Down
6 changes: 3 additions & 3 deletions R/gl.collapse.r
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#' @name gl.collapse
#' @title Collapse a distance matrix by amalgamating populations with pairwise
#' @title Collapses a distance matrix by amalgamating populations with pairwise
#' fixed difference count less that a threshold
#' @description
#' This script takes a the file generated by gl.fixed.diff and amalgamates
#' This script takes a file generated by gl.fixed.diff and amalgamates
#' populations with distance less than or equal to a specified threshold. The
#' distance matrix is generated by gl.fixed.diff().
#'
#' The script then applies the new population assignments to the genlight object
#' and recalculates the distance and associated matrices.
#'
#' @param fd Name of the list of matricies produced by gl.fixed.diff() [required].
#' @param fd Name of the list of matrices produced by gl.fixed.diff() [required].
#' @param tloc Threshold defining a fixed difference (e.g. 0.05 implies 95:5 vs
#' 5:95 is fixed) [default 0].
#' @param tpop Threshold number of fixed differences above which populations
Expand Down
29 changes: 25 additions & 4 deletions R/gl.compliance.check.r
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ gl.compliance.check <- function(x,
locNames(x) <- paste0("Loc", 1:nLoc(x))
}

# Check that the data exist, and that they are restricted to the appropriate values
# Check that the data exist, and that they are restricted to the
# appropriate values

if (datatype == "SNP") {
mat <- as.matrix(x)
Expand Down Expand Up @@ -115,7 +116,8 @@ gl.compliance.check <- function(x,
}
}

# Check for the locus metrics, and create if they do not exist. Check for the locus metrics flags, and create if they do not exist.
# Check for the locus metrics, and create if they do not exist.
# Check for the locus metrics flags, and create if they do not exist.
# Check for the verbosity flag, and create if it does not exist.

if (verbose >= 2) {
Expand Down Expand Up @@ -146,7 +148,8 @@ gl.compliance.check <- function(x,
x@other$loc.metrics.flags$monomorphs <- FALSE
}

# Check that the number of values in the loc.metrics dataframe is the same as the number of loci
# Check that the number of values in the loc.metrics dataframe is the same
# as the number of loci
if (nLoc(x) != nrow(x@other$loc.metrics)) {
cat(
warn(
Expand All @@ -155,6 +158,23 @@ gl.compliance.check <- function(x,
)
}

# check that individual names are unique, and if not, add underscore and
# letters
if (verbose >= 2) {
cat(report(" Checking whether individual names are unique.\n"))
}

if (any(duplicated(indNames(x)))) {
if (verbose >= 2) {
cat(
warn(
" Individual names are not unique. Appending an extra number to make them unique.\n"
)
)
}
indNames(x) <- make.unique(indNames(x), sep = '_')
}

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

if (verbose >= 2) {
Expand All @@ -171,7 +191,8 @@ gl.compliance.check <- function(x,
}
}

# Check that the population variable exists, and if it does not, create it with a single population 'pop1'
# Check that the population variable exists, and if it does not, create it
# with a single population 'pop1'

if (verbose >= 2) {
cat(report(" Checking for population assignments\n"))
Expand Down
2 changes: 1 addition & 1 deletion R/gl.define.pop.r
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#' @name gl.define.pop
#' @title Define a new population in a genlight object for specified individuals
#' @title Defines a new population in a genlight object for specified individuals
#' @description
#' The script reassigns existing individuals to a new population and removes
#' their existing population assignment.
Expand Down
2 changes: 1 addition & 1 deletion R/gl.dist.ind.r
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#' @name gl.dist.ind
#' @title Calculate a distance matrix for individuals defined in an \{adegenet\}
#' @title Calculates a distance matrix for individuals defined in an \{adegenet\}
#' genlight object
#' @description
#' This script calculates various distances between individuals based on allele
Expand Down
2 changes: 1 addition & 1 deletion R/gl.dist.pop.r
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#' @name gl.dist.pop
#' @title Calculate a distance matrix for populations with SNP genotypes in a
#' @title Calculates a distance matrix for populations with SNP genotypes in a
#' genlight object
#' @description
#' This script calculates various distances between populations based on allele
Expand Down
2 changes: 1 addition & 1 deletion R/gl.drop.ind.r
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#' @name gl.drop.ind
#' @title Remove specified individuals from a genlight \{adegenet\} object
#' @title Removes specified individuals from a genlight \{adegenet\} object
#' @description
#' The script, having deleted individuals, optionally identifies resultant
#' monomorphic loci or loci with all values missing and deletes them
Expand Down
2 changes: 1 addition & 1 deletion R/gl.drop.loc.r
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#' @name gl.drop.loc
#' @title Remove specified loci from a genlight \{adegenet\} object
#' @title Removes specified loci from a genlight \{adegenet\} object
#' @description
#' The script returns a genlight object with specified loci deleted.
#'
Expand Down
2 changes: 1 addition & 1 deletion R/gl.drop.pop.r
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#' @name gl.drop.pop
#' @title Remove specified populations from a genlight object
#' @title Removes specified populations from a genlight object
#' @description
#' Individuals are assigned to populations based on the specimen metadata data
#' file (csv) used with \code{\link{gl.read.dart}}.
Expand Down
4 changes: 2 additions & 2 deletions R/gl.edit.recode.ind.r
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#' @name gl.edit.recode.ind
#' @title Create or edit a individual (=specimen) names, create an recode_ind
#' file amd apply the changes to a genlight object.
#' @title Creates or edits an individual (=specimen) names, creates an recode_ind
#' file and applies the changes to a genlight object.
#' @description
#' A script to edit individual names in a genlight object, or to create a
#' reassignment table taking the individual labels from a genlight object, or to
Expand Down
2 changes: 1 addition & 1 deletion R/gl.edit.recode.pop.r
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#' @name gl.edit.recode.pop
#' @title Create or edit a population re-assignment table
#' @title Creates or edits a population re-assignment table
#' @description
#' A script to edit population assignments in a genlight object, or to
#' create a reassignment table taking the population assignments
Expand Down
2 changes: 1 addition & 1 deletion R/gl.evanno.r
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#' @name gl.evanno
#' @title Create an Evanno plot from an sr structure run object
#' @title Creates an Evanno plot from an sr structure run object
#' @description
#' This function takes a genlight object and runs a STRUCTURE analysis based on
#' functions from \code{strataG}
Expand Down
2 changes: 1 addition & 1 deletion R/gl.fdsim.r
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#' @name gl.fdsim
#' @title Estimate the rate of false positives in a fixed difference analysis
#' @title Estimates the rate of false positives in a fixed difference analysis
#' @description
#' This function takes two populations and generates allele frequency profiles
#' for them. It then samples an allele frequency for each, at random, and
Expand Down
2 changes: 1 addition & 1 deletion R/gl.filter.allna.r
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#' @name gl.filter.allna
#' @title Remove loci that are all NA across individuals and/or individuals with
#' @title Removes loci that are all NA across individuals and/or individuals with
#' all NA across loci
#'
#' @description
Expand Down
2 changes: 1 addition & 1 deletion R/gl.filter.callrate.r
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#' @name gl.filter.callrate
#' @title Filter loci or specimens in a genlight \{adegenet\} object based on
#' @title Filters loci or specimens in a genlight \{adegenet\} object based on
#' call rate
#' @description
#' SNP datasets generated by DArT have missing values primarily arising from
Expand Down
4 changes: 2 additions & 2 deletions R/gl.filter.locmetric.r
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#' @title gl.filter.locmetrics
#' @title Filter loci on the basis of numeric information stored in
#' @name gl.filter.locmetrics
#' @title Filters loci on the basis of numeric information stored in
#' other$loc.metrics in a genlight \{adegenet\} object
#' @description
#' This script uses any field with numeric values stored in $other$loc.metrics
Expand Down
4 changes: 2 additions & 2 deletions R/gl.filter.maf.r
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#' @title gl.filter.maf
#' @title Filter loci on the basis of minor allele frequency (MAF) in a genlight
#' @name gl.filter.maf
#' @title Filters loci on the basis of minor allele frequency (MAF) in a genlight
#' {adegenet} object
#' @description
#' This script calculates the minor allele frequency for each locus and updates
Expand Down
2 changes: 1 addition & 1 deletion R/gl.filter.monomorphs.r
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#' @name gl.filter.monomorphs
#' @title Remove monomorphic loci, including those with all NAs
#' @title Removes monomorphic loci, including those with all NAs
#' @description
#' This script deletes monomorphic loci from a genlight \{adegenet\} object
#'
Expand Down
4 changes: 2 additions & 2 deletions R/gl.filter.pa.r
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#' Filter loci that contain private (and fixed alleles) between two populations.
#' Filters loci that contain private (and fixed alleles) between two populations
#'
#' This script is meant to be used prior to \code{gl.nhybrids} to maximise the
#' information content of the snps used to identify hybrids (currently
#' information content of the SNPs used to identify hybrids (currently
#' newhybrids does allow only 200 SNPs). The idea is to use first all loci that
#' have fixed alleles between the potential source populations and then 'fill
#' up' to 200 loci using loci that have private alleles between those. The
Expand Down
2 changes: 1 addition & 1 deletion R/gl.filter.parent.offspring.r
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#' @name gl.filter.parent.offspring
#' @title Filter putative parent offspring within a population
#' @title Filters putative parent offspring within a population
#' @description
#' This script removes individuals suspected of being related as
#' parent-offspring,using the output of the function
Expand Down
2 changes: 1 addition & 1 deletion R/gl.filter.rdepth.r
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#' @name gl.filter.rdepth
#' @title Filter loci based on counts of sequence tags scored at a locus (read
#' @title Filters loci based on counts of sequence tags scored at a locus (read
#' depth)
#'
#' @description
Expand Down
2 changes: 1 addition & 1 deletion R/gl.filter.reproducibility.r
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#' @name gl.filter.reproducibility
#' @title Filter loci in a genlight \{adegenet\} object based on average
#' @title Filters loci in a genlight \{adegenet\} object based on average
#' repeatability of alleles at a locus
#' @description
#' SNP datasets generated by DArT have an index, RepAvg, generated by
Expand Down
2 changes: 1 addition & 1 deletion R/gl.filter.secondaries.r
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#' @name gl.filter.secondaries
#' @title Filter loci that represent secondary SNPs in a genlight object
#' @title Filters loci that represent secondary SNPs in a genlight object
#' @description
#' SNP datasets generated by DArT include fragments with more than one SNP and
#' record them separately with the same CloneID (=AlleleID). These multiple SNP
Expand Down
2 changes: 1 addition & 1 deletion R/gl.filter.sexlinked.r
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#' @name gl.filter.sexlinked
#' @title Filter loci that are sex linked
#' @title Filters loci that are sex linked
#' @description
#' Alleles unique to the Y or W chromosome and monomorphic on the X chromosomes
#' will appear in the SNP dataset as genotypes that are heterozygotic in all
Expand Down
2 changes: 1 addition & 1 deletion R/gl.filter.taglength.r
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#' @name gl.filter.taglength
#' @title Filter loci in a genlight \{adegenet\} object based on sequence tag
#' @title Filters loci in a genlight \{adegenet\} object based on sequence tag
#' length
#' @description
#' SNP datasets generated by DArT typically have sequence tag lengths ranging
Expand Down
2 changes: 1 addition & 1 deletion R/gl.fixed.diff.r
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#' @name gl.fixed.diff
#' @title Generate a matrix of fixed differences and associated statistics for
#' @title Generates a matrix of fixed differences and associated statistics for
#' populations taken pairwise
#' @description
#' This script takes SNP data or sequence tag P/A data grouped into populations
Expand Down
2 changes: 1 addition & 1 deletion R/gl.fst.pop.r
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Calculate a pairwise Fst values for populations in a genlight object
#' Calculates a pairwise Fst values for populations in a genlight object
#'
#' This script calculates pairwise Fst values based on the implementation in the
#' StAMPP package (?stamppFst). It allows to run bootstrap to estimate
Expand Down
2 changes: 1 addition & 1 deletion R/gl.install.vanilla.dartR.r
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' This functions installs all required packages for using all functions
#' Installs all required packages for using all functions
#' available in dartR
#'
#' The function compares the installed packages with the the currently available
Expand Down
2 changes: 1 addition & 1 deletion R/gl.keep.ind.r
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#' @name gl.keep.ind
#' @title Remove all but the specified individuals from a genlight \{adegenet\}
#' @title Removes all but the specified individuals from a genlight \{adegenet\}
#' object
#' @description
#' The script, having deleted individuals, optionally identifies resultant
Expand Down
2 changes: 1 addition & 1 deletion R/gl.keep.loc.r
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#' @name gl.keep.loc
#' @title Remove all but the specified loci from a genlight \{adegenet\} object
#' @title Removes all but the specified loci from a genlight \{adegenet\} object
#' @description
#' The script returns a genlight object with the all but the specified loci
#' deleted.
Expand Down
2 changes: 1 addition & 1 deletion R/gl.keep.pop.r
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#' @name gl.keep.pop
#' @title Remove all but specified populations from a genlight \{adegenet\}
#' @title Removes all but specified populations from a genlight \{adegenet\}
#' object
#' @description
#' Individuals are assigned to populations based on the specimen metadata data
Expand Down
3 changes: 2 additions & 1 deletion R/gl.list.reports.r
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#' Prints dartR reports saved in tempdir
#' @name gl.list.reports
#' @title Prints dartR reports saved in tempdir
#'
#' @return Prints a table with all reports saved in tempdir. Currently the style
#' cannot be changed.
Expand Down
2 changes: 1 addition & 1 deletion R/gl.load.r
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Load an object from compressed binary format produced by gl.save()
#' Loads an object from compressed binary format produced by gl.save()
#'
#' This is a wrapper for readRDS()
#'
Expand Down
2 changes: 1 addition & 1 deletion R/gl.make.recode.ind.r
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#' @name gl.make.recode.ind
#' @title Create a proforma recode_ind file for reassigning individual
#' @title Creates a proforma recode_ind file for reassigning individual
#' (=specimen) names
#' @description
#' Renaming individuals may be required when there have been errors in
Expand Down
2 changes: 1 addition & 1 deletion R/gl.make.recode.pop.r
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#' @name gl.make.recode.pop
#' @title Create a proforma recode_pop_table file for reassigning population
#' @title Creates a proforma recode_pop_table file for reassigning population
#' names
#' @description
#' Renaming populations may be required when there have been errors in
Expand Down
2 changes: 1 addition & 1 deletion R/gl.map.structure.r
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#' @name gl.map.structure
#' @title Map a STRUCTURE plot using a genlight object
#' @title Maps a STRUCTURE plot using a genlight object
#' @description
#' This function takes the output of plotstructure (the q matrix) and maps the
#' q-matrix across using the population centers from the genlight object that
Expand Down
2 changes: 1 addition & 1 deletion R/gl.merge.pop.r
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#' @name gl.merge.pop
#' @title Merge two or more populations in a genlight object into one population
#' @title Merges two or more populations in a genlight object into one population
#' @description
#' Individuals are assigned to populations based on the specimen metadata data
#' file (csv) used with gl.read.dart().
Expand Down
2 changes: 1 addition & 1 deletion R/gl.nhybrids.r
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#' @name gl.nhybrids
#' @title Create an input file for the program NewHybrids and run it if
#' @title Creates an input file for the program NewHybrids and runs it if
#' NewHybrids is installed
#' @description
#' This function compares two sets of parental populations to identify loci that
Expand Down
8 changes: 4 additions & 4 deletions R/gl.outflank.r
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#' Function to identify loci under selection per population using the outflank
#' Identifies loci under selection per population using the outflank
#' method of Whitlock and Lotterhos (2015)
#'
#' @param gi a genlight or genind object, with a defined population structure
#' @param gi A genlight or genind object, with a defined population structure
#' [required].
#' @param plot A switch if a barplot is wanted [default TRUE].
#' @param LeftTrimFraction The proportion of loci that are trimmed from the
Expand All @@ -14,8 +14,8 @@
#' from a locus [default 0.1].
#' @param qthreshold The desired false discovery rate threshold for calculating
#' q-values [default 0.05].
#' @param ... additional parameters (see documentation of outflank on github)
#' @return returns an index of outliers and the full outflank list
#' @param ... additional parameters (see documentation of outflank on github).
#' @return Returns an index of outliers and the full outflank list
#' @details
#' This function is a wrapper around the outflank function provided by
#' Whitlock and Lotterhos. To be able to run this function the packages qvalue
Expand Down
2 changes: 1 addition & 1 deletion R/gl.percent.freq.r
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Generate percentage allele frequencies by locus and population
#' Generates percentage allele frequencies by locus and population
#'
#' This is a support script, to take SNP data or SilicoDArT presence/absence
#' data grouped into populations in a genlight object \{adegenet\} and generate
Expand Down
4 changes: 2 additions & 2 deletions R/gl.plot.heatmap.r
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#' @title gl.plot.heatmap
#' @title Represent a distance matrix as a heatmap
#' @name gl.plot.heatmap
#' @title Represents a distance matrix as a heatmap
#' @description
#' The script plots a heat map to represent the distances in the distance or
#' dissimilarity matrix. This function is a wrapper for
Expand Down
2 changes: 1 addition & 1 deletion R/gl.plot.structure.r
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#' @name gl.plot.structure
#'
#' @title Plot a STRUCTURE analysis using a genlight object
#' @title Plots a STRUCTURE analysis using a genlight object
#'
#' @description
#' This function takes a structure run object (output from
Expand Down
Loading

0 comments on commit c074331

Please sign in to comment.