Skip to content

Commit

Permalink
v1.09
Browse files Browse the repository at this point in the history
  • Loading branch information
jendelman committed Jun 8, 2024
1 parent 032e795 commit bc26ef7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: StageWise
Title: Two-stage analysis of multi-environment trials for genomic selection and GWAS
Version: 1.08
Version: 1.09
Author: Jeffrey B. Endelman
Maintainer: Jeffrey Endelman <[email protected]>
Description: Fully efficient, two stage analysis of multi-environment trials, including directional dominance and multi-trait genomic selection
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import(ggrepel)
import(methods)
importFrom(AGHmatrix,Amatrix)
importFrom(MASS,ginv)
importFrom(data.table,fread)
importFrom(ggforce,geom_ellipse)
importFrom(ggpubr,ggarrange)
importFrom(ggrepel,geom_text_repel)
Expand Down
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
Changes in 1.09
* changed read.csv to fread in read_geno

Changes in 1.08
* summary.var and dominance functions now work for multi-trait

Expand Down
14 changes: 9 additions & 5 deletions R/read_geno.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,19 @@
#' @return Variable of class \code{\link{class_geno}}.
#'
#' @export
#' @importFrom utils read.csv capture.output
#' @importFrom utils capture.output
#' @import Matrix
#' @importFrom AGHmatrix Amatrix
#' @importFrom data.table fread

read_geno <- function(filename, ploidy, map, min.minor.allele=5,
w=1e-5, ped=NULL, dominance=FALSE) {
if (any(w < 1e-5))
stop("Blending parameter should not be smaller than 1e-5")

data <- read.csv(file = filename,check.names=F)
data <- fread(file = filename, check.names=F, sep=",", header=T)
if (map) {
map <- data[,1:3]
map <- data.frame(data[,1:3])
colnames(map) <- c("marker","chrom","position")
geno <- as.matrix(data[,-(1:3)])
} else {
Expand All @@ -43,12 +44,15 @@ read_geno <- function(filename, ploidy, map, min.minor.allele=5,
position=numeric(0))
geno <- as.matrix(data[,-1])
}
rownames(geno) <- as.character(data$V1)
m <- nrow(geno)
id <- colnames(geno)

#check for recoding -1,0,1 to 0,1,2
if ((min(geno[1:min(m,1000),],na.rm=T)==-1) & (ploidy==2)) {
geno <- geno + 1
}
rownames(geno) <- data[,1]
id <- colnames(geno)

p <- apply(geno,1,mean,na.rm=T)/ploidy
n.minor <- apply(geno,1,function(z){
p <- mean(z,na.rm=T)/ploidy
Expand Down

0 comments on commit bc26ef7

Please sign in to comment.