Skip to content

Commit

Permalink
version 1.3.2, bugfix patch
Browse files Browse the repository at this point in the history
  • Loading branch information
gaynorr committed Nov 2, 2022
1 parent d46f67f commit ecfbc87
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 7 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: AlphaSimR
Type: Package
Title: Breeding Program Simulations
Version: 1.3.1.9990
Date: 2022-9-27
Version: 1.3.2
Date: 2022-11-2
Authors@R: c(person("Chris", "Gaynor", email = "[email protected]",
role = c("aut", "cre"), comment = c(ORCID = "0000-0003-0558-6656")),
person("Gregor", "Gorjanc", role = "ctb",
Expand Down
9 changes: 8 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
# AlphaSimR 1.3.1.9990
# AlphaSimR 1.3.2

*fixed column name bug with multiple traits in `setEBV`

*fixed CTD caused by `runMacs` when too many segSites are requested

*fixed missing names in GV when using `resetPop`

*fixed bug in `importTrait`

*`popVar` now deals with matrices having 1 row

# AlphaSimR 1.3.1

*updated link to Gaynor, 2017
Expand Down
11 changes: 11 additions & 0 deletions R/Class-Pop.R
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,11 @@ resetPop = function(pop,simParam=NULL){
simParam = get("SP",envir=.GlobalEnv)
}
pop@nTraits = simParam$nTraits

# Extract names to add back at the end
traitNames = colnames(pop@gv)

# Create empty slots for traits
pop@pheno = matrix(NA_real_,
nrow=pop@nInd,
ncol=simParam$nTraits)
Expand All @@ -756,6 +761,8 @@ resetPop = function(pop,simParam=NULL){
pop@gv = matrix(NA_real_,nrow=pop@nInd,
ncol=simParam$nTraits)
pop@fixEff = rep(1L,pop@nInd)

# Calculate genetic values
if(simParam$nTraits>=1){
for(i in 1:simParam$nTraits){
tmp = getGv(simParam$traits[[i]],pop,simParam$nThreads)
Expand All @@ -765,6 +772,10 @@ resetPop = function(pop,simParam=NULL){
}
}
}

# Add back trait names
colnames(pop@pheno) = colnames(pop@gv) = traitNames

return(pop)
}

Expand Down
6 changes: 6 additions & 0 deletions R/misc.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Converts a matrix to integer type
# Intended for genotype matrices of raw type
convToImat = function(X){
return(matrix(as.integer(X), nrow=nrow(X) ,ncol=ncol(X)))
}

#' @rdname isFemale
#' @title Test if individuals of a population are female or male
#'
Expand Down
4 changes: 0 additions & 4 deletions R/pullGeno.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
convToImat = function(X){
return(matrix(as.integer(X), nrow=nrow(X) ,ncol=ncol(X)))
}

selectLoci = function(chr, inLociPerChr, inLociLoc){
if(is.null(chr)){
return(list(lociPerChr=inLociPerChr,
Expand Down

0 comments on commit ecfbc87

Please sign in to comment.