Commit 40425a5a authored by Marie Bourdon's avatar Marie Bourdon
Browse files

modif names mark_allele

parent 48dad002
{
"cursorPosition" : "24,47",
"scrollLine" : "2"
"cursorPosition" : "23,55",
"scrollLine" : "0"
}
\ No newline at end of file
{
"cursorPosition" : "2,104",
"scrollLine" : "0"
}
\ No newline at end of file
{
"cursorPosition" : "106,18",
"cursorPosition" : "127,25",
"last_setup_crc32" : "39B546A65bfca283",
"scrollLine" : "90"
"scrollLine" : "119"
}
\ No newline at end of file
......@@ -5,13 +5,15 @@
"dirty" : false,
"encoding" : "UTF-8",
"folds" : "",
"hash" : "387034705",
"hash" : "0",
"id" : "42D37312",
"lastKnownWriteTime" : 1622465534,
"last_content_update" : 1622465534,
"path" : "~/stuart_package/stuart/R/mark_prop.R",
"project_path" : "R/mark_prop.R",
"properties" : {
"cursorPosition" : "2,104",
"scrollLine" : "0"
},
"read_only" : false,
"read_only_alternatives" : [
......
......@@ -5,16 +5,16 @@
"dirty" : false,
"encoding" : "UTF-8",
"folds" : "",
"hash" : "0",
"hash" : "3134659970",
"id" : "96AB3736",
"lastKnownWriteTime" : 1622645218,
"last_content_update" : 1622645218034,
"lastKnownWriteTime" : 1622647884,
"last_content_update" : 1622647884538,
"path" : "~/stuart_package/stuart/vignettes/stuaRt.Rmd",
"project_path" : "vignettes/stuaRt.Rmd",
"properties" : {
"cursorPosition" : "106,18",
"cursorPosition" : "127,25",
"last_setup_crc32" : "39B546A65bfca283",
"scrollLine" : "90"
"scrollLine" : "119"
},
"read_only" : false,
"read_only_alternatives" : [
......
......@@ -111,21 +111,21 @@ head(tab2)
The `mark_prop()` function can be used to filter markers depending on the proportion of each genotype. Here, we have a F2 so we can use the "homo" argument in order to filter depending on the proportion of both homozygous genotype. If we have a N2, we can filter with the proportion of homozygous individuals with the "homo" argument and of heterozygous individuals with the hetero" argument. Moreover, this function allows to filter marker depending on the proportion on non genotyped animals. By defaults, markers for which more than 50% of individuals were not genotyped.
```{r mark_prop ex,eval=F}
```{r mark_prop ex}
tab2 <- mark_prop(tab2,cross="F2",homo=0.1,hetero=0.1)
head(tab2)
```
Last, we can use the `mark_allele()` function. This very helpful function excludes markers for which the alleles found in the F2/N2 individuals do not correspond to the alleles found in the parental strains. For example, if for a marker is not polymorphic in the parental strains but we found two alleles in the F2/N2 individuals, it will be excluded.
```{r mark_allele,eval=F}
```{r mark_allele}
tab2 <- mark_allele(tab=tab2,ref=strains,par1="parent1",par2="parent2")
tab2 %>% arrange(desc(exclude_allele)) %>% head()
```
Indeed, we can see that the markers excluded with `mark_allele()` have different alleles in the parental strains.
```{r mark_allele-strains,eval=F}
```{r mark_allele-strains}
strains %>% filter(marker %in% c("gJAX00038569","gJAX00425031","gUNC12245354","gUNC15530876","gUNC21555204","gUNC21596600")) %>% arrange(marker) %>% select(marker,parent1,parent2)
```
......
......@@ -5,15 +5,15 @@
"dirty" : false,
"encoding" : "UTF-8",
"folds" : "",
"hash" : "2531250629",
"hash" : "0",
"id" : "B86C81D8",
"lastKnownWriteTime" : 1622462353,
"last_content_update" : 1622462353,
"lastKnownWriteTime" : 1622646597,
"last_content_update" : 1622646597951,
"path" : "~/stuart_package/stuart/R/mark_allele.R",
"project_path" : "R/mark_allele.R",
"properties" : {
"cursorPosition" : "24,47",
"scrollLine" : "2"
"cursorPosition" : "23,55",
"scrollLine" : "0"
},
"read_only" : false,
"read_only_alternatives" : [
......
......@@ -22,21 +22,21 @@ mark_allele <- function(tab,ref,par1,par2){
#join tab and ref genotypes
ref <- ref %>% select(marker,!!sym(par1),!!sym(par2))
tab <- full_join(tab,ref,by=c("SNP.Name"="marker"))
tab <- full_join(tab,ref,by=c("marker"="marker"))
#function core
tab <- tab %>% mutate(exclude_allele = case_when(is.na(Allele_2)==FALSE &
tab <- tab %>% mutate(exclude_allele = case_when(is.na(allele_2)==FALSE &
!!sym(par1) != "N" & !!sym(par2) != "N" & !!sym(par1) != "H" & !!sym(par2) != "H" &
((Allele_1!=!!sym(par1) & Allele_1!=!!sym(par2)) | (Allele_2!=!!sym(par1) & Allele_2!=!!sym(par2))) ~ 1,
is.na(Allele_2)==FALSE &
((allele_1!=!!sym(par1) & allele_1!=!!sym(par2)) | (allele_2!=!!sym(par1) & allele_2!=!!sym(par2))) ~ 1,
is.na(allele_2)==FALSE &
(!!sym(par1)=="N" | !!sym(par2)=="N" | !!sym(par1)=="H" | !!sym(par2)=="H") &
((Allele_1!=!!sym(par1) & Allele_1!=!!sym(par2)) & (Allele_2!=!!sym(par1) & Allele_2!=!!sym(par2))) ~ 1,
is.na(Allele_2)==TRUE &
((allele_1!=!!sym(par1) & allele_1!=!!sym(par2)) & (allele_2!=!!sym(par1) & allele_2!=!!sym(par2))) ~ 1,
is.na(allele_2)==TRUE &
!!sym(par1) != "N" & !!sym(par2) != "N" & !!sym(par1) != "H" & !!sym(par2) != "H" &
(Allele_1!=!!sym(par1) | Allele_1!=!!sym(par2)) ~ 1,
is.na(Allele_2)==TRUE &
(allele_1!=!!sym(par1) | allele_1!=!!sym(par2)) ~ 1,
is.na(allele_2)==TRUE &
(!!sym(par1)=="N" | !!sym(par2)=="N" | !!sym(par1)=="H" | !!sym(par2)=="H") &
Allele_1!=!!sym(par1) & Allele_1!=!!sym(par2) ~ 1,
allele_1!=!!sym(par1) & allele_1!=!!sym(par2) ~ 1,
T ~ 0)
)
......
......@@ -22,21 +22,21 @@ mark_allele <- function(tab,ref,par1,par2){
#join tab and ref genotypes
ref <- ref %>% select(marker,!!sym(par1),!!sym(par2))
tab <- full_join(tab,ref,by=c("SNP.Name"="marker"))
tab <- full_join(tab,ref,by=c("marker"="marker"))
#function core
tab <- tab %>% mutate(exclude_allele = case_when(is.na(Allele_2)==FALSE &
tab <- tab %>% mutate(exclude_allele = case_when(is.na(allele_2)==FALSE &
!!sym(par1) != "N" & !!sym(par2) != "N" & !!sym(par1) != "H" & !!sym(par2) != "H" &
((Allele_1!=!!sym(par1) & Allele_1!=!!sym(par2)) | (Allele_2!=!!sym(par1) & Allele_2!=!!sym(par2))) ~ 1,
is.na(Allele_2)==FALSE &
((allele_1!=!!sym(par1) & allele_1!=!!sym(par2)) | (allele_2!=!!sym(par1) & allele_2!=!!sym(par2))) ~ 1,
is.na(allele_2)==FALSE &
(!!sym(par1)=="N" | !!sym(par2)=="N" | !!sym(par1)=="H" | !!sym(par2)=="H") &
((Allele_1!=!!sym(par1) & Allele_1!=!!sym(par2)) & (Allele_2!=!!sym(par1) & Allele_2!=!!sym(par2))) ~ 1,
is.na(Allele_2)==TRUE &
((allele_1!=!!sym(par1) & allele_1!=!!sym(par2)) & (allele_2!=!!sym(par1) & allele_2!=!!sym(par2))) ~ 1,
is.na(allele_2)==TRUE &
!!sym(par1) != "N" & !!sym(par2) != "N" & !!sym(par1) != "H" & !!sym(par2) != "H" &
(Allele_1!=!!sym(par1) | Allele_1!=!!sym(par2)) ~ 1,
is.na(Allele_2)==TRUE &
(allele_1!=!!sym(par1) | allele_1!=!!sym(par2)) ~ 1,
is.na(allele_2)==TRUE &
(!!sym(par1)=="N" | !!sym(par2)=="N" | !!sym(par1)=="H" | !!sym(par2)=="H") &
Allele_1!=!!sym(par1) & Allele_1!=!!sym(par2) ~ 1,
allele_1!=!!sym(par1) & allele_1!=!!sym(par2) ~ 1,
T ~ 0)
)
......
No preview for this file type
......@@ -111,21 +111,21 @@ head(tab2)
The `mark_prop()` function can be used to filter markers depending on the proportion of each genotype. Here, we have a F2 so we can use the "homo" argument in order to filter depending on the proportion of both homozygous genotype. If we have a N2, we can filter with the proportion of homozygous individuals with the "homo" argument and of heterozygous individuals with the hetero" argument. Moreover, this function allows to filter marker depending on the proportion on non genotyped animals. By defaults, markers for which more than 50% of individuals were not genotyped.
```{r mark_prop ex,eval=F}
```{r mark_prop ex}
tab2 <- mark_prop(tab2,cross="F2",homo=0.1,hetero=0.1)
head(tab2)
```
Last, we can use the `mark_allele()` function. This very helpful function excludes markers for which the alleles found in the F2/N2 individuals do not correspond to the alleles found in the parental strains. For example, if for a marker is not polymorphic in the parental strains but we found two alleles in the F2/N2 individuals, it will be excluded.
```{r mark_allele,eval=F}
```{r mark_allele}
tab2 <- mark_allele(tab=tab2,ref=strains,par1="parent1",par2="parent2")
tab2 %>% arrange(desc(exclude_allele)) %>% head()
```
Indeed, we can see that the markers excluded with `mark_allele()` have different alleles in the parental strains.
```{r mark_allele-strains,eval=F}
```{r mark_allele-strains}
strains %>% filter(marker %in% c("gJAX00038569","gJAX00425031","gUNC12245354","gUNC15530876","gUNC21555204","gUNC21596600")) %>% arrange(marker) %>% select(marker,parent1,parent2)
```
......
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