Commit a412292d authored by mariefbourdon's avatar mariefbourdon
Browse files

mark_na

parent f52b7d83
{
"activeTab" : 1
"activeTab" : 6
}
\ No newline at end of file
build-last-errors="[]"
build-last-errors-base-dir="~/Documents/PhD/stuart_package/stuart/"
build-last-outputs="[{\"output\":\"==> R CMD INSTALL --no-multiarch --with-keep.source stuart\\n\\n\",\"type\":0},{\"output\":\"* installing to library ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library’\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"* installing *source* package ‘stuart’ ...\\n\",\"type\":1},{\"output\":\"** using staged installation\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"** R\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"** data\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"*** moving datasets to lazyload DB\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"** inst\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"** byte-compile and prepare package for lazy loading\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"** help\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"*** installing help indices\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"** building package indices\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"** installing vignettes\\n\",\"type\":1},{\"output\":\"** testing if installed package can be loaded from temporary location\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"** testing if installed package can be loaded from final location\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"** testing if installed package keeps a record of temporary installation path\\n\",\"type\":1},{\"output\":\"* DONE (stuart)\\n\",\"type\":1},{\"output\":\"\",\"type\":1}]"
build-last-outputs="[{\"output\":\"==> R CMD INSTALL --no-multiarch --with-keep.source stuart\\n\\n\",\"type\":0},{\"output\":\"* installing to library ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library’\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"* installing *source* package ‘stuart’ ...\\n\",\"type\":1},{\"output\":\"** using staged installation\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"** R\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"** data\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"*** moving datasets to lazyload DB\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"** inst\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"** byte-compile and prepare package for lazy loading\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"** help\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"*** installing help indices\\n\",\"type\":1},{\"output\":\"** building package indices\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"** installing vignettes\\n\",\"type\":1},{\"output\":\"** testing if installed package can be loaded from temporary location\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"** testing if installed package can be loaded from final location\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"** testing if installed package keeps a record of temporary installation path\\n\",\"type\":1},{\"output\":\"* DONE (stuart)\\n\",\"type\":1},{\"output\":\"\",\"type\":1}]"
compile_pdf_state="{\"errors\":[],\"output\":\"\",\"running\":false,\"tab_visible\":false,\"target_file\":\"\"}"
files.monitored-path=""
find-in-files-state="{\"handle\":\"\",\"input\":\"\",\"path\":\"\",\"regex\":true,\"results\":{\"file\":[],\"line\":[],\"lineValue\":[],\"matchOff\":[],\"matchOn\":[]},\"running\":false}"
......
......@@ -14,11 +14,14 @@
~%2FDocuments%2FPhD%2Fstuart_package%2Fstuart%2FR%2Fmark_allele.R="94A0A47C"
~%2FDocuments%2FPhD%2Fstuart_package%2Fstuart%2FR%2Fmark_estmap.R="122CE4C2"
~%2FDocuments%2FPhD%2Fstuart_package%2Fstuart%2FR%2Fmark_match.R="C03D9873"
~%2FDocuments%2FPhD%2Fstuart_package%2Fstuart%2FR%2Fmark_na.R="BC725065"
~%2FDocuments%2FPhD%2Fstuart_package%2Fstuart%2FR%2Fmark_poly.R="E392A021"
~%2FDocuments%2FPhD%2Fstuart_package%2Fstuart%2FR%2Fmark_prop.R="65449E3B"
~%2FDocuments%2FPhD%2Fstuart_package%2Fstuart%2FR%2Fstuart_tab-data.R="5D74CC67"
~%2FDocuments%2FPhD%2Fstuart_package%2Fstuart%2FR%2Ftab_mark.R="38BAAAF9"
~%2FDocuments%2FPhD%2Fstuart_package%2Fstuart%2FR%2Fwrite_rqtl.R="9A1DD653"
~%2FDocuments%2FPhD%2Fstuart_package%2Fstuart%2Fman%2Fmark_na.Rd="E059577D"
~%2FDocuments%2FPhD%2Fstuart_package%2Fstuart%2Fman%2Fmark_prop.Rd="A5177778"
~%2FDocuments%2FPhD%2Fstuart_package%2Fstuart%2Fvignettes%2FstuaRt.Rmd="5BDF5DBA"
~%2FDocuments%2FPhD%2Fstuart_package%2Fstuart%2Fvignettes%2Fstuart.Rmd="4069DBDF"
~%2Fstuart_package%2Fstuart%2FDESCRIPTION="BEB7232"
......
......@@ -6,5 +6,7 @@
/Users/mariebourdon/Documents/PhD/stuart_package/stuart/R/mark_prop.R="30FA9E8C"
/Users/mariebourdon/Documents/PhD/stuart_package/stuart/R/tab_mark.R="F0B2417"
/Users/mariebourdon/Documents/PhD/stuart_package/stuart/R/write_rqtl.R="F07CE16C"
/Users/mariebourdon/Documents/PhD/stuart_package/stuart/man/mark_na.Rd="C8CA0D4F"
/Users/mariebourdon/Documents/PhD/stuart_package/stuart/man/mark_prop.Rd="893B273D"
/Users/mariebourdon/Documents/PhD/stuart_package/stuart/vignettes/stuaRt.Rmd="DA6206CB"
/Users/mariebourdon/Documents/PhD/stuart_package/stuart/vignettes/stuart.Rmd="54D793B9"
......@@ -4,6 +4,7 @@ export(geno_strains)
export(mark_allele)
export(mark_estmap)
export(mark_match)
export(mark_na)
export(mark_poly)
export(mark_prop)
export(tab_mark)
......
#' @title Exclude markers depending on proportion of missing genotypes
#'
#' @description This function uses the dataframe produced by the tab_mark function and fills the "exclude" column for all the markers that present too much missing genotypes.
#'
#' @param tab data frame obtained with tab_mark function.
#' @param na proportion of non-genotyped individuals above which the marker is excluded.
#'
#' @import dplyr
#' @import tidyselect
#'
#' @export
#'
#### mark_prop ####
## excludes markers depending on proportions of homo/hetorozygous
mark_na <- function(tab,na=0.5){
#calculate total number of individuals genotyped for each marker
tab <- tab %>% mutate(n_geno = (n_HM1 + n_HM2 + n_HT))
#stop with prop of na
#calculate proportion
tab <- tab %>% mutate(p_NA = n_NA/(n_geno+n_NA))
#exclusion
tab <- tab %>%
mutate(exclude_na=case_when(p_NA >= na ~ 1,
T ~ 0))
tab <- tab %>% select(-c(n_geno,p_NA))
return(tab)
}
......@@ -4,7 +4,7 @@
\alias{mark_estmap}
\title{Exclude markers depending on estimated genetic map}
\usage{
mark_estmap(tab, map, annot, d = 20, r = 10, n = 5)
mark_estmap(tab, map, annot, d = 20, r = 5, n = 5)
}
\arguments{
\item{tab}{data frame obtained with tab_mark function.}
......@@ -15,7 +15,7 @@ mark_estmap(tab, map, annot, d = 20, r = 10, n = 5)
\item{d}{a value to identify groups of markers: d is the difference between calculated and known distance with the previous marker, used to identify a new group of markers. Default is 20.}
\item{r}{a value to identify groups of markers: r is the ratio between calculated and known distance with the previous marker, used to identify a new group of markers. Default is 10.}
\item{r}{a value to identify groups of markers: r is the ratio between calculated and known distance with the previous marker, used to identify a new group of markers. Default is 5.}
\item{n}{a value to identify which group of markers must be removed: n is the maximum size of a group of markers: markers with incorrect recombination fraction must be isolated or in very small groups. Default is 5.}
}
......
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/mark_na.R
\name{mark_na}
\alias{mark_na}
\title{Exclude markers depending on proportion of missing genotypes}
\usage{
mark_na(tab, na = 0.5)
}
\arguments{
\item{tab}{data frame obtained with tab_mark function.}
\item{na}{proportion of non-genotyped individuals above which the marker is excluded.}
}
\description{
This function uses the dataframe produced by the tab_mark function and fills the "exclude" column for all the markers that present too much missing genotypes.
}
No preview for this file type
......@@ -103,10 +103,19 @@ summary(stuart_tab)
Then we will use the different mark_* functions in order to filter the markers.
### mark_na
First, we can use `mark_na()` function in order to remove markers with high proportion of missing genotypes in our F2 individuals.
```{r mark_na}
tab2 <- mark_na(stuart_tab)
```
### mark_match
First, we can use `mark_match()` function. Here, the parental strains were genotyped with the F2 individuals, but it can happen that you use previous genotyping results for the parental strains. `mark_match()` function excludes markers that are in your genotype file but not in the reference genotype dataset. We recomend using this function as the chip used for genotyping may change.
Then, we can use `mark_match()` function. Here, the parental strains were genotyped with the F2 individuals, but it can happen that you use previous genotyping results for the parental strains. `mark_match()` function excludes markers that are in your genotype file but not in the reference genotype dataset. We recomend using this function as the chip used for genotyping may change.
```{r mark_match}
tab2 <- mark_match(stuart_tab,ref=strains)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment