diff --git a/.Rhistory b/.Rhistory
index f13d7256d665e2232f51181160cd860ae5e2347c..4617df8050a9f9a7c663ae9ae45c5de0d5a36d0e 100644
--- a/.Rhistory
+++ b/.Rhistory
@@ -1,512 +1,512 @@
-#filter genotypes for non excluded markers in geno file
-geno <- geno %>% select(c(SNP.Name,Sample.ID,Allele1...Forward,Allele2...Forward)) %>% filter(SNP.Name %in% tab$SNP.Name)
-#recode parents' names to match column names nomenclature
-par1 <- make.names(par1)
-par2 <- make.names(par2)
-#keep parental lines genotypes
-colnames(ref) <- make.names(colnames(ref))
-ref <- ref %>% select(marker,chr,bp_mm10,!!sym(pos),!!sym(par1),!!sym(par2))
-}
-rqtl_file <- write_rqtl(geno=genos,pheno=phenos,tab=tab2,ref=strains,par1="parent1",par2="parent2",prefix="ind_",pos="cM_cox")
-}
-write_rqtl <- function(geno,pheno,tab,ref,par1,par2,prefix,pos,path=NA){
-#extract snps non excluded
-if("exclude_match" %in% colnames(tab)){
-tab <- tab %>% filter(exclude_match==0)
-}
-if("exclude_poly" %in% colnames(tab)){
-tab <- tab %>% filter(exclude_poly==0)
-}
-if("exclude_prop" %in% colnames(tab)){
-tab <- tab %>% filter(exclude_prop==0)
-}
-if("exclude_allele" %in% colnames(tab)){
-tab <- tab %>% filter(exclude_allele==0)
-}
-#filter genotypes for non excluded markers in geno file
-geno <- geno %>% select(c(SNP.Name,Sample.ID,Allele1...Forward,Allele2...Forward)) %>% filter(SNP.Name %in% tab$SNP.Name)
-#recode parents' names to match column names nomenclature
-par1 <- make.names(par1)
-par2 <- make.names(par2)
-#keep parental lines genotypes
-colnames(ref) <- make.names(colnames(ref))
-ref <- ref %>% select(marker,chr,bp_mm10,!!sym(pos),!!sym(par1),!!sym(par2))
-#merge genotypes with parents
-geno <- left_join(geno,ref,by=c("SNP.Name"="marker"))
-}
-rqtl_file <- write_rqtl(geno=genos,pheno=phenos,tab=tab2,ref=strains,par1="parent1",par2="parent2",prefix="ind_",pos="cM_cox")
-write_rqtl <- function(geno,pheno,tab,ref,par1,par2,prefix,pos,path=NA){
-#extract snps non excluded
-if("exclude_match" %in% colnames(tab)){
-tab <- tab %>% filter(exclude_match==0)
-}
-if("exclude_poly" %in% colnames(tab)){
-tab <- tab %>% filter(exclude_poly==0)
-}
-if("exclude_prop" %in% colnames(tab)){
-tab <- tab %>% filter(exclude_prop==0)
-}
-if("exclude_allele" %in% colnames(tab)){
-tab <- tab %>% filter(exclude_allele==0)
-}
-#filter genotypes for non excluded markers in geno file
-geno <- geno %>% select(c(SNP.Name,Sample.ID,Allele1...Forward,Allele2...Forward)) %>% filter(SNP.Name %in% tab$SNP.Name)
-#recode parents' names to match column names nomenclature
-par1 <- make.names(par1)
-par2 <- make.names(par2)
-#keep parental lines genotypes
-colnames(ref) <- make.names(colnames(ref))
-ref <- ref %>% select(marker,chr,bp_mm10,!!sym(pos),!!sym(par1),!!sym(par2))
-#merge genotypes with parents
-geno <- left_join(geno,ref,by=c("SNP.Name"="marker"))
-#recode "-" in "N" in geno file
-geno <- geno %>% mutate(Allele1...Forward = recode(Allele1...Forward,
-"-" = "N"))
-geno <- geno %>% mutate(Allele2...Forward = recode(Allele2...Forward,
-"-" = "N"))
-}
-rqtl_file <- write_rqtl(geno=genos,pheno=phenos,tab=tab2,ref=strains,par1="parent1",par2="parent2",prefix="ind_",pos="cM_cox")
-#recode geno in factors with same levels
-geno <- geno %>% mutate(Allele1...Forward = factor(Allele1...Forward,levels=c("A","C","G","H","N","T")))
-write_rqtl <- function(geno,pheno,tab,ref,par1,par2,prefix,pos,path=NA){
-#extract snps non excluded
-if("exclude_match" %in% colnames(tab)){
-tab <- tab %>% filter(exclude_match==0)
-}
-if("exclude_poly" %in% colnames(tab)){
-tab <- tab %>% filter(exclude_poly==0)
-}
-if("exclude_prop" %in% colnames(tab)){
-tab <- tab %>% filter(exclude_prop==0)
-}
-if("exclude_allele" %in% colnames(tab)){
-tab <- tab %>% filter(exclude_allele==0)
-}
-#filter genotypes for non excluded markers in geno file
-geno <- geno %>% select(c(SNP.Name,Sample.ID,Allele1...Forward,Allele2...Forward)) %>% filter(SNP.Name %in% tab$SNP.Name)
-#recode parents' names to match column names nomenclature
-par1 <- make.names(par1)
-par2 <- make.names(par2)
-#keep parental lines genotypes
-colnames(ref) <- make.names(colnames(ref))
-ref <- ref %>% select(marker,chr,bp_mm10,!!sym(pos),!!sym(par1),!!sym(par2))
-#merge genotypes with parents
-geno <- left_join(geno,ref,by=c("SNP.Name"="marker"))
-#recode "-" in "N" in geno file
-geno <- geno %>% mutate(Allele1...Forward = recode(Allele1...Forward,
-"-" = "N"))
-geno <- geno %>% mutate(Allele2...Forward = recode(Allele2...Forward,
-"-" = "N"))
-#recode geno in factors with same levels
-geno <- geno %>% mutate(Allele1...Forward = factor(Allele1...Forward,levels=c("A","C","G","H","N","T")))
-geno <- geno %>% mutate(Allele2...Forward = factor(Allele2...Forward,levels=c("A","C","G","H","N","T")))
-}
-rqtl_file <- write_rqtl(geno=genos,pheno=phenos,tab=tab2,ref=strains,par1="parent1",par2="parent2",prefix="ind_",pos="cM_cox")
-write_rqtl <- function(geno,pheno,tab,ref,par1,par2,prefix,pos,path=NA){
-#extract snps non excluded
-if("exclude_match" %in% colnames(tab)){
-tab <- tab %>% filter(exclude_match==0)
-}
-if("exclude_poly" %in% colnames(tab)){
-tab <- tab %>% filter(exclude_poly==0)
-}
-if("exclude_prop" %in% colnames(tab)){
-tab <- tab %>% filter(exclude_prop==0)
-}
-if("exclude_allele" %in% colnames(tab)){
-tab <- tab %>% filter(exclude_allele==0)
-}
-#filter genotypes for non excluded markers in geno file
-geno <- geno %>% select(c(SNP.Name,Sample.ID,Allele1...Forward,Allele2...Forward)) %>% filter(SNP.Name %in% tab$SNP.Name)
-#recode parents' names to match column names nomenclature
-par1 <- make.names(par1)
-par2 <- make.names(par2)
-#keep parental lines genotypes
-colnames(ref) <- make.names(colnames(ref))
-ref <- ref %>% select(marker,chr,bp_mm10,!!sym(pos),!!sym(par1),!!sym(par2))
-#merge genotypes with parents
-geno <- left_join(geno,ref,by=c("SNP.Name"="marker"))
-#recode "-" in "N" in geno file
-geno <- geno %>% mutate(Allele1...Forward = recode(Allele1...Forward,
-"-" = "N"))
-geno <- geno %>% mutate(Allele2...Forward = recode(Allele2...Forward,
-"-" = "N"))
-#recode geno in factors with same levels
-geno <- geno %>% mutate(Allele1...Forward = factor(Allele1...Forward,levels=c("A","C","G","H","N","T")))
-geno <- geno %>% mutate(Allele2...Forward = factor(Allele2...Forward,levels=c("A","C","G","H","N","T")))
-#recode genotypes depending on parents' genotypes
-geno <- geno %>% mutate(Geno = case_when(
-#if one allele not genotyped:
-Allele1...Forward=="N" | Allele2...Forward=="N" ~ "NA",
-#if both alleles genotyped
-##homozygous 0
-Allele1...Forward==Allele2...Forward & Allele1...Forward==!!sym(par1) ~ "0",
-##homozygous 2
-Allele1...Forward==Allele2...Forward & Allele1...Forward==!!sym(par2) ~ "2",
-##heterozygous
-Allele1...Forward!=Allele2...Forward ~ "1",
-#if parental strains are N/H
-##homozygous for parent that is N/H
-###homozygous 0
-(!!sym(par1)%in%c("H","N") | !!sym(par2)%in%c("H","N")) &
-!!sym(par1)%in%c("H","N") ~ "0",
-###homozygous 2
-(!!sym(par1)%in%c("H","N") | !!sym(par2)%in%c("H","N")) &
-!!sym(par2)%in%c("H","N") ~ "2",
-)
-)
-}
-rqtl_file <- write_rqtl(geno=genos,pheno=phenos,tab=tab2,ref=strains,par1="parent1",par2="parent2",prefix="ind_",pos="cM_cox")
-write_rqtl <- function(geno,pheno,tab,ref,par1,par2,prefix,pos,path=NA){
-#extract snps non excluded
-if("exclude_match" %in% colnames(tab)){
-tab <- tab %>% filter(exclude_match==0)
-}
-if("exclude_poly" %in% colnames(tab)){
-tab <- tab %>% filter(exclude_poly==0)
-}
-if("exclude_prop" %in% colnames(tab)){
-tab <- tab %>% filter(exclude_prop==0)
-}
-if("exclude_allele" %in% colnames(tab)){
-tab <- tab %>% filter(exclude_allele==0)
-}
-#filter genotypes for non excluded markers in geno file
-geno <- geno %>% select(c(SNP.Name,Sample.ID,Allele1...Forward,Allele2...Forward)) %>% filter(SNP.Name %in% tab$SNP.Name)
-#recode parents' names to match column names nomenclature
-par1 <- make.names(par1)
-par2 <- make.names(par2)
-#keep parental lines genotypes
-colnames(ref) <- make.names(colnames(ref))
-ref <- ref %>% select(marker,chr,bp_mm10,!!sym(pos),!!sym(par1),!!sym(par2))
-#merge genotypes with parents
-geno <- left_join(geno,ref,by=c("SNP.Name"="marker"))
-#recode "-" in "N" in geno file
-geno <- geno %>% mutate(Allele1...Forward = recode(Allele1...Forward,
-"-" = "N"))
-geno <- geno %>% mutate(Allele2...Forward = recode(Allele2...Forward,
-"-" = "N"))
-#recode geno in factors with same levels
-geno <- geno %>% mutate(Allele1...Forward = factor(Allele1...Forward,levels=c("A","C","G","H","N","T")))
-geno <- geno %>% mutate(Allele2...Forward = factor(Allele2...Forward,levels=c("A","C","G","H","N","T")))
-#recode genotypes depending on parents' genotypes
-geno <- geno %>% mutate(Geno = case_when(
-#if one allele not genotyped:
-Allele1...Forward=="N" | Allele2...Forward=="N" ~ "NA",
-#if both alleles genotyped
-##homozygous 0
-Allele1...Forward==Allele2...Forward & Allele1...Forward==!!sym(par1) ~ "0",
-##homozygous 2
-Allele1...Forward==Allele2...Forward & Allele1...Forward==!!sym(par2) ~ "2",
-##heterozygous
-Allele1...Forward!=Allele2...Forward ~ "1",
-#if parental strains are N/H
-##homozygous for parent that is N/H
-###homozygous 0
-(!!sym(par1)%in%c("H","N") | !!sym(par2)%in%c("H","N")) &
-!!sym(par1)%in%c("H","N") ~ "0",
-###homozygous 2
-(!!sym(par1)%in%c("H","N") | !!sym(par2)%in%c("H","N")) &
-!!sym(par2)%in%c("H","N") ~ "2",
-)
-)
-#keep positions of markers
-markers <- geno %>% select(SNP.Name,chr,!!sym(pos)) %>% distinct()
-markers <- markers %>% arrange(chr,bp_mm10)
-#keep only interesting columns in geno file
-geno <- geno %>% arrange(chr,bp_mm10)
-geno <- geno %>% select(SNP.Name,Sample.ID,Geno)
-}
-rqtl_file <- write_rqtl(geno=genos,pheno=phenos,tab=tab2,ref=strains,par1="parent1",par2="parent2",prefix="ind_",pos="cM_cox")
-write_rqtl <- function(geno,pheno,tab,ref,par1,par2,prefix,pos,path=NA){
-#extract snps non excluded
-if("exclude_match" %in% colnames(tab)){
-tab <- tab %>% filter(exclude_match==0)
-}
-if("exclude_poly" %in% colnames(tab)){
-tab <- tab %>% filter(exclude_poly==0)
-}
-if("exclude_prop" %in% colnames(tab)){
-tab <- tab %>% filter(exclude_prop==0)
-}
-if("exclude_allele" %in% colnames(tab)){
-tab <- tab %>% filter(exclude_allele==0)
-}
-#filter genotypes for non excluded markers in geno file
-geno <- geno %>% select(c(SNP.Name,Sample.ID,Allele1...Forward,Allele2...Forward)) %>% filter(SNP.Name %in% tab$SNP.Name)
-#recode parents' names to match column names nomenclature
-par1 <- make.names(par1)
-par2 <- make.names(par2)
-#keep parental lines genotypes
-colnames(ref) <- make.names(colnames(ref))
-ref <- ref %>% select(marker,chr,bp_mm10,!!sym(pos),!!sym(par1),!!sym(par2))
-#merge genotypes with parents
-geno <- left_join(geno,ref,by=c("SNP.Name"="marker"))
-#recode "-" in "N" in geno file
-geno <- geno %>% mutate(Allele1...Forward = recode(Allele1...Forward,
-"-" = "N"))
-geno <- geno %>% mutate(Allele2...Forward = recode(Allele2...Forward,
-"-" = "N"))
-#recode geno in factors with same levels
-geno <- geno %>% mutate(Allele1...Forward = factor(Allele1...Forward,levels=c("A","C","G","H","N","T")))
-geno <- geno %>% mutate(Allele2...Forward = factor(Allele2...Forward,levels=c("A","C","G","H","N","T")))
-#recode genotypes depending on parents' genotypes
-geno <- geno %>% mutate(Geno = case_when(
-#if one allele not genotyped:
-Allele1...Forward=="N" | Allele2...Forward=="N" ~ "NA",
-#if both alleles genotyped
-##homozygous 0
-Allele1...Forward==Allele2...Forward & Allele1...Forward==!!sym(par1) ~ "0",
-##homozygous 2
-Allele1...Forward==Allele2...Forward & Allele1...Forward==!!sym(par2) ~ "2",
-##heterozygous
-Allele1...Forward!=Allele2...Forward ~ "1",
-#if parental strains are N/H
-##homozygous for parent that is N/H
-###homozygous 0
-(!!sym(par1)%in%c("H","N") | !!sym(par2)%in%c("H","N")) &
-!!sym(par1)%in%c("H","N") ~ "0",
-###homozygous 2
-(!!sym(par1)%in%c("H","N") | !!sym(par2)%in%c("H","N")) &
-!!sym(par2)%in%c("H","N") ~ "2",
-)
-)
-#keep positions of markers
-markers <- geno %>% select(SNP.Name,chr,!!sym(pos)) %>% distinct()
-markers <- markers %>% arrange(chr,bp_mm10)
-}
-rqtl_file <- write_rqtl(geno=genos,pheno=phenos,tab=tab2,ref=strains,par1="parent1",par2="parent2",prefix="ind_",pos="cM_cox")
-write_rqtl <- function(geno,pheno,tab,ref,par1,par2,prefix,pos,path=NA){
-#extract snps non excluded
-if("exclude_match" %in% colnames(tab)){
-tab <- tab %>% filter(exclude_match==0)
-}
-if("exclude_poly" %in% colnames(tab)){
-tab <- tab %>% filter(exclude_poly==0)
-}
-if("exclude_prop" %in% colnames(tab)){
-tab <- tab %>% filter(exclude_prop==0)
-}
-if("exclude_allele" %in% colnames(tab)){
-tab <- tab %>% filter(exclude_allele==0)
-}
-#filter genotypes for non excluded markers in geno file
-geno <- geno %>% select(c(SNP.Name,Sample.ID,Allele1...Forward,Allele2...Forward)) %>% filter(SNP.Name %in% tab$SNP.Name)
-#recode parents' names to match column names nomenclature
-par1 <- make.names(par1)
-par2 <- make.names(par2)
-#keep parental lines genotypes
-colnames(ref) <- make.names(colnames(ref))
-ref <- ref %>% select(marker,chr,bp_mm10,!!sym(pos),!!sym(par1),!!sym(par2))
-#merge genotypes with parents
-geno <- left_join(geno,ref,by=c("SNP.Name"="marker"))
-#recode "-" in "N" in geno file
-geno <- geno %>% mutate(Allele1...Forward = recode(Allele1...Forward,
-"-" = "N"))
-geno <- geno %>% mutate(Allele2...Forward = recode(Allele2...Forward,
-"-" = "N"))
-#recode geno in factors with same levels
-geno <- geno %>% mutate(Allele1...Forward = factor(Allele1...Forward,levels=c("A","C","G","H","N","T")))
-geno <- geno %>% mutate(Allele2...Forward = factor(Allele2...Forward,levels=c("A","C","G","H","N","T")))
-#recode genotypes depending on parents' genotypes
-geno <- geno %>% mutate(Geno = case_when(
-#if one allele not genotyped:
-Allele1...Forward=="N" | Allele2...Forward=="N" ~ "NA",
-#if both alleles genotyped
-##homozygous 0
-Allele1...Forward==Allele2...Forward & Allele1...Forward==!!sym(par1) ~ "0",
-##homozygous 2
-Allele1...Forward==Allele2...Forward & Allele1...Forward==!!sym(par2) ~ "2",
-##heterozygous
-Allele1...Forward!=Allele2...Forward ~ "1",
-#if parental strains are N/H
-##homozygous for parent that is N/H
-###homozygous 0
-(!!sym(par1)%in%c("H","N") | !!sym(par2)%in%c("H","N")) &
-!!sym(par1)%in%c("H","N") ~ "0",
-###homozygous 2
-(!!sym(par1)%in%c("H","N") | !!sym(par2)%in%c("H","N")) &
-!!sym(par2)%in%c("H","N") ~ "2",
-)
-)
-#keep positions of markers
-markers <- geno %>% select(SNP.Name,chr,!!sym(pos)) %>% distinct()
-markers <- markers %>% arrange(chr,bp_mm10)
-print(markers)
-}
-rqtl_file <- write_rqtl(geno=genos,pheno=phenos,tab=tab2,ref=strains,par1="parent1",par2="parent2",prefix="ind_",pos="cM_cox")
-#keep positions of markers
-markers <- geno %>% select(SNP.Name,chr,bp_mm10,!!sym(pos)) %>% distinct()
-write_rqtl <- function(geno,pheno,tab,ref,par1,par2,prefix,pos,path=NA){
-#extract snps non excluded
-if("exclude_match" %in% colnames(tab)){
-tab <- tab %>% filter(exclude_match==0)
-}
-if("exclude_poly" %in% colnames(tab)){
-tab <- tab %>% filter(exclude_poly==0)
-}
-if("exclude_prop" %in% colnames(tab)){
-tab <- tab %>% filter(exclude_prop==0)
-}
-if("exclude_allele" %in% colnames(tab)){
-tab <- tab %>% filter(exclude_allele==0)
-}
-#filter genotypes for non excluded markers in geno file
-geno <- geno %>% select(c(SNP.Name,Sample.ID,Allele1...Forward,Allele2...Forward)) %>% filter(SNP.Name %in% tab$SNP.Name)
-#recode parents' names to match column names nomenclature
-par1 <- make.names(par1)
-par2 <- make.names(par2)
-#keep parental lines genotypes
-colnames(ref) <- make.names(colnames(ref))
-ref <- ref %>% select(marker,chr,bp_mm10,!!sym(pos),!!sym(par1),!!sym(par2))
-#merge genotypes with parents
-geno <- left_join(geno,ref,by=c("SNP.Name"="marker"))
-#recode "-" in "N" in geno file
-geno <- geno %>% mutate(Allele1...Forward = recode(Allele1...Forward,
-"-" = "N"))
-geno <- geno %>% mutate(Allele2...Forward = recode(Allele2...Forward,
-"-" = "N"))
-#recode geno in factors with same levels
-geno <- geno %>% mutate(Allele1...Forward = factor(Allele1...Forward,levels=c("A","C","G","H","N","T")))
-geno <- geno %>% mutate(Allele2...Forward = factor(Allele2...Forward,levels=c("A","C","G","H","N","T")))
-#recode genotypes depending on parents' genotypes
-geno <- geno %>% mutate(Geno = case_when(
-#if one allele not genotyped:
-Allele1...Forward=="N" | Allele2...Forward=="N" ~ "NA",
-#if both alleles genotyped
-##homozygous 0
-Allele1...Forward==Allele2...Forward & Allele1...Forward==!!sym(par1) ~ "0",
-##homozygous 2
-Allele1...Forward==Allele2...Forward & Allele1...Forward==!!sym(par2) ~ "2",
-##heterozygous
-Allele1...Forward!=Allele2...Forward ~ "1",
-#if parental strains are N/H
-##homozygous for parent that is N/H
-###homozygous 0
-(!!sym(par1)%in%c("H","N") | !!sym(par2)%in%c("H","N")) &
-!!sym(par1)%in%c("H","N") ~ "0",
-###homozygous 2
-(!!sym(par1)%in%c("H","N") | !!sym(par2)%in%c("H","N")) &
-!!sym(par2)%in%c("H","N") ~ "2",
-)
-)
-#keep positions of markers
-markers <- geno %>% select(SNP.Name,chr,bp_mm10,!!sym(pos)) %>% distinct()
-print(markers)
-markers <- markers %>% arrange(chr,bp_mm10)
-}
-rqtl_file <- write_rqtl(geno=genos,pheno=phenos,tab=tab2,ref=strains,par1="parent1",par2="parent2",prefix="ind_",pos="cM_cox")
-knitr::opts_chunk$set(
-collapse = TRUE,
-comment = "#>"
-)
-library(dplyr)
-library(stuart)
-annot_mini <- read.csv(url("https://raw.githubusercontent.com/kbroman/MUGAarrays/master/UWisc/mini_uwisc_v2.csv"))
-data(genos)
-summary(genos)
-data(phenos)
-summary(phenos)
-strains <- geno_strains(ref=annot_mini,geno=genos,par1=c("StrainsA_1","StrainsA_2"),par2=c("StrainsB_1","StrainsB_2"),name1="parent1",name2="parent2")
-head(strains)
-genos <- genos %>% filter(!Sample.ID %in% c("StrainsA_1", "StrainsA_2", "StrainsB_1","StrainsB_2"))
-data(stuart_tab)
-summary(stuart_tab)
-tab2 <- mark_match(stuart_tab,ref=strains)
-tab2 %>% filter(exclude_match==1)
-tab2 <- mark_poly(tab2)
-head(tab2)
-tab2 <- mark_prop(tab2,cross="F2",homo=0.1,hetero=0.1)
-head(tab2)
-tab2 <- mark_allele(tab=tab2,ref=strains,par1="parent1",par2="parent2")
-tab2 %>% arrange(desc(exclude_allele)) %>% head()
-strains %>% filter(marker %in% c("gJAX00038569","gJAX00425031","gUNC12245354","gUNC15530876","gUNC21555204","gUNC21596600")) %>% arrange(marker) %>% select(marker,parent1,parent2)
-rqtl_file <- write_rqtl(geno=genos,pheno=phenos,tab=tab2,ref=strains,par1="parent1",par2="parent2",prefix="ind_",pos="cM_cox")
-devtools::build(path="/Users/mariebourdon/stuart_package/stuart",vignettes = FALSE)
-knitr::opts_chunk$set(
-collapse = TRUE,
-comment = "#>"
-)
-knitr::opts_chunk$set(
-collapse = TRUE,
-comment = "#>"
-)
-library(dplyr)
-library(stuart)
-annot_mini <- read.csv(url("https://raw.githubusercontent.com/kbroman/MUGAarrays/master/UWisc/mini_uwisc_v2.csv"))
-data(genos)
-summary(genos)
-data(phenos)
-summary(phenos)
-strains <- geno_strains(ref=annot_mini,geno=genos,par1=c("StrainsA_1","StrainsA_2"),par2=c("StrainsB_1","StrainsB_2"),name1="parent1",name2="parent2")
-head(strains)
-genos <- genos %>% filter(!Sample.ID %in% c("StrainsA_1", "StrainsA_2", "StrainsB_1","StrainsB_2"))
-data(stuart_tab)
-summary(stuart_tab)
-tab2 <- mark_match(stuart_tab,ref=strains)
-tab2 %>% filter(exclude_match==1)
-tab2 <- mark_poly(tab2)
-head(tab2)
-tab2 <- mark_prop(tab2,cross="F2",homo=0.1,hetero=0.1)
-head(tab2)
-tab2 <- mark_allele(tab=tab2,ref=strains,par1="parent1",par2="parent2")
-tab2 %>% arrange(desc(exclude_allele)) %>% head()
-strains %>% filter(marker %in% c("gJAX00038569","gJAX00425031","gUNC12245354","gUNC15530876","gUNC21555204","gUNC21596600")) %>% arrange(marker) %>% select(marker,parent1,parent2)
-rqtl_file <- write_rqtl(geno=genos,pheno=phenos,tab=tab2,ref=strains,par1="parent1",par2="parent2",prefix="ind_",pos="cM_cox")
-library(dplyr)
-library(stuart)
-knitr::opts_chunk$set(
-collapse = TRUE,
-comment = "#>"
-)
-library(dplyr)
-library(stuart)
-data(genos)
-summary(genos)
-data(phenos)
-summary(phenos)
-strains <- geno_strains(ref=annot_mini,geno=genos,par1=c("StrainsA_1","StrainsA_2"),par2=c("StrainsB_1","StrainsB_2"),name1="parent1",name2="parent2")
-head(strains)
-genos <- genos %>% filter(!Sample.ID %in% c("StrainsA_1", "StrainsA_2", "StrainsB_1","StrainsB_2"))
-data(stuart_tab)
-summary(stuart_tab)
-tab2 <- mark_match(stuart_tab,ref=strains)
-tab2 %>% filter(exclude_match==1)
-tab2 <- mark_poly(tab2)
-head(tab2)
+tab <- tab %>% mutate(n_geno = tab %>% select(n_HM1,n_HM2,n_HT) %>% rowSums(na.rm=TRUE))
+#calculate proportion of each genotype
+tab <- tab %>% mutate(p_HM1 = n_HM1/n_geno)
+tab <- tab %>% mutate(p_HM2 = n_HM2/n_geno)
+tab <- tab %>% mutate(p_HT = n_HT/n_geno)
+tab <- tab %>% mutate(p_NA = n_NA/(n_geno+n_NA))
+#stop if cross != "F2" or "N2"
+if(!cross %in% c("F2","N2")){
+stop("Cross must be F2 or N2")
+}
+#stop of homo&hetero or pval not specified
+if((is.na(homo)==TRUE & is.na(hetero)==TRUE) | is.na(pval)==TRUE){
+stop("Arguments homo and hetero or argument pval must be specified")
+}
+# #stop if no value for "homo" for F2 cross
+# if(cross=="F2" & (is.na(homo)==TRUE | is.na(hetero)==TRUE)){
+#   stop("Arguments homo and hetero must be specified for F2 crosses")
+# }
+#
+# #stop if no value for "homo" and "hetero" for N2 cross
+# if(cross=="N2" & (is.na(homo)==TRUE | is.na(hetero)==TRUE)){
+#   stop("Arguments homo and hetero must be specified for N2 crosses")
+# }
+#exclude markers according to proportion of na
+tab <- tab %>% mutate(exclude_prop=case_when(p_NA > na ~ 1, #exclude markers according to proportion of na
+cross=="F2" & (p_HM1 < homo | p_HM2 < homo | p_HT < hetero) ~ 1, #exclude markers according to proportion of homozygous individuals for F2 cross
+cross=="N2" & (p_HM1 < homo | p_HT < hetero) ~ 1, #exclude markers according to proportion of homozygous and heterozygous individuals for N2 cross
+T ~ 0))
+tab <- tab %>% select(-c(p_HM1,p_HM2,p_HT,p_NA,n_geno))
+return(tab)
+}
 tab2 <- mark_prop(tab2,cross="F2",homo=0.1,hetero=0.1)
-head(tab2)
-tab2 <- mark_allele(tab=tab2,ref=strains,par1="parent1",par2="parent2")
-tab2 %>% arrange(desc(exclude_allele)) %>% head()
-strains %>% filter(marker %in% c("gJAX00038569","gJAX00425031","gUNC12245354","gUNC15530876","gUNC21555204","gUNC21596600")) %>% arrange(marker) %>% select(marker,parent1,parent2)
-rqtl_file <- write_rqtl(geno=genos,pheno=phenos,tab=tab2,ref=strains,par1="parent1",par2="parent2",prefix="ind_",pos="cM_cox")
-knitr::opts_chunk$set(
-collapse = TRUE,
-comment = "#>"
-)
-library(dplyr)
-library(stuart)
-annot_mini <- read.csv(url("https://raw.githubusercontent.com/kbroman/MUGAarrays/master/UWisc/mini_uwisc_v2.csv"))
-data(genos)
-summary(genos)
-data(phenos)
-summary(phenos)
-strains <- geno_strains(ref=annot_mini,geno=genos,par1=c("StrainsA_1","StrainsA_2"),par2=c("StrainsB_1","StrainsB_2"),name1="parent1",name2="parent2")
-head(strains)
-genos <- genos %>% filter(!Sample.ID %in% c("StrainsA_1", "StrainsA_2", "StrainsB_1","StrainsB_2"))
-data(stuart_tab)
-summary(stuart_tab)
-tab2 <- mark_match(stuart_tab,ref=strains)
-tab2 %>% filter(exclude_match==1)
-tab2 <- mark_poly(tab2)
-head(tab2)
+mark_prop <- function(tab,cross,homo=NA,hetero=NA,pval=NA,na=0.5){
+#calculate total number of individuals genotyped for each marker
+tab <- tab %>% mutate(n_geno = tab %>% select(n_HM1,n_HM2,n_HT) %>% rowSums(na.rm=TRUE))
+#calculate proportion of each genotype
+tab <- tab %>% mutate(p_HM1 = n_HM1/n_geno)
+tab <- tab %>% mutate(p_HM2 = n_HM2/n_geno)
+tab <- tab %>% mutate(p_HT = n_HT/n_geno)
+tab <- tab %>% mutate(p_NA = n_NA/(n_geno+n_NA))
+#stop if cross != "F2" or "N2"
+if(!cross %in% c("F2","N2")){
+stop("Cross must be F2 or N2")
+}
+#stop of homo&hetero or pval not specified
+if((is.na(homo)==TRUE | is.na(hetero)==TRUE) & is.na(pval)==TRUE){
+stop("Arguments homo and hetero or argument pval must be specified")
+}
+# #stop if no value for "homo" for F2 cross
+# if(cross=="F2" & (is.na(homo)==TRUE | is.na(hetero)==TRUE)){
+#   stop("Arguments homo and hetero must be specified for F2 crosses")
+# }
+#
+# #stop if no value for "homo" and "hetero" for N2 cross
+# if(cross=="N2" & (is.na(homo)==TRUE | is.na(hetero)==TRUE)){
+#   stop("Arguments homo and hetero must be specified for N2 crosses")
+# }
+#exclude markers according to proportion of na
+tab <- tab %>% mutate(exclude_prop=case_when(p_NA > na ~ 1, #exclude markers according to proportion of na
+cross=="F2" & (p_HM1 < homo | p_HM2 < homo | p_HT < hetero) ~ 1, #exclude markers according to proportion of homozygous individuals for F2 cross
+cross=="N2" & (p_HM1 < homo | p_HT < hetero) ~ 1, #exclude markers according to proportion of homozygous and heterozygous individuals for N2 cross
+T ~ 0))
+tab <- tab %>% select(-c(p_HM1,p_HM2,p_HT,p_NA,n_geno))
+return(tab)
+}
 tab2 <- mark_prop(tab2,cross="F2",homo=0.1,hetero=0.1)
-head(tab2)
-tab2 <- mark_allele(tab=tab2,ref=strains,par1="parent1",par2="parent2")
-tab2 %>% arrange(desc(exclude_allele)) %>% head()
-strains %>% filter(marker %in% c("gJAX00038569","gJAX00425031","gUNC12245354","gUNC15530876","gUNC21555204","gUNC21596600")) %>% arrange(marker) %>% select(marker,parent1,parent2)
-library(dplyr)
-library(stuart)
-rqtl_file <- write_rqtl(geno=genos,pheno=phenos,tab=tab2,ref=strains,par1="parent1",par2="parent2",prefix="ind_",pos="cM_cox")
-rqtl_file[1:10,1:7]
-devtools::build_vignettes()
+tab2 <- mark_prop(tab2,cross="F2",na=0.05)
+tab2 <- mark_prop(tab2,cross="F2",pval=0.05)
+tab2 <- mark_prop(tab2,cross="F2",homo=0.05)
+tab2 <- mark_prop(tab2,cross="F2",hetero=0.05)
+tab2 <- mark_prop(tab2,cross="F2",pval=0.05)
+mark_prop <- function(tab,cross,homo=NA,hetero=NA,pval=NA,na=0.5){
+#calculate total number of individuals genotyped for each marker
+tab <- tab %>% mutate(n_geno = tab %>% select(n_HM1,n_HM2,n_HT) %>% rowSums(na.rm=TRUE))
+#calculate proportion of each genotype
+tab <- tab %>% mutate(p_HM1 = n_HM1/n_geno)
+tab <- tab %>% mutate(p_HM2 = n_HM2/n_geno)
+tab <- tab %>% mutate(p_HT = n_HT/n_geno)
+tab <- tab %>% mutate(p_NA = n_NA/(n_geno+n_NA))
+#stop if cross != "F2" or "N2"
+if(!cross %in% c("F2","N2")){
+stop("Cross must be F2 or N2")
+}
+#stop of homo&hetero or pval not specified
+if((is.na(homo)==TRUE | is.na(hetero)==TRUE) & is.na(pval)==TRUE){
+stop("Arguments homo and hetero or argument pval must be specified")
+}
+#stop with prop of na
+tab <- tab %>%
+mutate(exclude_prop=case_when(p_NA > na ~ 1,
+T ~ 0))
+#stop with prop of homo/hetero
+if(is.na(pval)==TRUE){
+tab <- tab %>%
+mutate(exclude_prop=case_when(p_NA > na ~ 1,
+cross=="F2" & (p_HM1 < homo | p_HM2 < homo | p_HT < hetero) ~ 1,
+cross=="N2" & (p_HM1 < homo | p_HT < hetero) ~ 1,
+T ~ exclude_prop
+))
+}
+#stop with pval chisq.test
+if(is.na(pval)==FALSE){
+#block pval result if all missing genotypes
+tab <- tab %>% mutate(chi_pval=case_when(p_HM1=0 & p_HM2 = 0 & p_HT = 0 ~ NA,
+tab2 <- mark_prop(tab2,cross="F2",pval=0.05)
+mark_prop <- function(tab,cross,homo=NA,hetero=NA,pval=NA,na=0.5){
+#calculate total number of individuals genotyped for each marker
+tab <- tab %>% mutate(n_geno = tab %>% select(n_HM1,n_HM2,n_HT) %>% rowSums(na.rm=TRUE))
+#calculate proportion of each genotype
+tab <- tab %>% mutate(p_HM1 = n_HM1/n_geno)
+tab <- tab %>% mutate(p_HM2 = n_HM2/n_geno)
+tab <- tab %>% mutate(p_HT = n_HT/n_geno)
+tab <- tab %>% mutate(p_NA = n_NA/(n_geno+n_NA))
+#stop if cross != "F2" or "N2"
+if(!cross %in% c("F2","N2")){
+stop("Cross must be F2 or N2")
+}
+#stop of homo&hetero or pval not specified
+if((is.na(homo)==TRUE | is.na(hetero)==TRUE) & is.na(pval)==TRUE){
+stop("Arguments homo and hetero or argument pval must be specified")
+}
+#stop with prop of na
+tab <- tab %>%
+mutate(exclude_prop=case_when(p_NA > na ~ 1,
+T ~ 0))
+#stop with prop of homo/hetero
+if(is.na(pval)==TRUE){
+tab <- tab %>%
+mutate(exclude_prop=case_when(p_NA > na ~ 1,
+cross=="F2" & (p_HM1 < homo | p_HM2 < homo | p_HT < hetero) ~ 1,
+cross=="N2" & (p_HM1 < homo | p_HT < hetero) ~ 1,
+T ~ exclude_prop
+))
+}
+#stop with pval chisq.test
+if(is.na(pval)==FALSE){
+#block pval result if all missing genotypes
+tab <- tab %>% mutate(chi_pval=case_when(p_HM1=0 & p_HM2 = 0 & p_HT = 0 ~ NA,
+tab2 <- mark_prop(tab2,cross="F2",pval=0.05)
+mark_prop(tab2,cross="F2",pval=0.05)
+mark_prop <- function(tab,cross,homo=NA,hetero=NA,pval=NA,na=0.5){
+#calculate total number of individuals genotyped for each marker
+tab <- tab %>% mutate(n_geno = tab %>% select(n_HM1,n_HM2,n_HT) %>% rowSums(na.rm=TRUE))
+#calculate proportion of each genotype
+tab <- tab %>% mutate(p_HM1 = n_HM1/n_geno)
+tab <- tab %>% mutate(p_HM2 = n_HM2/n_geno)
+tab <- tab %>% mutate(p_HT = n_HT/n_geno)
+tab <- tab %>% mutate(p_NA = n_NA/(n_geno+n_NA))
+#stop if cross != "F2" or "N2"
+if(!cross %in% c("F2","N2")){
+stop("Cross must be F2 or N2")
+}
+#stop of homo&hetero or pval not specified
+if((is.na(homo)==TRUE | is.na(hetero)==TRUE) & is.na(pval)==TRUE){
+stop("Arguments homo and hetero or argument pval must be specified")
+}
+#stop with prop of na
+tab <- tab %>%
+mutate(exclude_prop=case_when(p_NA > na ~ 1,
+T ~ 0))
+#stop with prop of homo/hetero
+if(is.na(pval)==TRUE){
+tab <- tab %>%
+mutate(exclude_prop=case_when(p_NA > na ~ 1,
+cross=="F2" & (p_HM1 < homo | p_HM2 < homo | p_HT < hetero) ~ 1,
+cross=="N2" & (p_HM1 < homo | p_HT < hetero) ~ 1,
+T ~ exclude_prop
+))
+}
+#stop with pval chisq.test
+if(is.na(pval)==FALSE){
+#block pval result if all missing genotypes
+tab <- tab %>% mutate(chi_pval=case_when(p_HM1=0 & p_HM2 = 0 & p_HT = 0 ~ NA,
+tab2 <- mark_prop(tab2,cross="F2",pval=0.05)
+mark_prop(tab2,cross="F2",pval=0.05)
+mark_prop <- function(tab,cross,homo=NA,hetero=NA,pval=NA,na=0.5){
+#calculate total number of individuals genotyped for each marker
+tab <- tab %>% mutate(n_geno = tab %>% select(n_HM1,n_HM2,n_HT) %>% rowSums(na.rm=TRUE))
+#calculate proportion of each genotype
+tab <- tab %>% mutate(p_HM1 = n_HM1/n_geno)
+tab <- tab %>% mutate(p_HM2 = n_HM2/n_geno)
+tab <- tab %>% mutate(p_HT = n_HT/n_geno)
+tab <- tab %>% mutate(p_NA = n_NA/(n_geno+n_NA))
+#stop if cross != "F2" or "N2"
+if(!cross %in% c("F2","N2")){
+stop("Cross must be F2 or N2")
+}
+#stop of homo&hetero or pval not specified
+if((is.na(homo)==TRUE | is.na(hetero)==TRUE) & is.na(pval)==TRUE){
+stop("Arguments homo and hetero or argument pval must be specified")
+}
+#stop with prop of na
+tab <- tab %>%
+mutate(exclude_prop=case_when(p_NA > na ~ 1,
+T ~ 0))
+#stop with prop of homo/hetero
+if(is.na(pval)==TRUE){
+tab <- tab %>%
+mutate(exclude_prop=case_when(p_NA > na ~ 1,
+cross=="F2" & (p_HM1 < homo | p_HM2 < homo | p_HT < hetero) ~ 1,
+cross=="N2" & (p_HM1 < homo | p_HT < hetero) ~ 1,
+T ~ exclude_prop
+))
+}
+#stop with pval chisq.test
+if(is.na(pval)==FALSE){
+#block pval result if all missing genotypes
+tab <- tab %>% mutate(chi_pval=case_when(p_HM1=0 & p_HM2 = 0 & p_HT = 0 ~ NA,
+tab2 <- mark_prop(tab2,cross="F2",pval=0.05)
+mark_prop <- function(tab,cross,homo=NA,hetero=NA,pval=NA,na=0.5){
+#calculate total number of individuals genotyped for each marker
+tab <- tab %>% mutate(n_geno = tab %>% select(n_HM1,n_HM2,n_HT) %>% rowSums(na.rm=TRUE))
+#calculate proportion of each genotype
+tab <- tab %>% mutate(p_HM1 = n_HM1/n_geno)
+tab <- tab %>% mutate(p_HM2 = n_HM2/n_geno)
+tab <- tab %>% mutate(p_HT = n_HT/n_geno)
+tab <- tab %>% mutate(p_NA = n_NA/(n_geno+n_NA))
+#stop if cross != "F2" or "N2"
+if(!cross %in% c("F2","N2")){
+stop("Cross must be F2 or N2")
+}
+#stop of homo&hetero or pval not specified
+if((is.na(homo)==TRUE | is.na(hetero)==TRUE) & is.na(pval)==TRUE){
+stop("Arguments homo and hetero or argument pval must be specified")
+}
+#stop with prop of na
+tab <- tab %>%
+mutate(exclude_prop=case_when(p_NA > na ~ 1,
+T ~ 0))
+#stop with prop of homo/hetero
+if(is.na(pval)==TRUE){
+tab <- tab %>%
+mutate(exclude_prop=case_when(p_NA > na ~ 1,
+cross=="F2" & (p_HM1 < homo | p_HM2 < homo | p_HT < hetero) ~ 1,
+cross=="N2" & (p_HM1 < homo | p_HT < hetero) ~ 1,
+T ~ exclude_prop
+))
+}
+#stop with pval chisq.test
+if(is.na(pval)==FALSE){
+#block pval result if all missing genotypes
+tab <- tab %>% mutate(chi_pval=case_when(p_HM1=0 & p_HM2 = 0 & p_HT = 0 ~ NA,
+mark_prop <- function(tab,cross,homo=NA,hetero=NA,pval=NA,na=0.5){
+#calculate total number of individuals genotyped for each marker
+tab <- tab %>% mutate(n_geno = tab %>% select(n_HM1,n_HM2,n_HT) %>% rowSums(na.rm=TRUE))
+#calculate proportion of each genotype
+tab <- tab %>% mutate(p_HM1 = n_HM1/n_geno)
+tab <- tab %>% mutate(p_HM2 = n_HM2/n_geno)
+tab <- tab %>% mutate(p_HT = n_HT/n_geno)
+tab <- tab %>% mutate(p_NA = n_NA/(n_geno+n_NA))
+#stop if cross != "F2" or "N2"
+if(!cross %in% c("F2","N2")){
+stop("Cross must be F2 or N2")
+}
+#stop of homo&hetero or pval not specified
+if((is.na(homo)==TRUE | is.na(hetero)==TRUE) & is.na(pval)==TRUE){
+stop("Arguments homo and hetero or argument pval must be specified")
+}
+#stop with prop of na
+tab <- tab %>%
+mutate(exclude_prop=case_when(p_NA > na ~ 1,
+T ~ 0))
+#stop with prop of homo/hetero
+if(is.na(pval)==TRUE){
+tab <- tab %>%
+mutate(exclude_prop=case_when(p_NA > na ~ 1,
+cross=="F2" & (p_HM1 < homo | p_HM2 < homo | p_HT < hetero) ~ 1,
+cross=="N2" & (p_HM1 < homo | p_HT < hetero) ~ 1,
+T ~ exclude_prop
+))
+}
+#stop with pval chisq.test
+if(is.na(pval)==FALSE){
+#block pval result if all missing genotypes
+tab <- tab %>% mutate(chi_pval=case_when(p_HM1==0 & p_HM2 == 0 & p_HT == 0 ~ NA,
+T ~ 0))
+}
+print(tab)
+# #stop if no value for "homo" for F2 cross
+# if(cross=="F2" & (is.na(homo)==TRUE | is.na(hetero)==TRUE)){
+#   stop("Arguments homo and hetero must be specified for F2 crosses")
+# }
+#
+# #stop if no value for "homo" and "hetero" for N2 cross
+# if(cross=="N2" & (is.na(homo)==TRUE | is.na(hetero)==TRUE)){
+#   stop("Arguments homo and hetero must be specified for N2 crosses")
+# }
+# #exclude markers according to proportion of na
+# tab <- tab %>% mutate(exclude_prop=case_when(p_NA > na ~ 1, #exclude markers according to proportion of na
+#                                              cross=="F2" & (p_HM1 < homo | p_HM2 < homo | p_HT < hetero) ~ 1, #exclude markers according to proportion of homozygous individuals for F2 cross
+#                                              cross=="N2" & (p_HM1 < homo | p_HT < hetero) ~ 1, #exclude markers according to proportion of homozygous and heterozygous individuals for N2 cross
+#                                              T ~ 0))
+# tab <- tab %>% select(-c(p_HM1,p_HM2,p_HT,p_NA,n_geno))
+# return(tab)
+}
+tab2 <- mark_prop(tab2,cross="F2",pval=0.05)
+mark_prop <- function(tab,cross,homo=NA,hetero=NA,pval=NA,na=0.5){
+#calculate total number of individuals genotyped for each marker
+tab <- tab %>% mutate(n_geno = tab %>% select(n_HM1,n_HM2,n_HT) %>% rowSums(na.rm=TRUE))
+#calculate proportion of each genotype
+tab <- tab %>% mutate(p_HM1 = n_HM1/n_geno)
+tab <- tab %>% mutate(p_HM2 = n_HM2/n_geno)
+tab <- tab %>% mutate(p_HT = n_HT/n_geno)
+tab <- tab %>% mutate(p_NA = n_NA/(n_geno+n_NA))
+#stop if cross != "F2" or "N2"
+if(!cross %in% c("F2","N2")){
+stop("Cross must be F2 or N2")
+}
+#stop of homo&hetero or pval not specified
+if((is.na(homo)==TRUE | is.na(hetero)==TRUE) & is.na(pval)==TRUE){
+stop("Arguments homo and hetero or argument pval must be specified")
+}
+#stop with prop of na
+tab <- tab %>%
+mutate(exclude_prop=case_when(p_NA > na ~ 1,
+T ~ 0))
+#stop with prop of homo/hetero
+if(is.na(pval)==TRUE){
+tab <- tab %>%
+mutate(exclude_prop=case_when(p_NA > na ~ 1,
+cross=="F2" & (p_HM1 < homo | p_HM2 < homo | p_HT < hetero) ~ 1,
+cross=="N2" & (p_HM1 < homo | p_HT < hetero) ~ 1,
+T ~ exclude_prop
+))
+}
+#stop with pval chisq.test
+if(is.na(pval)==FALSE){
+#block pval result if all missing genotypes
+tab <- tab %>% mutate(chi_pval=case_when(p_HM1==0 & p_HM2 == 0 & p_HT == 0 ~ 1,
+T ~ 0))
+}
+print(tab)
+# #stop if no value for "homo" for F2 cross
+# if(cross=="F2" & (is.na(homo)==TRUE | is.na(hetero)==TRUE)){
+#   stop("Arguments homo and hetero must be specified for F2 crosses")
+# }
+#
+# #stop if no value for "homo" and "hetero" for N2 cross
+# if(cross=="N2" & (is.na(homo)==TRUE | is.na(hetero)==TRUE)){
+#   stop("Arguments homo and hetero must be specified for N2 crosses")
+# }
+# #exclude markers according to proportion of na
+# tab <- tab %>% mutate(exclude_prop=case_when(p_NA > na ~ 1, #exclude markers according to proportion of na
+#                                              cross=="F2" & (p_HM1 < homo | p_HM2 < homo | p_HT < hetero) ~ 1, #exclude markers according to proportion of homozygous individuals for F2 cross
+#                                              cross=="N2" & (p_HM1 < homo | p_HT < hetero) ~ 1, #exclude markers according to proportion of homozygous and heterozygous individuals for N2 cross
+#                                              T ~ 0))
+# tab <- tab %>% select(-c(p_HM1,p_HM2,p_HT,p_NA,n_geno))
+# return(tab)
+}
+tab2 <- mark_prop(tab2,cross="F2",pval=0.05)
+mark_prop <- function(tab,cross,homo=NA,hetero=NA,pval=NA,na=0.5){
+#calculate total number of individuals genotyped for each marker
+tab <- tab %>% mutate(n_geno = tab %>% select(n_HM1,n_HM2,n_HT) %>% rowSums(na.rm=TRUE))
+#calculate proportion of each genotype
+tab <- tab %>% mutate(p_HM1 = n_HM1/n_geno)
+tab <- tab %>% mutate(p_HM2 = n_HM2/n_geno)
+tab <- tab %>% mutate(p_HT = n_HT/n_geno)
+tab <- tab %>% mutate(p_NA = n_NA/(n_geno+n_NA))
+#stop if cross != "F2" or "N2"
+if(!cross %in% c("F2","N2")){
+stop("Cross must be F2 or N2")
+}
+#stop of homo&hetero or pval not specified
+if((is.na(homo)==TRUE | is.na(hetero)==TRUE) & is.na(pval)==TRUE){
+stop("Arguments homo and hetero or argument pval must be specified")
+}
+#stop with prop of na
+tab <- tab %>%
+mutate(exclude_prop=case_when(p_NA > na ~ 1,
+T ~ 0))
+#stop with prop of homo/hetero
+if(is.na(pval)==TRUE){
+tab <- tab %>%
+mutate(exclude_prop=case_when(p_NA > na ~ 1,
+cross=="F2" & (p_HM1 < homo | p_HM2 < homo | p_HT < hetero) ~ 1,
+cross=="N2" & (p_HM1 < homo | p_HT < hetero) ~ 1,
+T ~ exclude_prop
+))
+}
+#stop with pval chisq.test
+if(is.na(pval)==FALSE){
+#block pval result if all missing genotypes
+tab <- tab %>% mutate(chi_pval=case_when(p_NA==1 ~ 1,
+T ~ 0))
+}
+print(tab)
+# #stop if no value for "homo" for F2 cross
+# if(cross=="F2" & (is.na(homo)==TRUE | is.na(hetero)==TRUE)){
+#   stop("Arguments homo and hetero must be specified for F2 crosses")
+# }
+#
+# #stop if no value for "homo" and "hetero" for N2 cross
+# if(cross=="N2" & (is.na(homo)==TRUE | is.na(hetero)==TRUE)){
+#   stop("Arguments homo and hetero must be specified for N2 crosses")
+# }
+# #exclude markers according to proportion of na
+# tab <- tab %>% mutate(exclude_prop=case_when(p_NA > na ~ 1, #exclude markers according to proportion of na
+#                                              cross=="F2" & (p_HM1 < homo | p_HM2 < homo | p_HT < hetero) ~ 1, #exclude markers according to proportion of homozygous individuals for F2 cross
+#                                              cross=="N2" & (p_HM1 < homo | p_HT < hetero) ~ 1, #exclude markers according to proportion of homozygous and heterozygous individuals for N2 cross
+#                                              T ~ 0))
+# tab <- tab %>% select(-c(p_HM1,p_HM2,p_HT,p_NA,n_geno))
+# return(tab)
+}
+tab2 <- mark_prop(tab2,cross="F2",pval=0.05)
+mark_prop <- function(tab,cross,homo=NA,hetero=NA,pval=NA,na=0.5){
+#calculate total number of individuals genotyped for each marker
+tab <- tab %>% mutate(n_geno = tab %>% select(n_HM1,n_HM2,n_HT) %>% rowSums(na.rm=TRUE))
+#calculate proportion of each genotype
+tab <- tab %>% mutate(p_HM1 = n_HM1/n_geno)
+tab <- tab %>% mutate(p_HM2 = n_HM2/n_geno)
+tab <- tab %>% mutate(p_HT = n_HT/n_geno)
+tab <- tab %>% mutate(p_NA = n_NA/(n_geno+n_NA))
+#stop if cross != "F2" or "N2"
+if(!cross %in% c("F2","N2")){
+stop("Cross must be F2 or N2")
+}
+#stop of homo&hetero or pval not specified
+if((is.na(homo)==TRUE | is.na(hetero)==TRUE) & is.na(pval)==TRUE){
+stop("Arguments homo and hetero or argument pval must be specified")
+}
+#stop with prop of na
+tab <- tab %>%
+mutate(exclude_prop=case_when(p_NA > na ~ 1,
+T ~ 0))
+#stop with prop of homo/hetero
+if(is.na(pval)==TRUE){
+tab <- tab %>%
+mutate(exclude_prop=case_when(p_NA > na ~ 1,
+cross=="F2" & (p_HM1 < homo | p_HM2 < homo | p_HT < hetero) ~ 1,
+cross=="N2" & (p_HM1 < homo | p_HT < hetero) ~ 1,
+T ~ exclude_prop
+))
+}
+#stop with pval chisq.test
+if(is.na(pval)==FALSE){
+#block pval result if all missing genotypes
+tab <- tab %>% mutate(chi_pval=case_when(p_NA==1 ~ NA_integer_,
+T ~ 0))
+}
+print(tab)
+# #stop if no value for "homo" for F2 cross
+# if(cross=="F2" & (is.na(homo)==TRUE | is.na(hetero)==TRUE)){
+#   stop("Arguments homo and hetero must be specified for F2 crosses")
+# }
+#
+# #stop if no value for "homo" and "hetero" for N2 cross
+# if(cross=="N2" & (is.na(homo)==TRUE | is.na(hetero)==TRUE)){
+#   stop("Arguments homo and hetero must be specified for N2 crosses")
+# }
+# #exclude markers according to proportion of na
+# tab <- tab %>% mutate(exclude_prop=case_when(p_NA > na ~ 1, #exclude markers according to proportion of na
+#                                              cross=="F2" & (p_HM1 < homo | p_HM2 < homo | p_HT < hetero) ~ 1, #exclude markers according to proportion of homozygous individuals for F2 cross
+#                                              cross=="N2" & (p_HM1 < homo | p_HT < hetero) ~ 1, #exclude markers according to proportion of homozygous and heterozygous individuals for N2 cross
+#                                              T ~ 0))
+# tab <- tab %>% select(-c(p_HM1,p_HM2,p_HT,p_NA,n_geno))
+# return(tab)
+}
+tab2 <- mark_prop(tab2,cross="F2",pval=0.05)
+mark_prop <- function(tab,cross,homo=NA,hetero=NA,pval=NA,na=0.5){
+#calculate total number of individuals genotyped for each marker
+tab <- tab %>% mutate(n_geno = tab %>% select(n_HM1,n_HM2,n_HT) %>% rowSums(na.rm=TRUE))
+#calculate proportion of each genotype
+tab <- tab %>% mutate(p_HM1 = n_HM1/n_geno)
+tab <- tab %>% mutate(p_HM2 = n_HM2/n_geno)
+tab <- tab %>% mutate(p_HT = n_HT/n_geno)
+tab <- tab %>% mutate(p_NA = n_NA/(n_geno+n_NA))
+#stop if cross != "F2" or "N2"
+if(!cross %in% c("F2","N2")){
+stop("Cross must be F2 or N2")
+}
+#stop of homo&hetero or pval not specified
+if((is.na(homo)==TRUE | is.na(hetero)==TRUE) & is.na(pval)==TRUE){
+stop("Arguments homo and hetero or argument pval must be specified")
+}
+#stop with prop of na
+tab <- tab %>%
+mutate(exclude_prop=case_when(p_NA > na ~ 1,
+T ~ 0))
+#stop with prop of homo/hetero
+if(is.na(pval)==TRUE){
+tab <- tab %>%
+mutate(exclude_prop=case_when(p_NA > na ~ 1,
+cross=="F2" & (p_HM1 < homo | p_HM2 < homo | p_HT < hetero) ~ 1,
+cross=="N2" & (p_HM1 < homo | p_HT < hetero) ~ 1,
+T ~ exclude_prop
+))
+}
+#stop with pval chisq.test
+if(is.na(pval)==FALSE){
+#block pval result if all missing genotypes
+tab <- tab %>% mutate(chi_pval=case_when(p_NA==1 ~ NA_real_,
+T ~ 0))
+}
+print(tab)
+# #stop if no value for "homo" for F2 cross
+# if(cross=="F2" & (is.na(homo)==TRUE | is.na(hetero)==TRUE)){
+#   stop("Arguments homo and hetero must be specified for F2 crosses")
+# }
+#
+# #stop if no value for "homo" and "hetero" for N2 cross
+# if(cross=="N2" & (is.na(homo)==TRUE | is.na(hetero)==TRUE)){
+#   stop("Arguments homo and hetero must be specified for N2 crosses")
+# }
+# #exclude markers according to proportion of na
+# tab <- tab %>% mutate(exclude_prop=case_when(p_NA > na ~ 1, #exclude markers according to proportion of na
+#                                              cross=="F2" & (p_HM1 < homo | p_HM2 < homo | p_HT < hetero) ~ 1, #exclude markers according to proportion of homozygous individuals for F2 cross
+#                                              cross=="N2" & (p_HM1 < homo | p_HT < hetero) ~ 1, #exclude markers according to proportion of homozygous and heterozygous individuals for N2 cross
+#                                              T ~ 0))
+# tab <- tab %>% select(-c(p_HM1,p_HM2,p_HT,p_NA,n_geno))
+# return(tab)
+}
+tab2 <- mark_prop(tab2,cross="F2",pval=0.05)
diff --git a/.Rproj.user/9DAE6990/pcs/source-pane.pper b/.Rproj.user/9DAE6990/pcs/source-pane.pper
index d3d70fa0c6a708df53d33b21eeb319f4067fd72c..70829f67631c05a34ae267bf4377c69a6b3ef1c1 100644
--- a/.Rproj.user/9DAE6990/pcs/source-pane.pper
+++ b/.Rproj.user/9DAE6990/pcs/source-pane.pper
@@ -1,3 +1,3 @@
 {
-    "activeTab" : 6
+    "activeTab" : 1
 }
\ No newline at end of file
diff --git a/.Rproj.user/9DAE6990/pcs/windowlayoutstate.pper b/.Rproj.user/9DAE6990/pcs/windowlayoutstate.pper
index bc18be10f83a2abcc1dc870217f08f663eef0adf..e736cfdcc76ba9af2c1159730dd135fc21d47f23 100644
--- a/.Rproj.user/9DAE6990/pcs/windowlayoutstate.pper
+++ b/.Rproj.user/9DAE6990/pcs/windowlayoutstate.pper
@@ -1,13 +1,13 @@
 {
     "left" : {
-        "panelheight" : 1271,
-        "splitterpos" : 533,
-        "topwindowstate" : "NORMAL",
-        "windowheight" : 1309
+        "panelheight" : 583,
+        "splitterpos" : 244,
+        "topwindowstate" : "MAXIMIZE",
+        "windowheight" : 621
     },
     "right" : {
         "panelheight" : 1271,
-        "splitterpos" : 804,
+        "splitterpos" : 803,
         "topwindowstate" : "NORMAL",
         "windowheight" : 1309
     }
diff --git a/.Rproj.user/9DAE6990/pcs/workbench-pane.pper b/.Rproj.user/9DAE6990/pcs/workbench-pane.pper
index dd00eb66589a93dc361ab2526cb1a958c2b41bcb..443d7f5af413a893987090db3e288aeb80aafa2e 100644
--- a/.Rproj.user/9DAE6990/pcs/workbench-pane.pper
+++ b/.Rproj.user/9DAE6990/pcs/workbench-pane.pper
@@ -1,5 +1,5 @@
 {
-    "TabSet1" : 3,
+    "TabSet1" : 0,
     "TabSet2" : 4,
     "TabZoom" : {
     }
diff --git a/.Rproj.user/9DAE6990/sources/per/t/42D37312-contents b/.Rproj.user/9DAE6990/sources/per/t/42D37312-contents
deleted file mode 100644
index 8af6e843dc7d88ac3724cf1c46fde5ba9b43f416..0000000000000000000000000000000000000000
--- a/.Rproj.user/9DAE6990/sources/per/t/42D37312-contents
+++ /dev/null
@@ -1,51 +0,0 @@
-#' @title Exclude markers depending on proportions of homo/hetorozygous
-#'
-#' @description uses the dataframe produced by the tab_mark function and fills the "exclude" column for all the markers that present odd proportions of each genotype. You can define these proportions thanks to the arguments of the function.
-#' @param tab data frame obtained with tab_mark function.
-#' @param cross F2 or N2.
-#' @param homo proportion of homozygous individuals under which the marker is excluded. Will apply on both homozygous genotypes for a F2, but only on one for N2.
-#' @param hetero proportion of heterozygous individuals under which the marker is excluded.
-#' @param na proportion of non-genotyped individuals above which the marker is excluded.
-#'
-#' @import dplyr
-#'
-#' @export
-#'
-
-#### mark_prop ####
-## excludes markers depending on proportions of homo/hetorozygous
-## to modify with chisq.test
-mark_prop <- function(tab,cross,homo=NA,hetero=NA,na=0.5){
-  #calculate total number of individuals genotyped for each marker
-  tab <- tab %>% mutate(n_geno = tab %>% select(n_HM1,n_HM2,n_HT) %>% rowSums(na.rm=TRUE))
-
-  #calculate proportion of each genotype
-  tab <- tab %>% mutate(p_HM1 = n_HM1/n_geno)
-  tab <- tab %>% mutate(p_HM2 = n_HM2/n_geno)
-  tab <- tab %>% mutate(p_HT = n_HT/n_geno)
-  tab <- tab %>% mutate(p_NA = n_NA/(n_geno+n_NA))
-
-  #stop if cross != "F2" or "N2"
-  if(!cross %in% c("F2","N2")){
-    stop("Cross must be F2 or N2")
-  }
-
-  #stop if no value for "homo" for F2 cross
-  if(cross=="F2" & (is.na(homo)==TRUE | is.na(hetero)==TRUE)){
-    stop("Arguments homo and hetero must be specified for F2 crosses")
-  }
-
-  #stop if no value for "homo" and "hetero" for N2 cross
-  if(cross=="N2" & (is.na(homo)==TRUE | is.na(hetero)==TRUE)){
-    stop("Arguments homo and hetero must be specified for N2 crosses")
-  }
-
-  #exclude markers according to proportion of na
-  tab <- tab %>% mutate(exclude_prop=case_when(p_NA > na ~ 1, #exclude markers according to proportion of na
-                                               cross=="F2" & (p_HM1 < homo | p_HM2 < homo | p_HT < hetero) ~ 1, #exclude markers according to proportion of homozygous individuals for F2 cross
-                                               cross=="N2" & (p_HM1 < homo | p_HT < hetero) ~ 1, #exclude markers according to proportion of homozygous and heterozygous individuals for N2 cross
-                                               T ~ 0))
-
-  tab <- tab %>% select(-c(p_HM1,p_HM2,p_HT,p_NA,n_geno))
-  return(tab)
-}
diff --git a/.Rproj.user/9DAE6990/sources/prop/52B275C1 b/.Rproj.user/9DAE6990/sources/prop/52B275C1
index f177a1d2af80e33d41780a33402e0ec073a515d1..917ce62cf18035dfb273c1b4502bbff8d5a12d15 100644
--- a/.Rproj.user/9DAE6990/sources/prop/52B275C1
+++ b/.Rproj.user/9DAE6990/sources/prop/52B275C1
@@ -1,4 +1,4 @@
 {
-    "cursorPosition" : "16,28",
-    "scrollLine" : "0"
+    "cursorPosition" : "70,29",
+    "scrollLine" : "40"
 }
\ No newline at end of file
diff --git a/.Rproj.user/9DAE6990/sources/prop/63BDD9CA b/.Rproj.user/9DAE6990/sources/prop/63BDD9CA
new file mode 100644
index 0000000000000000000000000000000000000000..7a73a41bfdf76d6f793007240d80983a52f15f97
--- /dev/null
+++ b/.Rproj.user/9DAE6990/sources/prop/63BDD9CA
@@ -0,0 +1,2 @@
+{
+}
\ No newline at end of file
diff --git a/.Rproj.user/9DAE6990/sources/prop/B92E179B b/.Rproj.user/9DAE6990/sources/prop/B92E179B
index 99225b88f2b3d69bec4e54ea84c112b5e16f3ea5..c8e8fbca6ce0acb14bec3cc73ef8e22088fbe0b7 100644
--- a/.Rproj.user/9DAE6990/sources/prop/B92E179B
+++ b/.Rproj.user/9DAE6990/sources/prop/B92E179B
@@ -1,5 +1,5 @@
 {
-    "cursorPosition" : "135,15",
-    "last_setup_crc32" : "",
-    "scrollLine" : "111"
+    "cursorPosition" : "114,53",
+    "last_setup_crc32" : "E69463565bfca283",
+    "scrollLine" : "110"
 }
\ No newline at end of file
diff --git a/.Rproj.user/9DAE6990/sources/prop/INDEX b/.Rproj.user/9DAE6990/sources/prop/INDEX
index eb9f95ac9ea85eec475733598ad68958be13be45..5002f883b8ddaa47943ca5430d75a1fcc72dfaed 100644
--- a/.Rproj.user/9DAE6990/sources/prop/INDEX
+++ b/.Rproj.user/9DAE6990/sources/prop/INDEX
@@ -22,3 +22,4 @@
 ~%2Fstuart_package%2Fstuart%2Fdoc%2FstuaRt.R="65312719"
 ~%2Fstuart_package%2Fstuart%2Fvignettes%2FstuaRt.R="EBD625D2"
 ~%2Fstuart_package%2Fstuart%2Fvignettes%2FstuaRt.Rmd="D602FFE4"
+~%2Fstuart_package%2Fstuart_old%2FR%2Fmark_prop.R="63BDD9CA"
diff --git a/.Rproj.user/9DAE6990/sources/per/t/1656F55 b/.Rproj.user/9DAE6990/sources/s-E6946356/1656F55
similarity index 83%
rename from .Rproj.user/9DAE6990/sources/per/t/1656F55
rename to .Rproj.user/9DAE6990/sources/s-E6946356/1656F55
index 8e20769b46ded0096db9088d18fbd11f6512ba2f..9213855ed1971454b54437180eb96209317271cd 100644
--- a/.Rproj.user/9DAE6990/sources/per/t/1656F55
+++ b/.Rproj.user/9DAE6990/sources/s-E6946356/1656F55
@@ -5,10 +5,10 @@
     "dirty" : false,
     "encoding" : "UTF-8",
     "folds" : "",
-    "hash" : "1203844341",
+    "hash" : "0",
     "id" : "1656F55",
-    "lastKnownWriteTime" : 1622640147,
-    "last_content_update" : 1622640147,
+    "lastKnownWriteTime" : 1623060553,
+    "last_content_update" : 1623060553,
     "path" : "~/Documents/PhD/stuart_R/stuart/R/geno_strains.R",
     "project_path" : "R/geno_strains.R",
     "properties" : {
diff --git a/.Rproj.user/9DAE6990/sources/per/t/1656F55-contents b/.Rproj.user/9DAE6990/sources/s-E6946356/1656F55-contents
similarity index 100%
rename from .Rproj.user/9DAE6990/sources/per/t/1656F55-contents
rename to .Rproj.user/9DAE6990/sources/s-E6946356/1656F55-contents
diff --git a/.Rproj.user/9DAE6990/sources/per/t/42D37312 b/.Rproj.user/9DAE6990/sources/s-E6946356/42D37312
similarity index 69%
rename from .Rproj.user/9DAE6990/sources/per/t/42D37312
rename to .Rproj.user/9DAE6990/sources/s-E6946356/42D37312
index bb16ed6ca5de8f82cddf1b4533c015b6b4dba764..6a8990c217bfa4d7acba929175c3d4ea22e67a26 100644
--- a/.Rproj.user/9DAE6990/sources/per/t/42D37312
+++ b/.Rproj.user/9DAE6990/sources/s-E6946356/42D37312
@@ -5,20 +5,20 @@
     "dirty" : false,
     "encoding" : "UTF-8",
     "folds" : "",
-    "hash" : "3094972460",
+    "hash" : "0",
     "id" : "42D37312",
-    "lastKnownWriteTime" : 1623061718,
-    "last_content_update" : 1623061718577,
+    "lastKnownWriteTime" : 1623086204,
+    "last_content_update" : 1623086204670,
     "path" : "~/Documents/PhD/stuart_R/stuart/R/mark_prop.R",
     "project_path" : "R/mark_prop.R",
     "properties" : {
-        "cursorPosition" : "16,28",
-        "scrollLine" : "0"
+        "cursorPosition" : "70,29",
+        "scrollLine" : "40"
     },
     "read_only" : false,
     "read_only_alternatives" : [
     ],
-    "relative_order" : 9,
+    "relative_order" : 2,
     "source_on_save" : false,
     "source_window" : "",
     "type" : "r_source"
diff --git a/.Rproj.user/9DAE6990/sources/s-E6946356/42D37312-contents b/.Rproj.user/9DAE6990/sources/s-E6946356/42D37312-contents
new file mode 100644
index 0000000000000000000000000000000000000000..9b64227c7609b19b93b4f2e23a78be0710971df7
--- /dev/null
+++ b/.Rproj.user/9DAE6990/sources/s-E6946356/42D37312-contents
@@ -0,0 +1,73 @@
+#' @title Exclude markers depending on proportions of homo/hetorozygous
+#'
+#' @description uses the dataframe produced by the tab_mark function and fills the "exclude" column for all the markers that present odd proportions of each genotype. You can define these proportions thanks to the arguments of the function.
+#' @param tab data frame obtained with tab_mark function.
+#' @param cross F2 or N2.
+#' @param homo proportion of homozygous individuals under which the marker is excluded. Will apply on both homozygous genotypes for a F2, but only on one for N2.
+#' @param hetero proportion of heterozygous individuals under which the marker is excluded.
+#' @param na proportion of non-genotyped individuals above which the marker is excluded.
+#'
+#' @import dplyr
+#'
+#' @export
+#'
+
+#### mark_prop ####
+## excludes markers depending on proportions of homo/hetorozygous
+mark_prop <- function(tab,cross,homo=NA,hetero=NA,pval=NA,na=0.5){
+  #calculate total number of individuals genotyped for each marker
+  tab <- tab %>% mutate(n_geno = (n_HM1 + n_HM2 + n_HT))
+
+  #calculate proportion of each genotype
+  tab <- tab %>% mutate(p_HM1 = n_HM1/n_geno)
+  tab <- tab %>% mutate(p_HM2 = n_HM2/n_geno)
+  tab <- tab %>% mutate(p_HT = n_HT/n_geno)
+  tab <- tab %>% mutate(p_NA = n_NA/(n_geno+n_NA))
+
+  #stock colnames to join
+  names <- colnames(tab)
+
+
+  #stop if cross != "F2" or "N2"
+  if(!cross %in% c("F2","N2")){
+    stop("Cross must be F2 or N2")
+  }
+
+  #stop of homo&hetero or pval not specified
+  if((is.na(homo)==TRUE | is.na(hetero)==TRUE) & is.na(pval)==TRUE){
+    stop("Arguments homo and hetero or argument pval must be specified")
+  }
+
+
+
+  #stop with prop of na
+  tab <- tab %>%
+    mutate(exclude_prop=case_when(p_NA > na ~ 1,
+                                  T ~ 0))
+
+  #stop with prop of homo/hetero
+  if(is.na(pval)==TRUE){
+    tab <- tab %>%
+      mutate(exclude_prop=case_when(p_NA > na ~ 1,
+                                    cross=="F2" & (p_HM1 < homo | p_HM2 < homo | p_HT < hetero) ~ 1,
+                                    cross=="N2" & (p_HM1 < homo | p_HT < hetero) ~ 1,
+                                    T ~ exclude_prop
+      ))
+  }
+
+  #stop with pval chisq.test
+  ## NEED TO ADD THIS FILTER IF CROSS = N2
+  if(is.na(pval)==FALSE){
+
+    tab <- tab %>% filter(p_NA != 1) %>% rowwise() %>%
+      mutate(.,chi_pval = tibble(n_HM1,n_HM2,n_HT) %>%
+               chisq.test(p=c(0.25,0.25,0.5)) %>% .$p.value) %>%
+      full_join(.,tab,by=names)
+
+    tab <- tab %>% mutate(exclude_prop=case_when(chi_pval < pval ~ 1,
+                                                 T ~ exclude_prop))
+  }
+
+  tab <- tab %>% select(names)
+  return(tab)
+}
diff --git a/.Rproj.user/9DAE6990/sources/per/t/45D91D58 b/.Rproj.user/9DAE6990/sources/s-E6946356/45D91D58
similarity index 91%
rename from .Rproj.user/9DAE6990/sources/per/t/45D91D58
rename to .Rproj.user/9DAE6990/sources/s-E6946356/45D91D58
index e376a74239619faa1a9de99cde17e4c3da434ba2..9602a337b0505971269b23a049316cf36b97e68e 100644
--- a/.Rproj.user/9DAE6990/sources/per/t/45D91D58
+++ b/.Rproj.user/9DAE6990/sources/s-E6946356/45D91D58
@@ -5,7 +5,7 @@
     "dirty" : false,
     "encoding" : "UTF-8",
     "folds" : "",
-    "hash" : "1139135974",
+    "hash" : "0",
     "id" : "45D91D58",
     "lastKnownWriteTime" : 1622648301,
     "last_content_update" : 1622648301329,
@@ -18,7 +18,7 @@
     "read_only" : false,
     "read_only_alternatives" : [
     ],
-    "relative_order" : 11,
+    "relative_order" : 9,
     "source_on_save" : false,
     "source_window" : "",
     "type" : "r_source"
diff --git a/.Rproj.user/9DAE6990/sources/per/t/45D91D58-contents b/.Rproj.user/9DAE6990/sources/s-E6946356/45D91D58-contents
similarity index 100%
rename from .Rproj.user/9DAE6990/sources/per/t/45D91D58-contents
rename to .Rproj.user/9DAE6990/sources/s-E6946356/45D91D58-contents
diff --git a/.Rproj.user/9DAE6990/sources/per/t/65C9B72B b/.Rproj.user/9DAE6990/sources/s-E6946356/65C9B72B
similarity index 83%
rename from .Rproj.user/9DAE6990/sources/per/t/65C9B72B
rename to .Rproj.user/9DAE6990/sources/s-E6946356/65C9B72B
index c988561e5f7a57087211e903b001889271f0e1b5..c0fc3b113e8e76ba2ef1b62bc0168f90f4fd2747 100644
--- a/.Rproj.user/9DAE6990/sources/per/t/65C9B72B
+++ b/.Rproj.user/9DAE6990/sources/s-E6946356/65C9B72B
@@ -5,10 +5,10 @@
     "dirty" : false,
     "encoding" : "UTF-8",
     "folds" : "",
-    "hash" : "1762622592",
+    "hash" : "0",
     "id" : "65C9B72B",
-    "lastKnownWriteTime" : 1622642120,
-    "last_content_update" : 1622642120783,
+    "lastKnownWriteTime" : 1623060553,
+    "last_content_update" : 1623060553,
     "path" : "~/Documents/PhD/stuart_R/stuart/R/tab_mark.R",
     "project_path" : "R/tab_mark.R",
     "properties" : {
diff --git a/.Rproj.user/9DAE6990/sources/per/t/65C9B72B-contents b/.Rproj.user/9DAE6990/sources/s-E6946356/65C9B72B-contents
similarity index 100%
rename from .Rproj.user/9DAE6990/sources/per/t/65C9B72B-contents
rename to .Rproj.user/9DAE6990/sources/s-E6946356/65C9B72B-contents
diff --git a/.Rproj.user/9DAE6990/sources/s-E6946356/6DCC955A b/.Rproj.user/9DAE6990/sources/s-E6946356/6DCC955A
new file mode 100644
index 0000000000000000000000000000000000000000..2a796716610405a9895805d37fc39013701551f8
--- /dev/null
+++ b/.Rproj.user/9DAE6990/sources/s-E6946356/6DCC955A
@@ -0,0 +1,33 @@
+{
+    "collab_server" : "",
+    "contents" : "",
+    "created" : 1623083300385.000,
+    "dirty" : false,
+    "encoding" : "",
+    "folds" : "",
+    "hash" : "0",
+    "id" : "6DCC955A",
+    "lastKnownWriteTime" : 140320379993736,
+    "last_content_update" : 1623083300385,
+    "path" : null,
+    "project_path" : null,
+    "properties" : {
+        "cacheKey" : "FFFA47E6",
+        "caption" : "test_tab",
+        "contentUrl" : "grid_resource/gridviewer.html?env=&obj=test_tab&cache_key=FFFA47E6",
+        "displayedObservations" : "20",
+        "environment" : "",
+        "expression" : "test_tab",
+        "object" : "test_tab",
+        "preview" : "0",
+        "totalObservations" : "20",
+        "variables" : "9"
+    },
+    "read_only" : false,
+    "read_only_alternatives" : [
+    ],
+    "relative_order" : 12,
+    "source_on_save" : false,
+    "source_window" : "",
+    "type" : "r_dataframe"
+}
\ No newline at end of file
diff --git a/.Rproj.user/9DAE6990/sources/s-E6946356/6DCC955A-contents b/.Rproj.user/9DAE6990/sources/s-E6946356/6DCC955A-contents
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/.Rproj.user/9DAE6990/sources/per/t/76AC3EC b/.Rproj.user/9DAE6990/sources/s-E6946356/76AC3EC
similarity index 91%
rename from .Rproj.user/9DAE6990/sources/per/t/76AC3EC
rename to .Rproj.user/9DAE6990/sources/s-E6946356/76AC3EC
index 34ddaca5ed5997074aa902eed3a9da1114031382..90a5c9ed7e93e6ed4b486552bb8626b317b7583e 100644
--- a/.Rproj.user/9DAE6990/sources/per/t/76AC3EC
+++ b/.Rproj.user/9DAE6990/sources/s-E6946356/76AC3EC
@@ -5,7 +5,7 @@
     "dirty" : false,
     "encoding" : "UTF-8",
     "folds" : "",
-    "hash" : "143869640",
+    "hash" : "0",
     "id" : "76AC3EC",
     "lastKnownWriteTime" : 1623060553,
     "last_content_update" : 1623060553,
@@ -18,7 +18,7 @@
     "read_only" : false,
     "read_only_alternatives" : [
     ],
-    "relative_order" : 7,
+    "relative_order" : 6,
     "source_on_save" : false,
     "source_window" : "",
     "type" : "r_source"
diff --git a/.Rproj.user/9DAE6990/sources/per/t/76AC3EC-contents b/.Rproj.user/9DAE6990/sources/s-E6946356/76AC3EC-contents
similarity index 100%
rename from .Rproj.user/9DAE6990/sources/per/t/76AC3EC-contents
rename to .Rproj.user/9DAE6990/sources/s-E6946356/76AC3EC-contents
diff --git a/.Rproj.user/9DAE6990/sources/per/t/96AB3736 b/.Rproj.user/9DAE6990/sources/s-E6946356/96AB3736
similarity index 69%
rename from .Rproj.user/9DAE6990/sources/per/t/96AB3736
rename to .Rproj.user/9DAE6990/sources/s-E6946356/96AB3736
index 84a57ef4e687342e71e997f9e8af97bc78a8e07c..20375c2156562ab6ee1a79dc405f1c648a6b20b6 100644
--- a/.Rproj.user/9DAE6990/sources/per/t/96AB3736
+++ b/.Rproj.user/9DAE6990/sources/s-E6946356/96AB3736
@@ -5,16 +5,16 @@
     "dirty" : false,
     "encoding" : "UTF-8",
     "folds" : "",
-    "hash" : "2014255563",
+    "hash" : "0",
     "id" : "96AB3736",
-    "lastKnownWriteTime" : 1623060592,
-    "last_content_update" : 1623060592,
+    "lastKnownWriteTime" : 1623085896,
+    "last_content_update" : 1623085896412,
     "path" : "~/Documents/PhD/stuart_R/stuart/vignettes/stuaRt.Rmd",
     "project_path" : "vignettes/stuaRt.Rmd",
     "properties" : {
-        "cursorPosition" : "135,15",
-        "last_setup_crc32" : "",
-        "scrollLine" : "111"
+        "cursorPosition" : "114,53",
+        "last_setup_crc32" : "E69463565bfca283",
+        "scrollLine" : "110"
     },
     "read_only" : false,
     "read_only_alternatives" : [
diff --git a/.Rproj.user/9DAE6990/sources/per/t/96AB3736-contents b/.Rproj.user/9DAE6990/sources/s-E6946356/96AB3736-contents
similarity index 100%
rename from .Rproj.user/9DAE6990/sources/per/t/96AB3736-contents
rename to .Rproj.user/9DAE6990/sources/s-E6946356/96AB3736-contents
diff --git a/.Rproj.user/9DAE6990/sources/s-E6946356/A53AF86 b/.Rproj.user/9DAE6990/sources/s-E6946356/A53AF86
new file mode 100644
index 0000000000000000000000000000000000000000..d685ad2959b3643ad53cee643accb004ab175aae
--- /dev/null
+++ b/.Rproj.user/9DAE6990/sources/s-E6946356/A53AF86
@@ -0,0 +1,33 @@
+{
+    "collab_server" : "",
+    "contents" : "",
+    "created" : 1623081543122.000,
+    "dirty" : false,
+    "encoding" : "",
+    "folds" : "",
+    "hash" : "0",
+    "id" : "A53AF86",
+    "lastKnownWriteTime" : 4522750493,
+    "last_content_update" : 1623081543122,
+    "path" : null,
+    "project_path" : null,
+    "properties" : {
+        "cacheKey" : "C830EC37",
+        "caption" : "tab2",
+        "contentUrl" : "grid_resource/gridviewer.html?env=&obj=tab2&cache_key=C830EC37",
+        "displayedObservations" : 11125,
+        "environment" : "",
+        "expression" : "tab2",
+        "object" : "tab2",
+        "preview" : 0,
+        "totalObservations" : 11125,
+        "variables" : 9
+    },
+    "read_only" : false,
+    "read_only_alternatives" : [
+    ],
+    "relative_order" : 11,
+    "source_on_save" : false,
+    "source_window" : "",
+    "type" : "r_dataframe"
+}
\ No newline at end of file
diff --git a/.Rproj.user/9DAE6990/sources/s-E6946356/A53AF86-contents b/.Rproj.user/9DAE6990/sources/s-E6946356/A53AF86-contents
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/.Rproj.user/9DAE6990/sources/per/t/A6A5703A b/.Rproj.user/9DAE6990/sources/s-E6946356/A6A5703A
similarity index 83%
rename from .Rproj.user/9DAE6990/sources/per/t/A6A5703A
rename to .Rproj.user/9DAE6990/sources/s-E6946356/A6A5703A
index e498a6cf136ca26ccf4887243c193d65fc23b154..5786c571b22d4afd66e80b2f279be83989d6f68c 100644
--- a/.Rproj.user/9DAE6990/sources/per/t/A6A5703A
+++ b/.Rproj.user/9DAE6990/sources/s-E6946356/A6A5703A
@@ -5,10 +5,10 @@
     "dirty" : false,
     "encoding" : "UTF-8",
     "folds" : "",
-    "hash" : "953998608",
+    "hash" : "0",
     "id" : "A6A5703A",
-    "lastKnownWriteTime" : 1622641746,
-    "last_content_update" : 1622641746302,
+    "lastKnownWriteTime" : 1623060553,
+    "last_content_update" : 1623060553,
     "path" : "~/Documents/PhD/stuart_R/stuart/R/stuart_tab-data.R",
     "project_path" : "R/stuart_tab-data.R",
     "properties" : {
diff --git a/.Rproj.user/9DAE6990/sources/per/t/A6A5703A-contents b/.Rproj.user/9DAE6990/sources/s-E6946356/A6A5703A-contents
similarity index 100%
rename from .Rproj.user/9DAE6990/sources/per/t/A6A5703A-contents
rename to .Rproj.user/9DAE6990/sources/s-E6946356/A6A5703A-contents
diff --git a/.Rproj.user/9DAE6990/sources/s-E6946356/B72D9362-contents b/.Rproj.user/9DAE6990/sources/s-E6946356/B72D9362-contents
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/.Rproj.user/9DAE6990/sources/per/t/B86C81D8 b/.Rproj.user/9DAE6990/sources/s-E6946356/B86C81D8
similarity index 91%
rename from .Rproj.user/9DAE6990/sources/per/t/B86C81D8
rename to .Rproj.user/9DAE6990/sources/s-E6946356/B86C81D8
index b6a9d87a051e2d8d3ec63945fa4811444bec9447..e51503df741d992bb8d968cf05360237c25e90a2 100644
--- a/.Rproj.user/9DAE6990/sources/per/t/B86C81D8
+++ b/.Rproj.user/9DAE6990/sources/s-E6946356/B86C81D8
@@ -5,7 +5,7 @@
     "dirty" : false,
     "encoding" : "UTF-8",
     "folds" : "",
-    "hash" : "4129306061",
+    "hash" : "0",
     "id" : "B86C81D8",
     "lastKnownWriteTime" : 1622646597,
     "last_content_update" : 1622646597951,
@@ -18,7 +18,7 @@
     "read_only" : false,
     "read_only_alternatives" : [
     ],
-    "relative_order" : 10,
+    "relative_order" : 8,
     "source_on_save" : false,
     "source_window" : "",
     "type" : "r_source"
diff --git a/.Rproj.user/9DAE6990/sources/per/t/B86C81D8-contents b/.Rproj.user/9DAE6990/sources/s-E6946356/B86C81D8-contents
similarity index 100%
rename from .Rproj.user/9DAE6990/sources/per/t/B86C81D8-contents
rename to .Rproj.user/9DAE6990/sources/s-E6946356/B86C81D8-contents
diff --git a/.Rproj.user/9DAE6990/sources/per/t/C5228C18 b/.Rproj.user/9DAE6990/sources/s-E6946356/C5228C18
similarity index 79%
rename from .Rproj.user/9DAE6990/sources/per/t/C5228C18
rename to .Rproj.user/9DAE6990/sources/s-E6946356/C5228C18
index b8720f38836d77837dc46bbbfa77028c6803354d..da6f98676fa62a8d5a2359455cf949a82bb0a84c 100644
--- a/.Rproj.user/9DAE6990/sources/per/t/C5228C18
+++ b/.Rproj.user/9DAE6990/sources/s-E6946356/C5228C18
@@ -5,10 +5,10 @@
     "dirty" : false,
     "encoding" : "UTF-8",
     "folds" : "",
-    "hash" : "1417555270",
+    "hash" : "0",
     "id" : "C5228C18",
-    "lastKnownWriteTime" : 1622645200,
-    "last_content_update" : 1622645200474,
+    "lastKnownWriteTime" : 1623060553,
+    "last_content_update" : 1623060553,
     "path" : "~/Documents/PhD/stuart_R/stuart/R/mark_poly.R",
     "project_path" : "R/mark_poly.R",
     "properties" : {
@@ -18,7 +18,7 @@
     "read_only" : false,
     "read_only_alternatives" : [
     ],
-    "relative_order" : 8,
+    "relative_order" : 7,
     "source_on_save" : false,
     "source_window" : "",
     "type" : "r_source"
diff --git a/.Rproj.user/9DAE6990/sources/per/t/C5228C18-contents b/.Rproj.user/9DAE6990/sources/s-E6946356/C5228C18-contents
similarity index 100%
rename from .Rproj.user/9DAE6990/sources/per/t/C5228C18-contents
rename to .Rproj.user/9DAE6990/sources/s-E6946356/C5228C18-contents
diff --git a/.Rproj.user/9DAE6990/sources/per/t/C81C94E6 b/.Rproj.user/9DAE6990/sources/s-E6946356/C81C94E6
similarity index 91%
rename from .Rproj.user/9DAE6990/sources/per/t/C81C94E6
rename to .Rproj.user/9DAE6990/sources/s-E6946356/C81C94E6
index b1b9d06ed6d1b4eaf5db74d57876e6219b523984..7e8b493d559ba8b7760a8dff8d6de4e3510fd8bc 100644
--- a/.Rproj.user/9DAE6990/sources/per/t/C81C94E6
+++ b/.Rproj.user/9DAE6990/sources/s-E6946356/C81C94E6
@@ -5,7 +5,7 @@
     "dirty" : false,
     "encoding" : "UTF-8",
     "folds" : "",
-    "hash" : "1425873394",
+    "hash" : "0",
     "id" : "C81C94E6",
     "lastKnownWriteTime" : 1622623114,
     "last_content_update" : 1622623114332,
@@ -18,7 +18,7 @@
     "read_only" : false,
     "read_only_alternatives" : [
     ],
-    "relative_order" : 12,
+    "relative_order" : 10,
     "source_on_save" : false,
     "source_window" : "",
     "type" : "dcf"
diff --git a/.Rproj.user/9DAE6990/sources/per/t/C81C94E6-contents b/.Rproj.user/9DAE6990/sources/s-E6946356/C81C94E6-contents
similarity index 100%
rename from .Rproj.user/9DAE6990/sources/per/t/C81C94E6-contents
rename to .Rproj.user/9DAE6990/sources/s-E6946356/C81C94E6-contents
diff --git a/.Rproj.user/9DAE6990/sources/s-E6946356/lock_file b/.Rproj.user/9DAE6990/sources/s-E6946356/lock_file
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/9DAE699031136BFE/chunks.json b/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/9DAE699031136BFE/chunks.json
deleted file mode 100644
index 9a361141cd10311f5d382cad0d9b9c0904bc75de..0000000000000000000000000000000000000000
--- a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/9DAE699031136BFE/chunks.json
+++ /dev/null
@@ -1 +0,0 @@
-{"chunk_definitions":[{"chunk_id":"cugiprfbptcaw","chunk_label":"unnamed-chunk-1","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","include":false,"label":"unnamed-chunk-1"},"row":15,"row_count":1,"visible":true},{"chunk_id":"csetup_chunk","chunk_label":"setup","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","include":false,"label":"setup"},"row":31,"row_count":1,"visible":true},{"chunk_id":"ct8u35p5h48pa","chunk_label":"annot","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"annot"},"row":44,"row_count":1,"visible":true},{"chunk_id":"cystga685ux9r","chunk_label":"load","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"load"},"row":53,"row_count":1,"visible":true},{"chunk_id":"cc71rfo54vvou","chunk_label":"strains","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"strains"},"row":66,"row_count":1,"visible":true},{"chunk_id":"coar8mvardv1z","chunk_label":"no_parent","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"no_parent"},"row":71,"row_count":1,"visible":true},{"chunk_id":"cyqo4jk1414tp","chunk_label":"tab_mark","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"tab_mark"},"row":84,"row_count":1,"visible":true},{"chunk_id":"ci1zg9xosgth8","chunk_label":"mark_match","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"mark_match"},"row":93,"row_count":1,"visible":true},{"chunk_id":"c4j6ei29p4187","chunk_label":"mark_poly ex","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"mark_poly ex"},"row":102,"row_count":1,"visible":true},{"chunk_id":"cndnl4vh4xyj8","chunk_label":"mark_prop ex","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"mark_prop ex"},"row":109,"row_count":1,"visible":true},{"chunk_id":"cgrscnwnyajvi","chunk_label":"mark_allele","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"mark_allele"},"row":116,"row_count":1,"visible":true},{"chunk_id":"c45rvmci4gaoy","chunk_label":"mark_allele-strains","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"mark_allele-strains"},"row":122,"row_count":1,"visible":true},{"chunk_id":"cv6d9nrsrzqfm","chunk_label":"write_qtl","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"write_qtl"},"row":132,"row_count":1,"visible":true}],"default_chunk_options":{},"doc_write_time":1622538563,"working_dir":null}
\ No newline at end of file
diff --git a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/9DAE699039B546A6/chunks.json b/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/9DAE699039B546A6/chunks.json
deleted file mode 100644
index d8a6599efd36ca83763410009f57390ee063abbf..0000000000000000000000000000000000000000
--- a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/9DAE699039B546A6/chunks.json
+++ /dev/null
@@ -1 +0,0 @@
-{"chunk_definitions":[{"chunk_id":"cugiprfbptcaw","chunk_label":"unnamed-chunk-1","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","include":false,"label":"unnamed-chunk-1"},"row":15,"row_count":1,"visible":true},{"chunk_id":"csetup_chunk","chunk_label":"setup","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","include":false,"label":"setup"},"row":31,"row_count":1,"visible":true},{"chunk_id":"cvmghh26lmpwd","chunk_label":"annot","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"annot"},"row":45,"row_count":1,"visible":true},{"chunk_id":"cystga685ux9r","chunk_label":"load","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"load"},"row":60,"row_count":1,"visible":true},{"chunk_id":"cc71rfo54vvou","chunk_label":"strains","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"strains"},"row":73,"row_count":1,"visible":true},{"chunk_id":"coar8mvardv1z","chunk_label":"no_parent","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"no_parent"},"row":78,"row_count":1,"visible":true},{"chunk_id":"cyqo4jk1414tp","chunk_label":"tab_mark","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"tab_mark"},"row":91,"row_count":1,"visible":true},{"chunk_id":"ci1zg9xosgth8","chunk_label":"mark_match","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"mark_match"},"row":100,"row_count":1,"visible":true},{"chunk_id":"c4j6ei29p4187","chunk_label":"mark_poly ex","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"mark_poly ex"},"row":109,"row_count":1,"visible":true},{"chunk_id":"cndnl4vh4xyj8","chunk_label":"mark_prop ex","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"mark_prop ex"},"row":116,"row_count":1,"visible":true},{"chunk_id":"cgrscnwnyajvi","chunk_label":"mark_allele","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"mark_allele"},"row":123,"row_count":1,"visible":true},{"chunk_id":"c45rvmci4gaoy","chunk_label":"mark_allele-strains","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"mark_allele-strains"},"row":129,"row_count":1,"visible":true},{"chunk_id":"cv6d9nrsrzqfm","chunk_label":"write_qtl","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"write_qtl"},"row":139,"row_count":1,"visible":true}],"default_chunk_options":{},"doc_write_time":1622642681,"working_dir":null}
\ No newline at end of file
diff --git a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/c45rvmci4gaoy/000010.csv b/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/c45rvmci4gaoy/000010.csv
deleted file mode 100644
index e0b8942f0f6d2e406a000445d2de1d3b4e6653b0..0000000000000000000000000000000000000000
--- a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/c45rvmci4gaoy/000010.csv
+++ /dev/null
@@ -1 +0,0 @@
-"0","strains %>% filter(marker %in% c(""gJAX00038569"",""gJAX00425031"",""gUNC12245354"",""gUNC15530876"",""gUNC21555204"",""gUNC21596600"")) %>% arrange(marker) %>% select(marker,parent1,parent2)"
diff --git a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/c45rvmci4gaoy/000011.metadata b/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/c45rvmci4gaoy/000011.metadata
deleted file mode 100644
index ec2c4d79915cb51b75bfe347815a707160949d0e..0000000000000000000000000000000000000000
--- a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/c45rvmci4gaoy/000011.metadata
+++ /dev/null
@@ -1 +0,0 @@
-{"classes":["data.frame"],"ncol":3,"nrow":6}
\ No newline at end of file
diff --git a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/c45rvmci4gaoy/000011.rdf b/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/c45rvmci4gaoy/000011.rdf
deleted file mode 100644
index 19dc89bc8ba8f67f81cdb1ed0134cdcd7c2ce614..0000000000000000000000000000000000000000
Binary files a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/c45rvmci4gaoy/000011.rdf and /dev/null differ
diff --git a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/c4j6ei29p4187/000011.rdf b/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/c4j6ei29p4187/000011.rdf
deleted file mode 100644
index 1ee8e8c036a79b472092c20d315cf7b5c665b0b0..0000000000000000000000000000000000000000
Binary files a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/c4j6ei29p4187/000011.rdf and /dev/null differ
diff --git a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/cgrscnwnyajvi/000010.csv b/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/cgrscnwnyajvi/000010.csv
deleted file mode 100644
index e74b7bdd18c9aca3c844c6fadf7e9c5f35f5e7cc..0000000000000000000000000000000000000000
--- a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/cgrscnwnyajvi/000010.csv
+++ /dev/null
@@ -1,2 +0,0 @@
-"0","tab2 <- mark_allele(tab=tab2,ref=strains,par1=""parent1"",par2=""parent2"")"
-"0","tab2 %>% arrange(desc(exclude_allele)) %>% head()"
diff --git a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/cgrscnwnyajvi/000011.metadata b/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/cgrscnwnyajvi/000011.metadata
deleted file mode 100644
index eeb3cda550272b2a5342cf135b54c94d24052a0f..0000000000000000000000000000000000000000
--- a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/cgrscnwnyajvi/000011.metadata
+++ /dev/null
@@ -1 +0,0 @@
-{"classes":["tbl_df","tbl","data.frame"],"ncol":11,"nrow":6}
\ No newline at end of file
diff --git a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/cgrscnwnyajvi/000011.rdf b/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/cgrscnwnyajvi/000011.rdf
deleted file mode 100644
index 9aed4888fa27145560e2699ba308d22765125768..0000000000000000000000000000000000000000
Binary files a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/cgrscnwnyajvi/000011.rdf and /dev/null differ
diff --git a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/chunks.json b/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/chunks.json
deleted file mode 100644
index d8a6599efd36ca83763410009f57390ee063abbf..0000000000000000000000000000000000000000
--- a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/chunks.json
+++ /dev/null
@@ -1 +0,0 @@
-{"chunk_definitions":[{"chunk_id":"cugiprfbptcaw","chunk_label":"unnamed-chunk-1","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","include":false,"label":"unnamed-chunk-1"},"row":15,"row_count":1,"visible":true},{"chunk_id":"csetup_chunk","chunk_label":"setup","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","include":false,"label":"setup"},"row":31,"row_count":1,"visible":true},{"chunk_id":"cvmghh26lmpwd","chunk_label":"annot","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"annot"},"row":45,"row_count":1,"visible":true},{"chunk_id":"cystga685ux9r","chunk_label":"load","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"load"},"row":60,"row_count":1,"visible":true},{"chunk_id":"cc71rfo54vvou","chunk_label":"strains","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"strains"},"row":73,"row_count":1,"visible":true},{"chunk_id":"coar8mvardv1z","chunk_label":"no_parent","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"no_parent"},"row":78,"row_count":1,"visible":true},{"chunk_id":"cyqo4jk1414tp","chunk_label":"tab_mark","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"tab_mark"},"row":91,"row_count":1,"visible":true},{"chunk_id":"ci1zg9xosgth8","chunk_label":"mark_match","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"mark_match"},"row":100,"row_count":1,"visible":true},{"chunk_id":"c4j6ei29p4187","chunk_label":"mark_poly ex","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"mark_poly ex"},"row":109,"row_count":1,"visible":true},{"chunk_id":"cndnl4vh4xyj8","chunk_label":"mark_prop ex","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"mark_prop ex"},"row":116,"row_count":1,"visible":true},{"chunk_id":"cgrscnwnyajvi","chunk_label":"mark_allele","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"mark_allele"},"row":123,"row_count":1,"visible":true},{"chunk_id":"c45rvmci4gaoy","chunk_label":"mark_allele-strains","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"mark_allele-strains"},"row":129,"row_count":1,"visible":true},{"chunk_id":"cv6d9nrsrzqfm","chunk_label":"write_qtl","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"write_qtl"},"row":139,"row_count":1,"visible":true}],"default_chunk_options":{},"doc_write_time":1622642681,"working_dir":null}
\ No newline at end of file
diff --git a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/ci1zg9xosgth8/000014.rdf b/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/ci1zg9xosgth8/000014.rdf
deleted file mode 100644
index 29735d32b12b977a22f679a708962e08b9477a71..0000000000000000000000000000000000000000
Binary files a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/ci1zg9xosgth8/000014.rdf and /dev/null differ
diff --git a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/cndnl4vh4xyj8/000010.csv b/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/cndnl4vh4xyj8/000010.csv
deleted file mode 100644
index fe548bf35c02eb7aa036260ffc859252f738a25d..0000000000000000000000000000000000000000
--- a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/cndnl4vh4xyj8/000010.csv
+++ /dev/null
@@ -1,2 +0,0 @@
-"0","tab2 <- mark_prop(tab2,cross=""F2"",homo=0.1,hetero=0.1)"
-"0","head(tab2)"
diff --git a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/cndnl4vh4xyj8/000011.metadata b/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/cndnl4vh4xyj8/000011.metadata
deleted file mode 100644
index cb629601be14008f55c58ec2dc91c3672f7ac8cd..0000000000000000000000000000000000000000
--- a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/cndnl4vh4xyj8/000011.metadata
+++ /dev/null
@@ -1 +0,0 @@
-{"classes":["tbl_df","tbl","data.frame"],"ncol":10,"nrow":6}
\ No newline at end of file
diff --git a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/cndnl4vh4xyj8/000011.rdf b/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/cndnl4vh4xyj8/000011.rdf
deleted file mode 100644
index d1a49b5eedf5d57e934e3307b83fcc148b4d3552..0000000000000000000000000000000000000000
Binary files a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/cndnl4vh4xyj8/000011.rdf and /dev/null differ
diff --git a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/cv6d9nrsrzqfm/000021.csv b/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/cv6d9nrsrzqfm/000021.csv
deleted file mode 100644
index 7da078df8029ee5337e0f0fccd91fb39f8d96ca3..0000000000000000000000000000000000000000
--- a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/cv6d9nrsrzqfm/000021.csv
+++ /dev/null
@@ -1,3 +0,0 @@
-"0","rqtl_file <- write_rqtl(geno=genos,pheno=phenos,tab=tab2,ref=strains,par1=""parent1"",par2=""parent2"",prefix=""ind_"",pos=""cM_cox"")"
-"0",""
-"0","rqtl_file[1:10,1:7]"
diff --git a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/cv6d9nrsrzqfm/000022.metadata b/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/cv6d9nrsrzqfm/000022.metadata
deleted file mode 100644
index 825da23674df0a3455b3082fc8f3c96aeb486c34..0000000000000000000000000000000000000000
--- a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/cv6d9nrsrzqfm/000022.metadata
+++ /dev/null
@@ -1 +0,0 @@
-{"classes":["tbl_df","tbl","data.frame"],"ncol":7,"nrow":10}
\ No newline at end of file
diff --git a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/cv6d9nrsrzqfm/000022.rdf b/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/cv6d9nrsrzqfm/000022.rdf
deleted file mode 100644
index f92cc82ac1146811a9837c7238592d3063c24369..0000000000000000000000000000000000000000
Binary files a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/cv6d9nrsrzqfm/000022.rdf and /dev/null differ
diff --git a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/cyqo4jk1414tp/000005.csv b/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/cyqo4jk1414tp/000005.csv
deleted file mode 100644
index 8f499aea3ff86e63d5beeafd589aa8cf86622e3a..0000000000000000000000000000000000000000
--- a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/cyqo4jk1414tp/000005.csv
+++ /dev/null
@@ -1,4 +0,0 @@
-"0","tab <- mark_tab(genos)
-"
-"2","Error in mark_tab(genos) : impossible de trouver la fonction ""mark_tab""
-"
diff --git a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/cyqo4jk1414tp/000006.error b/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/cyqo4jk1414tp/000006.error
deleted file mode 100644
index 3aaf4b2b5b4ec1243e367bb27f235ba6ebf71da0..0000000000000000000000000000000000000000
--- a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/cyqo4jk1414tp/000006.error
+++ /dev/null
@@ -1 +0,0 @@
-{"frames":[],"message":"Error in mark_tab(genos) : impossible de trouver la fonction \"mark_tab\"\n"}
\ No newline at end of file
diff --git a/.Rproj.user/shared/notebooks/C3675061-stuaRt/1/9DAE69902F7E98B0/chunks.json b/.Rproj.user/shared/notebooks/C3675061-stuaRt/1/9DAE69902F7E98B0/chunks.json
new file mode 100644
index 0000000000000000000000000000000000000000..2ae2af1a405c387b16b410517bf321515a703b7b
--- /dev/null
+++ b/.Rproj.user/shared/notebooks/C3675061-stuaRt/1/9DAE69902F7E98B0/chunks.json
@@ -0,0 +1 @@
+{"chunk_definitions":[{"chunk_id":"csetup_chunk","chunk_label":"setup","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","include":false,"label":"setup"},"row":31,"row_count":1,"visible":true},{"chunk_id":"cvrfzlkmsnd5m","chunk_label":"annot","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"annot"},"row":45,"row_count":1,"visible":true},{"chunk_id":"c0s26bf1pu5ys","chunk_label":"load","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"load"},"row":60,"row_count":1,"visible":true},{"chunk_id":"cxuyx1brxodqv","chunk_label":"strains","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"strains"},"row":73,"row_count":1,"visible":true},{"chunk_id":"ccbr8kr5rmfiz","chunk_label":"no_parent","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"no_parent"},"row":78,"row_count":1,"visible":true},{"chunk_id":"ceekbogybpgbx","chunk_label":"tab_mark","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"tab_mark"},"row":91,"row_count":1,"visible":true},{"chunk_id":"cgfik6q17v45t","chunk_label":"mark_match","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"mark_match"},"row":100,"row_count":1,"visible":true},{"chunk_id":"c4gkr1xb8o1a9","chunk_label":"mark_poly ex","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"mark_poly ex"},"row":109,"row_count":1,"visible":true},{"chunk_id":"cp87d27x07m61","chunk_label":"mark_prop ex","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"mark_prop ex"},"row":186,"row_count":1,"visible":true}],"default_chunk_options":{},"doc_write_time":1623065923,"working_dir":null}
\ No newline at end of file
diff --git a/.Rproj.user/shared/notebooks/C3675061-stuaRt/1/9DAE6990E6946356/chunks.json b/.Rproj.user/shared/notebooks/C3675061-stuaRt/1/9DAE6990E6946356/chunks.json
new file mode 100644
index 0000000000000000000000000000000000000000..49caf2049d6ca5e813dae2a5c56e8e5c8613efde
--- /dev/null
+++ b/.Rproj.user/shared/notebooks/C3675061-stuaRt/1/9DAE6990E6946356/chunks.json
@@ -0,0 +1 @@
+{"chunk_definitions":[{"chunk_id":"culdjhv7njxmo","chunk_label":"unnamed-chunk-1","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","include":false,"label":"unnamed-chunk-3"},"row":15,"row_count":1,"visible":true},{"chunk_id":"csetup_chunk","chunk_label":"setup","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","include":false,"label":"setup"},"row":31,"row_count":1,"visible":true},{"chunk_id":"cvrfzlkmsnd5m","chunk_label":"annot","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"annot"},"row":45,"row_count":1,"visible":true},{"chunk_id":"c0s26bf1pu5ys","chunk_label":"load","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"load"},"row":60,"row_count":1,"visible":true},{"chunk_id":"cxuyx1brxodqv","chunk_label":"strains","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"strains"},"row":73,"row_count":1,"visible":true},{"chunk_id":"ccbr8kr5rmfiz","chunk_label":"no_parent","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"no_parent"},"row":78,"row_count":1,"visible":true},{"chunk_id":"ceekbogybpgbx","chunk_label":"tab_mark","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"tab_mark"},"row":91,"row_count":1,"visible":true},{"chunk_id":"cgfik6q17v45t","chunk_label":"mark_match","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"mark_match"},"row":100,"row_count":1,"visible":true},{"chunk_id":"c4gkr1xb8o1a9","chunk_label":"mark_poly ex","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"mark_poly ex"},"row":109,"row_count":1,"visible":true},{"chunk_id":"cp87d27x07m61","chunk_label":"mark_prop ex","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"mark_prop ex"},"row":116,"row_count":1,"visible":true}],"default_chunk_options":{},"doc_write_time":1623085296,"working_dir":null}
\ No newline at end of file
diff --git a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/cystga685ux9r/000002.csv b/.Rproj.user/shared/notebooks/C3675061-stuaRt/1/s/c0s26bf1pu5ys/000002.csv
similarity index 97%
rename from .Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/cystga685ux9r/000002.csv
rename to .Rproj.user/shared/notebooks/C3675061-stuaRt/1/s/c0s26bf1pu5ys/000002.csv
index 461d6cb5cd6c80e41a361c4352018911c60d39f5..552541c9101539e4d3a9276789ad222fa4f83729 100644
--- a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/cystga685ux9r/000002.csv
+++ b/.Rproj.user/shared/notebooks/C3675061-stuaRt/1/s/c0s26bf1pu5ys/000002.csv
@@ -5,76 +5,93 @@
 "1","  Sample.ID        "
 "1"," Allele1...Forward "
 "1"," Allele2...Forward "
-"1","       X          "
-"1","       Y          "
-"1","    GC.Score     "
-"1","     Theta       "
 "1","
 "
 "1"," Length:2002493    "
 "1"," Length:2002493    "
 "1"," Length:2002493    "
 "1"," Length:2002493    "
-"1"," Min.   : 0.0000  "
-"1"," Min.   : 0.0000  "
-"1"," Min.   :0.0000  "
-"1"," Min.   :0.0000  "
 "1","
 "
 "1"," Class :character  "
 "1"," Class :character  "
 "1"," Class :character  "
 "1"," Class :character  "
-"1"," 1st Qu.: 0.0260  "
-"1"," 1st Qu.: 0.0480  "
-"1"," 1st Qu.:0.6747  "
-"1"," 1st Qu.:0.0420  "
 "1","
 "
 "1"," Mode  :character  "
 "1"," Mode  :character  "
 "1"," Mode  :character  "
 "1"," Mode  :character  "
-"1"," Median : 0.1750  "
-"1"," Median : 0.5010  "
-"1"," Median :0.8550  "
-"1"," Median :0.6620  "
 "1","
 "
 "1","                   "
 "1","                   "
 "1","                   "
 "1","                   "
-"1"," Mean   : 0.5716  "
-"1"," Mean   : 0.6564  "
-"1"," Mean   :0.7276  "
-"1"," Mean   :0.5606  "
 "1","
 "
 "1","                   "
 "1","                   "
 "1","                   "
 "1","                   "
-"1"," 3rd Qu.: 0.8560  "
-"1"," 3rd Qu.: 1.0470  "
-"1"," 3rd Qu.:0.9245  "
-"1"," 3rd Qu.:0.9800  "
 "1","
 "
 "1","                   "
 "1","                   "
 "1","                   "
 "1","                   "
-"1"," Max.   :25.1610  "
-"1"," Max.   :20.7940  "
-"1"," Max.   :0.9889  "
-"1"," Max.   :1.0000  "
 "1","
 "
 "1","                   "
 "1","                   "
 "1","                   "
 "1","                   "
+"1","
+"
+"1",""
+"1","       X          "
+"1","       Y          "
+"1","    GC.Score     "
+"1","     Theta       "
+"1","
+"
+"1"," Min.   : 0.0000  "
+"1"," Min.   : 0.0000  "
+"1"," Min.   :0.0000  "
+"1"," Min.   :0.0000  "
+"1","
+"
+"1"," 1st Qu.: 0.0260  "
+"1"," 1st Qu.: 0.0480  "
+"1"," 1st Qu.:0.6747  "
+"1"," 1st Qu.:0.0420  "
+"1","
+"
+"1"," Median : 0.1750  "
+"1"," Median : 0.5010  "
+"1"," Median :0.8550  "
+"1"," Median :0.6620  "
+"1","
+"
+"1"," Mean   : 0.5716  "
+"1"," Mean   : 0.6564  "
+"1"," Mean   :0.7276  "
+"1"," Mean   :0.5606  "
+"1","
+"
+"1"," 3rd Qu.: 0.8560  "
+"1"," 3rd Qu.: 1.0470  "
+"1"," 3rd Qu.:0.9245  "
+"1"," 3rd Qu.:0.9800  "
+"1","
+"
+"1"," Max.   :25.1610  "
+"1"," Max.   :20.7940  "
+"1"," Max.   :0.9889  "
+"1"," Max.   :1.0000  "
+"1","
+"
 "1"," NA's   :87       "
 "1"," NA's   :87       "
 "1"," NA's   :326     "
diff --git a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/c4j6ei29p4187/000010.csv b/.Rproj.user/shared/notebooks/C3675061-stuaRt/1/s/c4gkr1xb8o1a9/000006.csv
similarity index 100%
rename from .Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/c4j6ei29p4187/000010.csv
rename to .Rproj.user/shared/notebooks/C3675061-stuaRt/1/s/c4gkr1xb8o1a9/000006.csv
diff --git a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/c4j6ei29p4187/000011.metadata b/.Rproj.user/shared/notebooks/C3675061-stuaRt/1/s/c4gkr1xb8o1a9/000007.metadata
similarity index 100%
rename from .Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/c4j6ei29p4187/000011.metadata
rename to .Rproj.user/shared/notebooks/C3675061-stuaRt/1/s/c4gkr1xb8o1a9/000007.metadata
diff --git a/.Rproj.user/shared/notebooks/C3675061-stuaRt/1/s/c4gkr1xb8o1a9/000007.rdf b/.Rproj.user/shared/notebooks/C3675061-stuaRt/1/s/c4gkr1xb8o1a9/000007.rdf
new file mode 100644
index 0000000000000000000000000000000000000000..8093fc277d049c71627b60e309e5ccbd9f89d352
Binary files /dev/null and b/.Rproj.user/shared/notebooks/C3675061-stuaRt/1/s/c4gkr1xb8o1a9/000007.rdf differ
diff --git a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/coar8mvardv1z/000002.csv b/.Rproj.user/shared/notebooks/C3675061-stuaRt/1/s/ccbr8kr5rmfiz/000002.csv
similarity index 100%
rename from .Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/coar8mvardv1z/000002.csv
rename to .Rproj.user/shared/notebooks/C3675061-stuaRt/1/s/ccbr8kr5rmfiz/000002.csv
diff --git a/.Rproj.user/shared/notebooks/C3675061-stuaRt/1/s/ceekbogybpgbx/000002.csv b/.Rproj.user/shared/notebooks/C3675061-stuaRt/1/s/ceekbogybpgbx/000002.csv
new file mode 100644
index 0000000000000000000000000000000000000000..d9110ec2caa244f4e474991b0f945dfd7042c547
--- /dev/null
+++ b/.Rproj.user/shared/notebooks/C3675061-stuaRt/1/s/ceekbogybpgbx/000002.csv
@@ -0,0 +1,81 @@
+"0","data(stuart_tab)"
+"0","summary(stuart_tab)"
+"1",""
+"1","    marker         "
+"1","   allele_1        "
+"1","   allele_2        "
+"1","     n_HM1      "
+"1","
+"
+"1"," Length:11125      "
+"1"," Length:11125      "
+"1"," Length:11125      "
+"1"," Min.   :  0.0  "
+"1","
+"
+"1"," Class :character  "
+"1"," Class :character  "
+"1"," Class :character  "
+"1"," 1st Qu.: 44.0  "
+"1","
+"
+"1"," Mode  :character  "
+"1"," Mode  :character  "
+"1"," Mode  :character  "
+"1"," Median :174.0  "
+"1","
+"
+"1","                   "
+"1","                   "
+"1","                   "
+"1"," Mean   :123.9  "
+"1","
+"
+"1","                   "
+"1","                   "
+"1","                   "
+"1"," 3rd Qu.:176.0  "
+"1","
+"
+"1","                   "
+"1","                   "
+"1","                   "
+"1"," Max.   :176.0  "
+"1","
+"
+"1",""
+"1","     n_HM2       "
+"1","      n_HT       "
+"1","      n_NA       "
+"1","
+"
+"1"," Min.   :  0.00  "
+"1"," Min.   :  0.00  "
+"1"," Min.   :  0.00  "
+"1","
+"
+"1"," 1st Qu.:  0.00  "
+"1"," 1st Qu.:  0.00  "
+"1"," 1st Qu.:  0.00  "
+"1","
+"
+"1"," Median :  0.00  "
+"1"," Median :  0.00  "
+"1"," Median :  1.00  "
+"1","
+"
+"1"," Mean   : 19.92  "
+"1"," Mean   : 19.24  "
+"1"," Mean   : 12.91  "
+"1","
+"
+"1"," 3rd Qu.: 34.00  "
+"1"," 3rd Qu.:  5.00  "
+"1"," 3rd Qu.:  5.00  "
+"1","
+"
+"1"," Max.   :175.00  "
+"1"," Max.   :176.00  "
+"1"," Max.   :176.00  "
+"1","
+"
diff --git a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/ci1zg9xosgth8/000013.csv b/.Rproj.user/shared/notebooks/C3675061-stuaRt/1/s/cgfik6q17v45t/000006.csv
similarity index 100%
rename from .Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/ci1zg9xosgth8/000013.csv
rename to .Rproj.user/shared/notebooks/C3675061-stuaRt/1/s/cgfik6q17v45t/000006.csv
diff --git a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/ci1zg9xosgth8/000014.metadata b/.Rproj.user/shared/notebooks/C3675061-stuaRt/1/s/cgfik6q17v45t/000007.metadata
similarity index 100%
rename from .Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/ci1zg9xosgth8/000014.metadata
rename to .Rproj.user/shared/notebooks/C3675061-stuaRt/1/s/cgfik6q17v45t/000007.metadata
diff --git a/.Rproj.user/shared/notebooks/C3675061-stuaRt/1/s/cgfik6q17v45t/000007.rdf b/.Rproj.user/shared/notebooks/C3675061-stuaRt/1/s/cgfik6q17v45t/000007.rdf
new file mode 100644
index 0000000000000000000000000000000000000000..87d57a3b8ec997203b9935c7a363f8e531e8fa82
Binary files /dev/null and b/.Rproj.user/shared/notebooks/C3675061-stuaRt/1/s/cgfik6q17v45t/000007.rdf differ
diff --git a/.Rproj.user/shared/notebooks/C3675061-stuaRt/1/s/chunks.json b/.Rproj.user/shared/notebooks/C3675061-stuaRt/1/s/chunks.json
new file mode 100644
index 0000000000000000000000000000000000000000..49caf2049d6ca5e813dae2a5c56e8e5c8613efde
--- /dev/null
+++ b/.Rproj.user/shared/notebooks/C3675061-stuaRt/1/s/chunks.json
@@ -0,0 +1 @@
+{"chunk_definitions":[{"chunk_id":"culdjhv7njxmo","chunk_label":"unnamed-chunk-1","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","include":false,"label":"unnamed-chunk-3"},"row":15,"row_count":1,"visible":true},{"chunk_id":"csetup_chunk","chunk_label":"setup","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","include":false,"label":"setup"},"row":31,"row_count":1,"visible":true},{"chunk_id":"cvrfzlkmsnd5m","chunk_label":"annot","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"annot"},"row":45,"row_count":1,"visible":true},{"chunk_id":"c0s26bf1pu5ys","chunk_label":"load","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"load"},"row":60,"row_count":1,"visible":true},{"chunk_id":"cxuyx1brxodqv","chunk_label":"strains","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"strains"},"row":73,"row_count":1,"visible":true},{"chunk_id":"ccbr8kr5rmfiz","chunk_label":"no_parent","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"no_parent"},"row":78,"row_count":1,"visible":true},{"chunk_id":"ceekbogybpgbx","chunk_label":"tab_mark","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"tab_mark"},"row":91,"row_count":1,"visible":true},{"chunk_id":"cgfik6q17v45t","chunk_label":"mark_match","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"mark_match"},"row":100,"row_count":1,"visible":true},{"chunk_id":"c4gkr1xb8o1a9","chunk_label":"mark_poly ex","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"mark_poly ex"},"row":109,"row_count":1,"visible":true},{"chunk_id":"cp87d27x07m61","chunk_label":"mark_prop ex","document_id":"96AB3736","expansion_state":0,"options":{"engine":"r","label":"mark_prop ex"},"row":116,"row_count":1,"visible":true}],"default_chunk_options":{},"doc_write_time":1623085296,"working_dir":null}
\ No newline at end of file
diff --git a/.Rproj.user/shared/notebooks/C3675061-stuaRt/1/s/cp87d27x07m61/000022.csv b/.Rproj.user/shared/notebooks/C3675061-stuaRt/1/s/cp87d27x07m61/000022.csv
new file mode 100644
index 0000000000000000000000000000000000000000..6b65c967c8eda7edc62d44dfa96c4ecc82427890
--- /dev/null
+++ b/.Rproj.user/shared/notebooks/C3675061-stuaRt/1/s/cp87d27x07m61/000022.csv
@@ -0,0 +1,35 @@
+"0","tab2 <- mark_prop(tab2,cross=""F2"",pval=0.05)
+"
+"2","Chi-squared approximation may be incorrect"
+"2","Chi-squared approximation may be incorrect"
+"2","Chi-squared approximation may be incorrect"
+"2","Chi-squared approximation may be incorrect"
+"2","Chi-squared approximation may be incorrect"
+"2","Chi-squared approximation may be incorrect"
+"2","Chi-squared approximation may be incorrect"
+"2","Chi-squared approximation may be incorrect"
+"2","Chi-squared approximation may be incorrect"
+"2","Chi-squared approximation may be incorrect"
+"2","Chi-squared approximation may be incorrect"
+"2","Chi-squared approximation may be incorrect"
+"2","Chi-squared approximation may be incorrect"
+"2","Chi-squared approximation may be incorrect"
+"2","Chi-squared approximation may be incorrect"
+"2","Chi-squared approximation may be incorrect"
+"2","Chi-squared approximation may be incorrect"
+"2","Chi-squared approximation may be incorrect"
+"2","Chi-squared approximation may be incorrect"
+"2","Chi-squared approximation may be incorrect"
+"2","Chi-squared approximation may be incorrect"
+"2","Chi-squared approximation may be incorrect"
+"2","Chi-squared approximation may be incorrect"
+"2","Chi-squared approximation may be incorrect"
+"2","Chi-squared approximation may be incorrect"
+"2","Chi-squared approximation may be incorrect"
+"2","Chi-squared approximation may be incorrect"
+"2","Chi-squared approximation may be incorrect"
+"2","Chi-squared approximation may be incorrect"
+"2","Chi-squared approximation may be incorrect"
+"2","Chi-squared approximation may be incorrect"
+"2","Chi-squared approximation may be incorrect"
+"2","Chi-squared approximation may be incorrect"
diff --git a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/csetup_chunk/000002.csv b/.Rproj.user/shared/notebooks/C3675061-stuaRt/1/s/csetup_chunk/000002.csv
similarity index 100%
rename from .Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/csetup_chunk/000002.csv
rename to .Rproj.user/shared/notebooks/C3675061-stuaRt/1/s/csetup_chunk/000002.csv
diff --git a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/cugiprfbptcaw/000002.csv b/.Rproj.user/shared/notebooks/C3675061-stuaRt/1/s/culdjhv7njxmo/000002.csv
similarity index 100%
rename from .Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/cugiprfbptcaw/000002.csv
rename to .Rproj.user/shared/notebooks/C3675061-stuaRt/1/s/culdjhv7njxmo/000002.csv
diff --git a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/cvmghh26lmpwd/000002.csv b/.Rproj.user/shared/notebooks/C3675061-stuaRt/1/s/cvrfzlkmsnd5m/000002.csv
similarity index 100%
rename from .Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/cvmghh26lmpwd/000002.csv
rename to .Rproj.user/shared/notebooks/C3675061-stuaRt/1/s/cvrfzlkmsnd5m/000002.csv
diff --git a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/cc71rfo54vvou/000014.csv b/.Rproj.user/shared/notebooks/C3675061-stuaRt/1/s/cxuyx1brxodqv/000006.csv
similarity index 100%
rename from .Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/cc71rfo54vvou/000014.csv
rename to .Rproj.user/shared/notebooks/C3675061-stuaRt/1/s/cxuyx1brxodqv/000006.csv
diff --git a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/cc71rfo54vvou/000015.metadata b/.Rproj.user/shared/notebooks/C3675061-stuaRt/1/s/cxuyx1brxodqv/000007.metadata
similarity index 100%
rename from .Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/cc71rfo54vvou/000015.metadata
rename to .Rproj.user/shared/notebooks/C3675061-stuaRt/1/s/cxuyx1brxodqv/000007.metadata
diff --git a/.Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/cc71rfo54vvou/000015.rdf b/.Rproj.user/shared/notebooks/C3675061-stuaRt/1/s/cxuyx1brxodqv/000007.rdf
similarity index 100%
rename from .Rproj.user/shared/notebooks/4D49CCFD-stuaRt/1/s/cc71rfo54vvou/000015.rdf
rename to .Rproj.user/shared/notebooks/C3675061-stuaRt/1/s/cxuyx1brxodqv/000007.rdf
diff --git a/.Rproj.user/shared/notebooks/paths b/.Rproj.user/shared/notebooks/paths
index f483eb75abcdd04b22b3d1914633421f51c4345f..62c82257f26e5e04a3f11cee7e7a3fb047f5f1c6 100644
--- a/.Rproj.user/shared/notebooks/paths
+++ b/.Rproj.user/shared/notebooks/paths
@@ -1 +1,2 @@
 /Users/mariebourdon/Documents/PhD/stuart_R/stuart/vignettes/stuaRt.Rmd="C3675061"
+/Users/mariebourdon/stuart_package/stuart_old/R/mark_prop.R="5087875"
diff --git a/R/mark_prop.R b/R/mark_prop.R
index 8af6e843dc7d88ac3724cf1c46fde5ba9b43f416..9b64227c7609b19b93b4f2e23a78be0710971df7 100755
--- a/R/mark_prop.R
+++ b/R/mark_prop.R
@@ -14,10 +14,9 @@
 
 #### mark_prop ####
 ## excludes markers depending on proportions of homo/hetorozygous
-## to modify with chisq.test
-mark_prop <- function(tab,cross,homo=NA,hetero=NA,na=0.5){
+mark_prop <- function(tab,cross,homo=NA,hetero=NA,pval=NA,na=0.5){
   #calculate total number of individuals genotyped for each marker
-  tab <- tab %>% mutate(n_geno = tab %>% select(n_HM1,n_HM2,n_HT) %>% rowSums(na.rm=TRUE))
+  tab <- tab %>% mutate(n_geno = (n_HM1 + n_HM2 + n_HT))
 
   #calculate proportion of each genotype
   tab <- tab %>% mutate(p_HM1 = n_HM1/n_geno)
@@ -25,27 +24,50 @@ mark_prop <- function(tab,cross,homo=NA,hetero=NA,na=0.5){
   tab <- tab %>% mutate(p_HT = n_HT/n_geno)
   tab <- tab %>% mutate(p_NA = n_NA/(n_geno+n_NA))
 
+  #stock colnames to join
+  names <- colnames(tab)
+
+
   #stop if cross != "F2" or "N2"
   if(!cross %in% c("F2","N2")){
     stop("Cross must be F2 or N2")
   }
 
-  #stop if no value for "homo" for F2 cross
-  if(cross=="F2" & (is.na(homo)==TRUE | is.na(hetero)==TRUE)){
-    stop("Arguments homo and hetero must be specified for F2 crosses")
+  #stop of homo&hetero or pval not specified
+  if((is.na(homo)==TRUE | is.na(hetero)==TRUE) & is.na(pval)==TRUE){
+    stop("Arguments homo and hetero or argument pval must be specified")
   }
 
-  #stop if no value for "homo" and "hetero" for N2 cross
-  if(cross=="N2" & (is.na(homo)==TRUE | is.na(hetero)==TRUE)){
-    stop("Arguments homo and hetero must be specified for N2 crosses")
+
+
+  #stop with prop of na
+  tab <- tab %>%
+    mutate(exclude_prop=case_when(p_NA > na ~ 1,
+                                  T ~ 0))
+
+  #stop with prop of homo/hetero
+  if(is.na(pval)==TRUE){
+    tab <- tab %>%
+      mutate(exclude_prop=case_when(p_NA > na ~ 1,
+                                    cross=="F2" & (p_HM1 < homo | p_HM2 < homo | p_HT < hetero) ~ 1,
+                                    cross=="N2" & (p_HM1 < homo | p_HT < hetero) ~ 1,
+                                    T ~ exclude_prop
+      ))
   }
 
-  #exclude markers according to proportion of na
-  tab <- tab %>% mutate(exclude_prop=case_when(p_NA > na ~ 1, #exclude markers according to proportion of na
-                                               cross=="F2" & (p_HM1 < homo | p_HM2 < homo | p_HT < hetero) ~ 1, #exclude markers according to proportion of homozygous individuals for F2 cross
-                                               cross=="N2" & (p_HM1 < homo | p_HT < hetero) ~ 1, #exclude markers according to proportion of homozygous and heterozygous individuals for N2 cross
-                                               T ~ 0))
+  #stop with pval chisq.test
+  ## NEED TO ADD THIS FILTER IF CROSS = N2
+  if(is.na(pval)==FALSE){
+
+    tab <- tab %>% filter(p_NA != 1) %>% rowwise() %>%
+      mutate(.,chi_pval = tibble(n_HM1,n_HM2,n_HT) %>%
+               chisq.test(p=c(0.25,0.25,0.5)) %>% .$p.value) %>%
+      full_join(.,tab,by=names)
+
+    tab <- tab %>% mutate(exclude_prop=case_when(chi_pval < pval ~ 1,
+                                                 T ~ exclude_prop))
+  }
 
-  tab <- tab %>% select(-c(p_HM1,p_HM2,p_HT,p_NA,n_geno))
+  tab <- tab %>% select(names)
   return(tab)
 }
diff --git a/stuart_0.1.0.tar.gz b/stuart_0.1.0.tar.gz
index 0574719a0ca2ebd5501a2b4295da59a4b5a87746..06e3b0185bd7480ddf8d5698201ecfffad9732e5 100644
Binary files a/stuart_0.1.0.tar.gz and b/stuart_0.1.0.tar.gz differ