Retranslated computeDiffInCounts() (#24)
This commit is contained in:
parent
c3b8da0012
commit
55a36e81ae
1 changed files with 3 additions and 9 deletions
|
|
@ -4,20 +4,14 @@ computeDiffInCounts <- function(rows, max_noalle, nloci, data) {
|
|||
# % riveill<6C> rows. rows pit<69><74> 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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue