How to make combinations of genotypes given an allele dataframe?
0
0
Entering edit mode
3.2 years ago

Given a pandas data frame where (I'm new to this so I'm not even sure how to represent this here):

Name SNP1 SNP2 SNP3 SNP4
Allele1 A C T G
Allele2 C T G A
Allele3 C G A A

How do I create all the combinations of alleles (possible genotypes): Allele1/Allele1, Allele1/Allele2, Allele1/Allele3, Allele2/Allele2, Allele2/Allele3, Allele3/Allele3, like so:

Name SNP1 SNP2 SNP3 SNP4
Allele1/1 AA CC TT GG
Allele1/2 AC CT TG GA
Allele1/3 AC CG TA GA
Allele2/2 CC TT GG AA
Allele2/3 CC TG GA AA
Allele3/3 CC GG AA AA
python pandas matrix dataframe • 929 views
ADD COMMENT

Login before adding your answer.

Traffic: 2075 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6