Skip to content

Commit

Permalink
Merge pull request #636 from green-striped-gecko/dev_luis
Browse files Browse the repository at this point in the history
Dev luis
  • Loading branch information
mijangos81 committed Sep 5, 2023
2 parents 2956097 + b9d1aa0 commit 0bb03f0
Show file tree
Hide file tree
Showing 14 changed files with 689 additions and 522 deletions.
223 changes: 111 additions & 112 deletions DESCRIPTION
@@ -1,112 +1,111 @@
Package: dartR
Type: Package
Title: Importing and Analysing 'SNP' and 'Silicodart' Data Generated by
Genome-Wide Restriction Fragment Analysis
Version: 2.9.7
Date: 2023-06-07
Authors@R: c(
person("Bernd", "Gruber", email="bernd.gruber@canberra.edu.au", role=c("aut","cre")),
person("Arthur", "Georges", email="georges@aerg.edu.au", role="aut"),
person("Jose L.", "Mijangos", email="Luis.MijangosAraujo@canberra.edu.au", role="aut"),
person("Carlo", "Pacioni",email="carlo.pacioni@delwp.vic.gov.au",role="aut"),
person("Peter J.", "Unmack", email="peter.mail2@unmack.net", role="ctb"),
person("Oliver", "Berry", email="oliver.berry@csiro.au", role="ctb" ),
person("Lindsay V.", "Clark", email="lvclark@illinois.edu", role="ctb"),
person("Floriaan", "Devloo-Delva",email="Floriaan.Devloo-Delva@csiro.au", role="ctb"),
person("Eric","Archer", email="eric.archer@noaa.gov", role="ctb")
)
Description: Functions are provided that facilitate the import and analysis of
'SNP' (single nucleotide polymorphism) and 'silicodart' (presence/absence) data.
The main focus is on data generated by 'DarT' (Diversity Arrays Technology),
however, data from other sequencing platforms can be used once 'SNP' or related
fragment presence/absence data from any source is imported. Genetic datasets
are stored in a derived 'genlight' format (package 'adegenet'), that allows for
a very compact storage of data and metadata. Functions are available for
importing and exporting of 'SNP' and 'silicodart' data, for reporting on and
filtering on various criteria (e.g. 'CallRate', heterozygosity, reproducibility,
maximum allele frequency). Additional functions are available for visualization
(e.g. Principle Coordinate Analysis) and creating a spatial representation
using maps. 'dartR' supports also the analysis of 3rd party software package
such as 'newhybrid', 'structure', 'NeEstimator' and 'blast'. Since version
2.0.3 we also implemented simulation functions, that allow to forward simulate
'SNP' dynamics under different population and evolutionary dynamics.
Comprehensive tutorials and support can be found at our 'github' repository:
github.com/green-striped-gecko/dartR/. If you want to cite 'dartR', you find
the information by typing citation('dartR') in the console.
VignetteBuilder: knitr
Encoding: UTF-8
Depends: R (>= 3.5), adegenet (>= 2.0.0), ggplot2, dplyr, dartR.data
biocViews:
Imports: ape,crayon,data.table,fields,foreach,gridExtra,MASS,methods,patchwork,plyr,PopGenReport,raster,reshape2,shiny,SNPRelate,sp (>= 1.6.1),StAMPP,stats,stringr,tidyr,utils,vegan
Suggests:
boot,
devtools,
directlabels,
dismo,
doParallel,
expm,
gdistance,
ggtern,
gganimate,
ggrepel,
grid,
gtable,
ggthemes,
gplots,
HardyWeinberg,
hierfstat,
igraph,
iterpc,
knitr,
label.switching,
lattice,
leaflet,
leaflet.minicharts,
markdown,
mmod,
networkD3,
parallel,
pegas,
pheatmap,
plotly,
poppr,
proxy,
purrr,
qvalue,
RColorBrewer,
Rcpp,
rgl,
rmarkdown,
rrBLUP,
scales,
seqinr,
shinyBS,
shinyjs,
shinythemes,
shinyWidgets,
SIBER,
snpStats,
stringi,
terra,
tibble,
vcfR,
zoo,
viridis,
testthat (>= 3.0.0)
License: GPL (>= 3)
LazyData: true
RoxygenNote: 7.2.3
NeedsCompilation: no
Packaged: 2023-06-02 23:28:46 UTC; Bernd Gruber
Author: Bernd Gruber [aut, cre],
Arthur Georges [aut],
Jose L. Mijangos [aut],
Carlo Pacioni [aut],
Peter J. Unmack [ctb],
Oliver Berry [ctb],
Lindsay V. Clark [ctb],
Floriaan Devloo-Delva [ctb],
Eric Archer [ctb]
Config/testthat/edition: 3
URL: https://green-striped-gecko.github.io/dartR/
BugReports: https://groups.google.com/g/dartr?pli=1
Package: dartR
Type: Package
Title: Importing and Analysing 'SNP' and 'Silicodart' Data Generated by
Genome-Wide Restriction Fragment Analysis
Version: 2.9.7
Date: 2023-06-07
Authors@R: c(
person("Bernd", "Gruber", email="bernd.gruber@canberra.edu.au", role=c("aut","cre")),
person("Arthur", "Georges", email="georges@aerg.edu.au", role="aut"),
person("Jose L.", "Mijangos", email="Luis.MijangosAraujo@canberra.edu.au", role="aut"),
person("Carlo", "Pacioni",email="carlo.pacioni@delwp.vic.gov.au",role="aut"),
person("Peter J.", "Unmack", email="peter.mail2@unmack.net", role="ctb"),
person("Oliver", "Berry", email="oliver.berry@csiro.au", role="ctb" ),
person("Lindsay V.", "Clark", email="lvclark@illinois.edu", role="ctb"),
person("Floriaan", "Devloo-Delva",email="Floriaan.Devloo-Delva@csiro.au", role="ctb"),
person("Eric","Archer", email="eric.archer@noaa.gov", role="ctb")
)
Description: Functions are provided that facilitate the import and analysis of
'SNP' (single nucleotide polymorphism) and 'silicodart' (presence/absence) data.
The main focus is on data generated by 'DarT' (Diversity Arrays Technology),
however, data from other sequencing platforms can be used once 'SNP' or related
fragment presence/absence data from any source is imported. Genetic datasets
are stored in a derived 'genlight' format (package 'adegenet'), that allows for
a very compact storage of data and metadata. Functions are available for
importing and exporting of 'SNP' and 'silicodart' data, for reporting on and
filtering on various criteria (e.g. 'CallRate', heterozygosity, reproducibility,
maximum allele frequency). Additional functions are available for visualization
(e.g. Principle Coordinate Analysis) and creating a spatial representation
using maps. 'dartR' supports also the analysis of 3rd party software package
such as 'newhybrid', 'structure', 'NeEstimator' and 'blast'. Since version
2.0.3 we also implemented simulation functions, that allow to forward simulate
'SNP' dynamics under different population and evolutionary dynamics.
Comprehensive tutorials and support can be found at our 'github' repository:
github.com/green-striped-gecko/dartR/. If you want to cite 'dartR', you find
the information by typing citation('dartR') in the console.
VignetteBuilder: knitr
Encoding: UTF-8
Depends: R (>= 3.5), adegenet (>= 2.0.0), ggplot2, dplyr, dartR.data
biocViews:
Imports: ape,crayon,data.table,fields,foreach,gridExtra,MASS,methods,patchwork,plyr,PopGenReport,raster,reshape2,shiny,SNPRelate,sp (>= 1.6.1),StAMPP,stats,stringr,tidyr,utils,vegan
Suggests:
boot,
devtools,
directlabels,
dismo,
doParallel,
expm,
gdistance,
ggtern,
gganimate,
ggrepel,
grid,
gtable,
ggthemes,
gplots,
HardyWeinberg,
hierfstat,
igraph,
iterpc,
knitr,
label.switching,
lattice,
leaflet,
leaflet.minicharts,
markdown,
mmod,
networkD3,
parallel,
pegas,
pheatmap,
plotly,
poppr,
proxy,
purrr,
qvalue,
RColorBrewer,
Rcpp,
rgl,
rmarkdown,
rrBLUP,
scales,
seqinr,
shinyBS,
shinyjs,
shinythemes,
shinyWidgets,
SIBER,
snpStats,
stringi,
terra,
tibble,
vcfR,
zoo,
viridis
License: GPL (>= 3)
LazyData: true
RoxygenNote: 7.2.3
NeedsCompilation: no
Packaged: 2023-06-02 23:28:46 UTC; Bernd Gruber
Author: Bernd Gruber [aut, cre],
Arthur Georges [aut],
Jose L. Mijangos [aut],
Carlo Pacioni [aut],
Peter J. Unmack [ctb],
Oliver Berry [ctb],
Lindsay V. Clark [ctb],
Floriaan Devloo-Delva [ctb],
Eric Archer [ctb]
Config/testthat/edition: 3
URL: https://green-striped-gecko.github.io/dartR/
BugReports: https://groups.google.com/g/dartr?pli=1
8 changes: 4 additions & 4 deletions R/dartR.r
Expand Up @@ -415,18 +415,18 @@ rbind.dartR <- function(...) {

if (!all(sapply(myList, function(x)
inherits(x, "genlight")))) {
stop("some objects are not genlight objects")
stop(error("Some objects are not genlight objects"))
}

## remove empty objects
myList <- myList[sapply(myList, nLoc) > 0 & sapply(myList, nInd) > 0]
if (length(myList) == 0) {
warning("All objects are empty")
warning("All objects are empty\n")
return(NULL)
}

if (length(unique(sapply(myList, nLoc))) != 1) {
stop("objects have different numbers of SNPs")
stop(error("Objects have different numbers of SNPs"))
}

## build output
Expand All @@ -439,7 +439,7 @@ rbind.dartR <- function(...) {
indNames(res) <- unlist(lapply(myList, indNames))
pop(res) <- factor(unlist(lapply(myList, pop)))

#hierachies are ignored in dart objects here
# hierarchies are ignored in dartR objects here
# Hierarchies are tricky. Using dplyr's bind_rows.
#res <- .rbind_strata(myList, res)

Expand Down
13 changes: 9 additions & 4 deletions R/gl.blast.r
Expand Up @@ -54,10 +54,15 @@
#'
#' \strong{Running BLAST}
#'
#' Four different tasks are supported: \itemize{ \item “megablast”, for very
#' similar sequences (e.g, sequencing errors) \item “dc-megablast”, typically
#' used for inter-species comparisons \item “blastn”, the traditional program
#' used for inter-species comparisons \item “blastn-short”, optimized for
#' Four different tasks are supported:
#' \itemize{
#' \item “megablast”, for very
#' similar sequences (e.g, sequencing errors)
#' \item “dc-megablast”, typically
#' used for inter-species comparisons
#' \item “blastn”, the traditional program
#' used for inter-species comparisons
#' \item “blastn-short”, optimized for
#' sequences less than 30 nucleotides }
#'
#' If you are running a BLAST alignment of similar sequences, for
Expand Down
40 changes: 20 additions & 20 deletions R/gl.drop.loc.r
Expand Up @@ -11,10 +11,10 @@
#' @param x Name of the genlight object [required].
#' @param loc.list A list of loci to be deleted
#' [required, if loc.range not specified].
#' @param first First of a range of loci to be deleted
#' @param first_tmp First of a range of loci to be deleted
#' [required, if loc.list not specified].
#' @param last Last of a range of loci to be deleted
#' [if not specified, last locus in the dataset].
#' @param last_tmp Last of a range of loci to be deleted
#' [if not specified, last_tmp locus in the dataset].
#' @param verbose Verbosity: 0, silent or fatal errors; 1, begin and end; 2,
#' progress but not results; 3, progress and results summary; 5, full report
#' [default 2 or as specified using gl.set.verbosity].
Expand All @@ -38,8 +38,8 @@
# Function
gl.drop.loc <- function(x,
loc.list = NULL,
first = NULL,
last = NULL,
first_tmp = NULL,
last_tmp = NULL,
verbose = NULL) {
# Preliminaries -------------
# SET VERBOSITY
Expand All @@ -55,7 +55,7 @@ gl.drop.loc <- function(x,
datatype <- utils.check.datatype(x, verbose = verbose)

# Function-specific error checking -----------
if (!is.null(loc.list) && !is.null(first)) {
if (!is.null(loc.list) && !is.null(first_tmp)) {
flag <- "both"
if (verbose >= 2) {
cat(report(
Expand All @@ -67,7 +67,7 @@ gl.drop.loc <- function(x,
if (verbose >= 2) {
cat(report(" List of loci to drop has been specified\n"))
}
} else if (!is.null(first)) {
} else if (!is.null(first_tmp)) {
flag <- "range"
if (verbose >= 2) {
cat(report(" Range of loci to drop has been specified\n"))
Expand Down Expand Up @@ -101,29 +101,29 @@ gl.drop.loc <- function(x,
}

if (flag == "range") {
if (first <= 0) {
if (first_tmp <= 0) {
cat(warn(
" Warning: Lower limit to range of loci cannot be less than 1, set to 1\n)"
))
first <- 1
first_tmp <- 1
}
if (first > nLoc(x)) {
if (first_tmp > nLoc(x)) {
cat(
warn(
" Warning: Upper limit to range of loci cannot be greater than the number of loci, set to",
nLoc(x),
"\n)"
)
)
last <- nLoc(x)
last_tmp <- nLoc(x)
}
if (first > last) {
if (first_tmp > last_tmp) {
cat(warn(
" Warning: Upper limit is smaller than lower limit, reversed\n"
))
tmp <- first
first <- last
last <- tmp
tmp <- first_tmp
first_tmp <- last_tmp
last_tmp <- tmp
}
}

Expand All @@ -136,11 +136,11 @@ gl.drop.loc <- function(x,
cat(report(" Deleting the specified loci\n"))
}

if (!is.null(first) && !is.null(loc.list)) {
list.from.range <- locNames(x)[first:last]
if (!is.null(first_tmp) && !is.null(loc.list)) {
list.from.range <- locNames(x)[first_tmp:last_tmp]
loc.list <- unique(c(loc.list, list.from.range))
} else if (!is.null(first)) {
loc.list <- locNames(x)[first:last]
} else if (!is.null(first_tmp)) {
loc.list <- locNames(x)[first_tmp:last_tmp]
}
if (length(loc.list) == 0) {
cat(warn(
Expand All @@ -150,7 +150,7 @@ gl.drop.loc <- function(x,
} else {
# Remove loci flagged for deletion

x2 <- x[,!x$loc.names %in% loc.list]
x2 <- x[,which(!x$loc.names %in% loc.list)]
x2@other$loc.metrics <- x@other$loc.metrics[!x$loc.names %in% loc.list,]
}
# End block -----------
Expand Down

0 comments on commit 0bb03f0

Please sign in to comment.