76AC3EC-contents 1.25 KB
Newer Older
Marie Bourdon's avatar
Marie Bourdon committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#' @title Exclude markers that were not genotyped in the reference strains
#'
#' @description This functions uses the dataframe produced by the tab_mark function and fills the "exclude" column for all the markers that were genotyped in the individuals of the cross but not in the reference strains. This is useful if the parental strains of the cross were not genotyped with the individuals and a previous genotyping result is used. Indeed, changes in the markers of the array may have happened. We recommend always using this function in order to avoid errors.
#' @param tab data frame obtained with tab_mark function
#' @param ref data frame with the reference genotypes of mouse lines
#'
#' @import dplyr
#'
#' @export
#'
mark_match <- function(tab,  #tab_mark df
                       ref){  #strain ref geno file

  #finds SNPs that are in both files:
  snp_strains <- as.character(ref$marker) #extracts SNPs in strains ref geno file
16
  snp_genfile <- as.character(tab$marker) #extracts SNPs in cross geno file
Marie Bourdon's avatar
Marie Bourdon committed
17
18
19
20
  snp <- intersect(snp_strains,snp_genfile) #take intercept


  #add results in exclude column
21
  return(tab %>% mutate(exclude_match=ifelse(!marker %in% snp,
Marie Bourdon's avatar
Marie Bourdon committed
22
23
24
25
                                             1,
                                             0)))

}