Paulo Cecco
Paulo Cecco

Reputation: 45

How to know the different types of alelles for each SNP in a .ped file

I have a .ped file where I have in each column differents alelles for each SNP.

Flori JG05001 0 0 0 -9 T C A A T C C T T T C T G G A A G G C C C C G G G G A

Flori JG05002 0 0 0 -9 C C A A C C T T T T C T G G G A G A T C A C G G G G A

Flori JG05002 0 0 0 -9 C C A A C C T C T T C T G G G A G A T C A C G G G G A

Flori JG05002 0 0 0 -9 C C A A C C T C T T C T G G G A G A T C A C G G G G T

what I want is to know for each column the different types of alelles posibles, i.e. for column 7 I will have only the T and C possibilites.

Thank you

Upvotes: 0

Views: 20

Answers (1)

iod
iod

Reputation: 7592

Assuming the file is loaded into a data.frame named df, you can simply sapply unique:

sapply(df, unique)

This will give you a list where each element is a vector of all the alelles that have appeared in that column.

Upvotes: 1

Related Questions