Skip to content

Commit

Permalink
Fixed a significant error in gl.filter.heterozygosity, brought to our…
Browse files Browse the repository at this point in the history
… attention by Gabrielle.
  • Loading branch information
biomatix committed Sep 1, 2021
1 parent 72c1688 commit d95a9eb
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions R/gl.filter.heterozygosity.r
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ gl.filter.heterozygosity <- function(x,
# For each individual determine counts of hets, homs and NAs
c.na <- array(NA, nInd(x))
c.hets <- array(NA, nInd(x))
#c.hom0 <- array(NA, nInd(x))
#c.hom2 <- array(NA, nInd(x))
for (i in 1:nInd(x)){
c.na[i] <- sum(is.na(m[i,]))/nInd(x)
c.hets[i] <- sum(m[i,]==1,na.rm=TRUE)/(nInd(x)-c.na[i])
#c.hom0[i] <- sum(m[i,]==0,na.rm=TRUE)/(nInd(x)-c.na[i])
#c.hom2[i] <- sum(m[i,]==2,na.rm=TRUE)/(nInd(x)-c.na[i])
c.hom0 <- array(NA, nInd(x))
c.hom2 <- array(NA, nInd(x))
for (i in 1:nInd(x)) {
c.na[i] <- sum(is.na(m[i, ]))
c.hets[i] <- sum(m[i, ] == 1, na.rm = TRUE)/(nLoc(x) - c.na[i])
c.hom0[i] <- sum(m[i, ] == 0, na.rm = TRUE)/(nLoc(x) - c.na[i])
c.hom2[i] <- sum(m[i, ] == 2, na.rm = TRUE)/(nLoc(x) - c.na[i])
}

if (verbose >=2 ) {
Expand Down

0 comments on commit d95a9eb

Please sign in to comment.