(this will be a supposition because the number are higher but to make things easier)
Imagine that you have genotyped 10 persons and you have 3 SNIPS each one with 2 alels. then you end up with a matrix like this:
, , 1
[,1] | [,2] | [,3] | [,4] | [,5] | [,6] | [,7] | [,8] | [,9] | [,10] | |
---|---|---|---|---|---|---|---|---|---|---|
[1,] | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 |
[2,] | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 |
, , 2
[,1] | [,2] | [,3] | [,4] | [,5] | [,6] | [,7] | [,8] | [,9] | [,10] | |
---|---|---|---|---|---|---|---|---|---|---|
[1,] | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 |
[2,] | 1 | 0 | 1 | 1 | 0 | 1 | 0 | 1 | 0 | 0 |
, , 3
[,1] | [,2] | [,3] | [,4] | [,5] | [,6] | [,7] | [,8] | [,9] | [,10] | |
---|---|---|---|---|---|---|---|---|---|---|
[1,] | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 |
[2,] | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 |
I would transform my array and put: something like:
- if there are two 0 on the same column then is a 0.
- if there is a 0 and a 1 then is a 1.
- if there is a 1 and a 0 then is a 1.
- if there are two 1 then is a 2.
I think is more easy to understand with visually.
, , 1
[,1] | [,2] | [,3] | [,4] | [,5] | [,6] | [,7] | [,8] | [,9] | [,10] | |
---|---|---|---|---|---|---|---|---|---|---|
[1,] | 0 | 0 | 0 | 1 | 1 | 2 | 0 | 2 | 0 | 0 |
, , 2
[,1] | [,2] | [,3] | [,4] | [,5] | [,6] | [,7] | [,8] | [,9] | [,10] | |
---|---|---|---|---|---|---|---|---|---|---|
[1,] | 2 | 0 | 1 | 1 | 1 | 2 | 0 | 2 | 0 | 0 |
, , 3
[,1] | [,2] | [,3] | [,4] | [,5] | [,6] | [,7] | [,8] | [,9] | [,10] | |
---|---|---|---|---|---|---|---|---|---|---|
[1,] | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 0 | 0 |
And then transform it into a matrix like this (persons x SNIPS)
[,1] | [,2] | [,3] | [,4] | [,5] | [,6] | [,7] | [,8] | [,9] | [,10] | |
---|---|---|---|---|---|---|---|---|---|---|
[1,] | 0 | 0 | 0 | 1 | 1 | 2 | 0 | 2 | 0 | 0 |
[2,] | 2 | 0 | 1 | 1 | 1 | 2 | 0 | 2 | 0 | 0 |
[3,] | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 0 | 0 |
I usually use R but if someone do this with pyton i can handle it. If someone can help me it will be really helpfull. Thankyou.