Translated computeDiffInCounts
This commit is contained in:
parent
203835b866
commit
0b6a899de8
1 changed files with 17 additions and 0 deletions
17
R/computeDiffInCounts.R
Normal file
17
R/computeDiffInCounts.R
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
computeDiffInCounts <- function(rows, max_noalle, nloci, data) {
|
||||||
|
# % Muodostaa max_noalle*nloci taulukon, jossa on niiden alleelien
|
||||||
|
# % lukum<75><6D>r<EFBFBD>t (vastaavasti kuin COUNTS:issa), jotka ovat data:n
|
||||||
|
# % riveill<6C> rows. rows pit<69><74> olla vaakavektori.
|
||||||
|
|
||||||
|
diffInCounts <- zeros(max_noalle, nloci)
|
||||||
|
for (i in rows) {
|
||||||
|
row <- data[i, ]
|
||||||
|
notEmpty <- find(row>=0)
|
||||||
|
|
||||||
|
if (length(notEmpty) > 0) {
|
||||||
|
diffInCounts(row(notEmpty) + (notEmpty - 1) * max_noalle) <-
|
||||||
|
diffInCounts(row(notEmpty) + (notEmpty - 1) * max_noalle) + 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(diffInCounts)
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue