Skip to content

Commit

Permalink
bug fix in the compilation results section when not using pop.id.star…
Browse files Browse the repository at this point in the history
…t and pop.id.end (bug introduced in version 0.2.2)
  • Loading branch information
thierrygosselin committed Apr 22, 2016
1 parent ed74974 commit 0cc864a
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 4 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: assigner
Type: Package
Title: Assignment Analysis with GBS/RADseq Data using R
Version: 0.2.2
Date: 2016-04-15
Version: 0.2.3
Date: 2016-04-23
Encoding: UTF-8
Authors@R: c(
person("Thierry", "Gosselin", email = "[email protected]", role = c("aut", "cre")))
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export(assignment_mixture)
export(assignment_ngs)
export(dlr)
export(gsi_sim_binary)
export(import_subsamples)
export(install_gsi_sim)
export(plot_assignment)
export(plot_assignment_dlr)
Expand Down
2 changes: 1 addition & 1 deletion R/assignment_ngs.R
Original file line number Diff line number Diff line change
Expand Up @@ -2211,7 +2211,7 @@ package and update your whitelist")
METHOD = rep(sampling.method, n()),
MISSING_DATA = rep(missing.data, n())
) %>%
select(INDIVIDUALS, ANALYSIS, CURRENT, INFERRED, SCORE, SECOND_BEST_POP, SECOND_BEST_SCORE, MARKER_NUMBER, METHOD, MISSING_DATA) %>%
select(INDIVIDUALS, CURRENT, INFERRED, SCORE, SECOND_BEST_POP, SECOND_BEST_SCORE, MARKER_NUMBER, METHOD, MISSING_DATA) %>%
arrange(CURRENT)
)
}
Expand Down
46 changes: 46 additions & 0 deletions R/import_subsamples.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Write a dataframe containing all the subsample individual assignment

#' @name import_subsamples
#' @title Import individual's assignment results of different subsample folder.
#' @description This function will import all the individual's assignment results
#' of different subsample folder into R.
#' @param dir.path The path to the directory containing the subsample folders.
#' @param imputations (logical) Was the data imputed or not.
#' Default: \code{imputations = FALSE}
#' @return A data frame of all the individual's assignment, with iterations and subsample.

#' @export
#' @rdname import_subsamples
#' @import dplyr
#' @import stringi


#' @examples
#' \dontrun{
#' subsamples.data <- import_subsamples(
#' dir.path = "assignment_analysis_method_random_imputations_rf_populations",
#' imputations = TRUE
#' )
#' }

#' @author Thierry Gosselin \email{thierrygosselin@@icloud.com}

import_subsamples <- function(dir.path, imputations){
if (missing (dir.path)) stop("dir.path argument missing")
if (missing (imputations)) imputations <- FALSE

subsample.folders <- list.files(path = dir.path, pattern = "subsample_", full.names = FALSE)
data <- list()
for (i in subsample.folders) {
sub.name <- stri_replace_all_fixed(str = i, pattern = "_", replacement = ".", vectorize_all = FALSE)
if (imputations == TRUE){
filename <- stri_paste(i, "/","assignment.random.imputed.results.individuals.iterations.", sub.name, ".tsv")
} else {
filename <- stri_paste(i, "/","assignment.random.no.imputation.results.individuals.iterations.", sub.name, ".tsv")
}
subsample.data <- read_tsv(file = filename, col_names = TRUE) #%>% filter (MISSING_DATA == 'no.imputation')
data[[i]] <- subsample.data
}
data <- as_data_frame(bind_rows(data))
return(data)
}
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ The Amazon image can be imported into Google Cloud Compute Engine to start a new

## New

**v.0.2.3**
* bug fixed in the compilation results section when no pop.id.start and end are used.

**v.0.2.1**
* updated the function `assignment_mixture` with `sampling.method = "ranked"` and
`assignment.analysis = "adegenet"`.
Expand Down
2 changes: 1 addition & 1 deletion inst/CITATION
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ year = "2016",
author = personList(as.person("Thierry Gosselin")),
url = "https://github.com/thierrygosselin/stackr",
doi = "http://dx.doi.org/10.5281/zenodo.46723",
textVersion = paste("Gosselin T (2016). assigner: Assignment Analysis with GBS/RAD Data using R. R package version 0.1.9. https://github.com/thierrygosselin/assigner. doi : 10.5281/zenodo.46723")
textVersion = paste("Gosselin T (2016). assigner: Assignment Analysis with GBS/RAD Data using R. R package version 0.2.3. https://github.com/thierrygosselin/assigner. doi : 10.5281/zenodo.47452")
)
33 changes: 33 additions & 0 deletions man/import_subsamples.Rd

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

0 comments on commit 0cc864a

Please sign in to comment.