
Filter Genotype Matrix Based on Parental Genotype
Source:R/filter_geno_by_parents.R
filter_geno_by_parents.Rdfilter_geno_by_parents filters a genotype matrix to retain only homozygous polymorphic markers
between two specified parents. It removes markers that do not meet the homozygous
polymorphism criteria (P1 = 0 & P2 = 2 or P1 = 2 & P2 = 0).
Value
A filtered data frame containing only markers that are homozygous polymorphic between the two parents.
Details
Retains markers where
parent1is0andparent2is2(A × B) orparent1is2andparent2is0(B × A). See the methods section of Braun et al. 2017 for more info on marker types. The Plant Genome Vol. 10 No. 3.
Examples
# Example genotype matrix
geno_data <- data.frame(
Marker1 = c(0, 1, 2, 0, 2),
Marker2 = c(2, 0, 2, 1, 0),
Parent1 = c(0, 2, 2, 0, 2),
Parent2 = c(2, 0, 0, 2, 0)
)
# Filter markers based on parents
filtered_geno <- filter_geno_by_parents(geno_data, "Parent1", "Parent2")
print(filtered_geno)
#> Marker1 Marker2 Parent1 Parent2
#> 1 0 2 0 2
#> 2 1 0 2 0
#> 3 2 2 2 0
#> 4 0 1 0 2
#> 5 2 0 2 0