Skip to content

Commit

Permalink
Retranslated computeDiffInCounts() (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
wleoncio committed Apr 10, 2024
1 parent c3b8da0 commit 55a36e8
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions R/computeDiffInCounts.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,14 @@ computeDiffInCounts <- function(rows, max_noalle, nloci, data) {
# % riveill� rows. rows pit�� olla vaakavektori.

diffInCounts <- zeros(max_noalle, nloci)
for (i in seq_len(nrow(data))) {
for (i in rows) { # yep, just one iteration
row <- data[i, ]
notEmpty <- as.matrix(matlab2r::find(row >= 0))

if (length(notEmpty) > 0) {
diffInCounts[row(notEmpty) + (notEmpty - 1) * max_noalle] <-
diffInCounts[row(notEmpty) + (notEmpty - 1) * max_noalle] + 1
element <- row[notEmpty] + (notEmpty - 1) * max_noalle
diffInCounts[element] <- diffInCounts[element] + 1
}
}
diffInCounts <- matrix(
data = diffInCounts[!is.na(diffInCounts)],
nrow = max_noalle,
ncol = nloci,
byrow = TRUE
)
return(diffInCounts)
}

0 comments on commit 55a36e8

Please sign in to comment.