Skip to content

Commit

Permalink
If no genotypes left for masking at the given marker, skip this marker.
Browse files Browse the repository at this point in the history
  • Loading branch information
inzilico committed Oct 5, 2017
1 parent fb4fae0 commit a72e0e6
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,17 @@ GenerateMask <- function(m, masked, size){
# A new mask as a binary matrix

for (j in seq_len(ncol(m))) {

ind <- which(masked[, j] == 0)
add <- sample(ind, size[j])

# If no genotypes left for masking skip this position
if(length(ind) == 0 || size[j] == 0) next

# Sample
if(length(ind) >= size[j]) {
add <- sample(ind, size[j])
} else { add <- ind }

m[add, j] <- 1
}
m
Expand Down

0 comments on commit a72e0e6

Please sign in to comment.