Hi guys,
I have an R programming question. I want to compare the genotype (.GT
columns) with the given alleles (.allele
columns) in dataframe df1
and see if they are concordant or not. The rule is that if there is only one allele, it should be 0/0. If there are two alleles (for example GA), the genotype should be 0/1 and that is why I have mismatch in the concordance column for GA. So, A, T, G or C individually is 0/0 and in pair combination is 0/1. Based on this information, I want to add new concordance column next to every two columns that are compared with and have match or mismatch result in concordance column. This concordance column should be cbind next to every compared pair of column and get Result
. Could you please help me get this done. Thank you.
df1
1.allele 1.GT 2.allele 2.GT
A 0/0 A 0/0
GA 0/0 CT 0/1
C 0/0 G 0/0
Result
1.allele 1.GT 1.Concordance 2.allele 2.GT 2.Concordance
A 0/0 match A 0/0 match
GA 0/0 mismatch CT 0/1 match
C 0/0 match G 0/0 match
What is the second "Concordance" column for?
second concordance is for 2. columns, and since there is no mismatch it's left blank.
Are there also homozygous SNPs, such as GG or TT?
No, there are not, Thank you.