Skip to content

Commit

Permalink
# radiator 1.3.2 2024-04-30
Browse files Browse the repository at this point in the history
* works with R 4.3.4
* Fix issue #186 related some particular DArT files
  • Loading branch information
thierrygosselin committed Apr 30, 2024
1 parent cae66c8 commit db231cf
Show file tree
Hide file tree
Showing 12 changed files with 131 additions and 41 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: radiator
Type: Package
Title: RADseq Data Exploration, Manipulation and Visualization using R
Version: 1.3.1
Date: 2024-04-24
Version: 1.3.2
Date: 2024-04-30
Encoding: UTF-8
Authors@R: c(
person("Thierry", "Gosselin", email = "[email protected]", role = c("aut", "cre")),
Expand Down
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# radiator 1.3.2 2024-04-30

* works with R 4.3.4
* Fix issue #186 related some particular DArT files



# radiator 1.3.1 2024-04-24

* works with R 4.3.3
Expand Down
3 changes: 0 additions & 3 deletions R/filter_coverage.R
Original file line number Diff line number Diff line change
Expand Up @@ -197,15 +197,12 @@ filter_coverage <- function(
if (interactive.filter) message("\nStep 1. Coverage visualization and helper table\n")

# Generate coverage stats-----------------------------------------------------
# info <- extract_coverage(gds = data, individuals = FALSE, markers = TRUE, dp = TRUE, ad = FALSE, verbose = verbose)

info <- generate_stats(
gds = data,
individuals = FALSE,
markers = TRUE,
missing = FALSE,
coverage = TRUE,
# allele.coverage = TRUE,
allele.coverage = FALSE,
mac = FALSE,
heterozygosity = FALSE,
Expand Down
5 changes: 4 additions & 1 deletion R/filter_dart_reproducibility.R
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,10 @@ filter_dart_reproducibility <- function(
if (verbose) message("File written: dart_reproducibility_stats.tsv")

# Generate box plot ---------------------------------------------------------
outlier.rep <- ceiling(rep.stats[[8]] * 1000) / 1000
# Previously using IQR and I think it's an error that was introduced.
# pretty sure it should be the outlier low threshold..
# outlier.rep <- ceiling(rep.stats[[8]] * 1000) / 1000
outlier.rep <- ceiling(rep.stats[["OUTLIERS_LOW"]] * 1000) / 1000
bp.filename <- stringi::stri_join("dart_reproducibility_boxplot_", file.date, ".pdf")
rep.fig <- boxplot_stats(
data = rep.stats,
Expand Down
84 changes: 66 additions & 18 deletions R/gds.R
Original file line number Diff line number Diff line change
Expand Up @@ -908,18 +908,34 @@ extract_genotypes_metadata <- function(
sum <- summary_gds(gds, verbose = FALSE)
n.obs <- sum$n.ind * sum$n.markers
if (nrow(genotypes.meta) != n.obs) {

m.s <- "M_SEQ"
if ("MARKERS" %in% genotypes.meta.select) m.s <- "MARKERS"
i.s <- "ID_SEQ"
if ("INDIVIDUALS" %in% genotypes.meta.select) m.s <- "INDIVIDUALS"

markers <- extract_markers_metadata(
gds = gds,
markers.meta.select = "MARKERS",
markers.meta.select = m.s,
whitelist = TRUE
) %$% MARKERS
)
markers <- markers[[m.s]]

individuals <- extract_individuals_metadata(
gds = gds,
ind.field.select = "INDIVIDUALS",
ind.field.select = i.s,
whitelist = TRUE
) %$% INDIVIDUALS
genotypes.meta %<>%
dplyr::filter(MARKERS %in% markers, INDIVIDUALS %in% individuals)
)
individuals <- individuals[[i.s]]

genotypes.meta <- dplyr::filter(
.data = genotypes.meta,
genotypes.meta[[m.s]] %in% markers,
genotypes.meta[[i.s]] %in% individuals
)

# genotypes.meta %<>%
# dplyr::filter(MARKERS %in% markers, INDIVIDUALS %in% individuals)
}
}
if (!whitelist && !blacklist && !rlang::has_name(genotypes.meta, "FILTERS")) {
Expand Down Expand Up @@ -2463,6 +2479,7 @@ generate_stats <- function(
)
if (!"DP" %in% got.coverage && !"READ_DEPTH" %in% got.coverage) coverage <- FALSE
if (!"AD" %in% got.coverage) allele.coverage <- FALSE
if ("ALLELE_ALT_DEPTH" %in% got.coverage) allele.coverage <- TRUE
if (!exhaustive) allele.coverage <- FALSE
got.coverage <- NULL
}
Expand Down Expand Up @@ -2578,20 +2595,51 @@ generate_stats <- function(


if (ad) {
#temp object contains AD for REF and ALT
ref <- SeqArray::seqGetData(
gdsfile = gds,
var.name = "annotation/format/AD"
)$data


# to extract the REF and ALT
column.vec <- seq_len(length.out = dim(ref)[2])
alt <- ref[, column.vec %% 2 == 0]
alt[alt == 0] <- NA
ref <- ref[, column.vec %% 2 == 1]
ref[ref == 0] <- NA
column.vec <- NULL
if ("dart" %in% data.source) {
dart.data <- radiator::extract_genotypes_metadata(
gds = gds,
genotypes.meta.select = c("M_SEQ", "ID_SEQ", "ALLELE_ALT_DEPTH", "ALLELE_REF_DEPTH"),
whitelist = TRUE
)

ref <- radiator::rad_wide(
x = dart.data,
formula = "ID_SEQ ~ M_SEQ",
values_from = "ALLELE_REF_DEPTH"
) %>%
dplyr::select(-ID_SEQ)
colnames(ref) <- NULL
ref <- as.matrix(ref)

alt <- radiator::rad_wide(
x = dart.data,
formula = "ID_SEQ ~ M_SEQ",
values_from = "ALLELE_ALT_DEPTH"
) %>%
dplyr::select(-ID_SEQ)
colnames(alt) <- NULL
alt <- as.matrix(alt)
dart.data <- NULL


} else {
#temp object contains AD for REF and ALT
ref <- SeqArray::seqGetData(
gdsfile = gds,
var.name = "annotation/format/AD"
)$data


# to extract the REF and ALT
column.vec <- seq_len(length.out = dim(ref)[2])
alt <- ref[, column.vec %% 2 == 0]
alt[alt == 0] <- NA
ref <- ref[, column.vec %% 2 == 1]
ref[ref == 0] <- NA
column.vec <- NULL
}

ad_f <- function(coverage.stats, x, margin = c("markers", "individuals")) {

Expand Down
1 change: 1 addition & 0 deletions R/radiator.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@


radiator_common_arguments <- function(
interactive.filter = TRUE,
gds,
data,
parallel.core = parallel::detectCores() - 1,
Expand Down
1 change: 1 addition & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ packages: `gdsfmt` and
devtools::package_info(pkgs = "SeqArray") # to verify version
# If manually installing SeqArray is necessary
install.packages("BiocManager")
BiocManager::install("SeqArray")
```

Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
[![Project Status: Active – The project has reached a stable, usable
state and is being actively
developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active)
[![packageversion](https://img.shields.io/badge/Package%20version-1.3.1-orange.svg)](commits/master)
[![Last-changedate](https://img.shields.io/badge/last%20change-2024--04--24-brightgreen.svg)](/commits/master)
[![packageversion](https://img.shields.io/badge/Package%20version-1.3.2-orange.svg)](commits/master)
[![Last-changedate](https://img.shields.io/badge/last%20change-2024--04--30-brightgreen.svg)](/commits/master)
[![R-CMD-check](https://github.com/thierrygosselin/radiator/workflows/R-CMD-check/badge.svg)](https://github.com/thierrygosselin/radiator/actions)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3687060.svg)](https://doi.org/10.5281/zenodo.3687060)
<!-- badges: end -->
Expand Down Expand Up @@ -56,6 +56,7 @@ installations, linked to CRAN & Bioconductor tango problems:
devtools::package_info(pkgs = "SeqArray") # to verify version

# If manually installing SeqArray is necessary
install.packages("BiocManager")
BiocManager::install("SeqArray")
```

Expand Down
11 changes: 6 additions & 5 deletions man/radiator_common_arguments.Rd

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

18 changes: 12 additions & 6 deletions vignettes/rad_genomics_computer_setup.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## ---- include = FALSE---------------------------------------------------------
## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(collapse = TRUE, comment = "#>")

## ----eval=FALSE---------------------------------------------------------------
Expand All @@ -21,25 +21,31 @@ knitr::opts_chunk$set(collapse = TRUE, comment = "#>")
## ----eval=FALSE---------------------------------------------------------------
# file.exists("~/.Renviron")

## ---- eval=FALSE--------------------------------------------------------------
## ----eval=FALSE---------------------------------------------------------------
# Sys.getenv("LD_LIBRARY_PATH")
# # [1]""

## ---- eval=FALSE--------------------------------------------------------------
## ----eval=FALSE---------------------------------------------------------------
# # in R:
# Sys.setenv(LD_LIBRARY_PATH="/usr/local/lib/")
# # For Linux you could use: /usr/local/lib/:/usr/lib64

## ---- eval=FALSE--------------------------------------------------------------
## ----eval=FALSE---------------------------------------------------------------
# Sys.setenv(LD_LIBRARY_PATH="/usr/local/lib64/R/lib:/lib:/usr/local/lib64:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.222.b10-0.amzn2.0.1.x86_64/jre/lib/amd64/server:/usr/local/lib/:/usr/lib64")

## ---- eval=FALSE--------------------------------------------------------------
## ----eval=FALSE---------------------------------------------------------------
# install.packages("rgeos", repos="http://R-Forge.R-project.org", type="source")
# install.packages("rgdal", repos="http://R-Forge.R-project.org", type="source")
# devtools::install_github("r-spatial/sf", configure.args = "--with-proj-lib=/usr/local")
# install.packages("adegenet")

## ---- eval=FALSE--------------------------------------------------------------
## ----eval=FALSE---------------------------------------------------------------
# BiocManager::install("SeqArray")

## ----eval=FALSE---------------------------------------------------------------
# remotes::install_local(path = "SeqArray_latest.tar.gz")

## ----eval=FALSE---------------------------------------------------------------
# Error: C stack usage 7971092 is too close to the limit

## ----eval=FALSE---------------------------------------------------------------
Expand Down
16 changes: 16 additions & 0 deletions vignettes/rad_genomics_computer_setup.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,22 @@ devtools::install_github("r-spatial/sf", configure.args = "--with-proj-lib=/usr/
install.packages("adegenet")
```

## Error: `HTTP status was 404 Not Found`

This error is sometimes poping after a new R upgrade. Try installing the problematic package differently.


Instead of:

```{r, eval=FALSE}
BiocManager::install("SeqArray")
```


Try:
```{r, eval=FALSE}
remotes::install_local(path = "SeqArray_latest.tar.gz")
```


## Error: `C stacks usage`
Expand Down
17 changes: 13 additions & 4 deletions vignettes/rad_genomics_computer_setup.html

Large diffs are not rendered by default.

0 comments on commit db231cf

Please sign in to comment.