0

I have marker information of hybrid parents and want to deduce hybrid genotypes based on their parent genotypes. Here is a subset sample of my data parent marker info. In each genotype column: 1) 0 - homozygous of one allele; 2) 1 - homozygous of the other allele; 3) 2 - heterozygous and 4) "999" indicates missing or not confident about the state.

I want to code the hybrid genotypes in this way hybrid marker coding method

How can I write R code to construct the genotypes of hybrids derived from crossing every parent to the other parents without reciprocal crossing, such as parent1/parent2, parent1/parent3 and parent3/parent5?

Here are the codes to generate the subsample.

Marker <- c(1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014)
Parent1 <- c(0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 0)
Parent2 <- c(0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0)
Parent3 <- c(0, 0, 0, 0, 0, 0, 0, 999, 0, 999, 0, 0, 0, 0)
Parent4 <- c(999, 0, 0, 0, 999, 0, 0, 0, 0, 1, 0, 0, 0, 0)
Parent5 <- c(0, 0, 0, 0, 0, 0, 2, 999, 0, 999, 0, 0, 0, 0)
Parent6 <- c(0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 0)
Parent7 <- c(999, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0)
Parent8 <- c(999, 0, 0, 0, 999, 0, 0, 0, 0, 1, 0, 0, 0, 0)
Genotypes <- cbind(Marker, Parent1, Parent2, Parent3, Parent4, Parent5, Parent6, Parent7, Parent8)

Many thanks,

Roman Luštrik
  • 69,533
  • 24
  • 154
  • 197
Sean WANG
  • 11
  • 2
  • Can you provide a [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example)? – Samuel Mar 27 '17 at 07:04
  • Hi Samuel, the example can be reproduced with the code above. – Sean WANG Mar 27 '17 at 07:33
  • Currently the question is quite broad and needs a bit more focus. R has structures to handle missing data, I suggest you use them. Please outline the algorithm you wish to implement, your attempt and show the point where you fall short and need our help. – Roman Luštrik Mar 27 '17 at 07:57
  • Hi Roman, thanks for your comments. It's easy to change the coding of missing data. The main point is to write a r code to do the work. I just want to write a loop that can deduce genotypes of hybrids derived from each pair of parents based on their parents marker information. Regards, – Sean WANG Mar 27 '17 at 08:11

0 Answers0