From 9e9e9002da3e4a409001d79992f03dd940702532 Mon Sep 17 00:00:00 2001
From: Marie Bourdon <mariefbourdon@gmail.com>
Date: Tue, 11 Jan 2022 12:46:46 +0100
Subject: [PATCH] modifs na prop + vignette

---
 .Rproj.user/9DAE6990/pcs/source-pane.pper     |   2 +-
 .../9DAE6990/pcs/windowlayoutstate.pper       |  12 ++++----
 .Rproj.user/9DAE6990/pcs/workbench-pane.pper  |   4 +--
 .Rproj.user/9DAE6990/persistent-state         |   2 +-
 .Rproj.user/9DAE6990/rmd-outputs              |   4 +--
 .Rproj.user/9DAE6990/sources/prop/INDEX       |   1 +
 .Rproj.user/shared/notebooks/paths            |   1 +
 R/mark_prop.R                                 |  20 ++++++--------
 stuart_1.0.5.tar.gz                           | Bin 1431959100 -> 1994689302 bytes
 vignettes/screenshot_newmap.png               | Bin 0 -> 30377 bytes
 vignettes/stuart.Rmd                          |  26 +++++++++++++++---
 11 files changed, 45 insertions(+), 27 deletions(-)
 create mode 100644 vignettes/screenshot_newmap.png

diff --git a/.Rproj.user/9DAE6990/pcs/source-pane.pper b/.Rproj.user/9DAE6990/pcs/source-pane.pper
index d3d70fa..3249574 100644
--- a/.Rproj.user/9DAE6990/pcs/source-pane.pper
+++ b/.Rproj.user/9DAE6990/pcs/source-pane.pper
@@ -1,3 +1,3 @@
 {
-    "activeTab" : 6
+    "activeTab" : 2
 }
\ No newline at end of file
diff --git a/.Rproj.user/9DAE6990/pcs/windowlayoutstate.pper b/.Rproj.user/9DAE6990/pcs/windowlayoutstate.pper
index 19ed75d..7f81dbc 100644
--- a/.Rproj.user/9DAE6990/pcs/windowlayoutstate.pper
+++ b/.Rproj.user/9DAE6990/pcs/windowlayoutstate.pper
@@ -1,14 +1,14 @@
 {
     "left" : {
-        "panelheight" : 762,
-        "splitterpos" : 199,
+        "panelheight" : 1402,
+        "splitterpos" : 366,
         "topwindowstate" : "NORMAL",
-        "windowheight" : 800
+        "windowheight" : 1440
     },
     "right" : {
-        "panelheight" : 762,
-        "splitterpos" : 479,
+        "panelheight" : 1402,
+        "splitterpos" : 882,
         "topwindowstate" : "NORMAL",
-        "windowheight" : 800
+        "windowheight" : 1440
     }
 }
\ No newline at end of file
diff --git a/.Rproj.user/9DAE6990/pcs/workbench-pane.pper b/.Rproj.user/9DAE6990/pcs/workbench-pane.pper
index b15bf23..b9fcffa 100644
--- a/.Rproj.user/9DAE6990/pcs/workbench-pane.pper
+++ b/.Rproj.user/9DAE6990/pcs/workbench-pane.pper
@@ -1,6 +1,6 @@
 {
-    "TabSet1" : 3,
-    "TabSet2" : 0,
+    "TabSet1" : 1,
+    "TabSet2" : 3,
     "TabZoom" : {
     }
 }
\ No newline at end of file
diff --git a/.Rproj.user/9DAE6990/persistent-state b/.Rproj.user/9DAE6990/persistent-state
index 598ea69..acadc07 100644
--- a/.Rproj.user/9DAE6990/persistent-state
+++ b/.Rproj.user/9DAE6990/persistent-state
@@ -1,6 +1,6 @@
 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\":\"** 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\":\"* 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}]"
 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}"
diff --git a/.Rproj.user/9DAE6990/rmd-outputs b/.Rproj.user/9DAE6990/rmd-outputs
index 97de97a..3da60b5 100644
--- a/.Rproj.user/9DAE6990/rmd-outputs
+++ b/.Rproj.user/9DAE6990/rmd-outputs
@@ -1,5 +1,5 @@
-/private/var/folders/dn/j71yz2tn5_gdffs8fqxhddrr0000gn/T/RtmpZZZ4WE/preview-31873a42c16d.dir/stuaRt.html
-/private/var/folders/dn/j71yz2tn5_gdffs8fqxhddrr0000gn/T/Rtmp3VMULh/preview-1ced48fe920c.dir/stuaRt.html
+/private/var/folders/dn/j71yz2tn5_gdffs8fqxhddrr0000gn/T/RtmpbddlPL/preview-1b515493e142.dir/stuart.html
+
 /private/var/folders/dn/j71yz2tn5_gdffs8fqxhddrr0000gn/T/RtmpNme5vw/preview-4c4321234d03.dir/stuaRt.html
 /private/var/folders/dn/j71yz2tn5_gdffs8fqxhddrr0000gn/T/RtmpZZZ4WE/preview-3187564b41ab.dir/stuaRt.html
 
diff --git a/.Rproj.user/9DAE6990/sources/prop/INDEX b/.Rproj.user/9DAE6990/sources/prop/INDEX
index c8854a6..736b651 100644
--- a/.Rproj.user/9DAE6990/sources/prop/INDEX
+++ b/.Rproj.user/9DAE6990/sources/prop/INDEX
@@ -1,4 +1,5 @@
 %2FVolumes%2F%40Mouselab%2FZika%2FBackcross%2FGeno%2FBC_01.71_stuart.Rmd="73DD6D1F"
+%2FVolumes%2F%40Mouselab%2FZika%2FF2%2FF2_B6.CC001%2FQUGA%2FQUGA.Rmd="D7285907"
 ~%2FDocuments%2FPhD%2Fstuart_R%2Fstuart%2FDESCRIPTION="A58355B1"
 ~%2FDocuments%2FPhD%2Fstuart_R%2Fstuart%2FR%2Fgeno_strains.R="430FE7D7"
 ~%2FDocuments%2FPhD%2Fstuart_R%2Fstuart%2FR%2Fmark_allele.R="58D83345"
diff --git a/.Rproj.user/shared/notebooks/paths b/.Rproj.user/shared/notebooks/paths
index 9a8495e..3457e0e 100644
--- a/.Rproj.user/shared/notebooks/paths
+++ b/.Rproj.user/shared/notebooks/paths
@@ -10,3 +10,4 @@
 /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"
+/Volumes/@Mouselab/Zika/F2/F2_B6.CC001/QUGA/QUGA.Rmd="7EACFFBF"
diff --git a/R/mark_prop.R b/R/mark_prop.R
index a10ec6b..0d756df 100755
--- a/R/mark_prop.R
+++ b/R/mark_prop.R
@@ -26,7 +26,7 @@
 
 #### mark_prop ####
 ## excludes markers depending on proportions of homo/hetorozygous
-mark_prop <- function(tab,cross,homo=NA,hetero=NA,pval=NA,homo1X=NULL,homo2X=NULL,heteroX=NULL,na=0.5){
+mark_prop <- function(tab,cross,homo=NA,hetero=NA,pval=NA,homo1X=NULL,homo2X=NULL,heteroX=NULL){
   #calculate total number of individuals genotyped for each marker
   tab <- tab %>% mutate(n_geno = (n_HM1 + n_HM2 + n_HT))
 
@@ -59,8 +59,7 @@ mark_prop <- function(tab,cross,homo=NA,hetero=NA,pval=NA,homo1X=NULL,homo2X=NUL
   tab <- tab %>% mutate(p_NA = n_NA/(n_geno+n_NA))
 
   tab <- tab %>%
-    mutate(exclude_prop=case_when(p_NA > na ~ 1,
-                                  T ~ 0))
+    mutate(exclude_prop=0)
 
   #stock colnames to join
   names <- colnames(tab)
@@ -73,8 +72,7 @@ mark_prop <- function(tab,cross,homo=NA,hetero=NA,pval=NA,homo1X=NULL,homo2X=NUL
     tab <- tab %>% mutate(p_HT = n_HT/n_geno)
 
     tab <- tab %>%
-      mutate(exclude_prop=case_when(p_NA > na ~ 1,
-                                    !chr %in% c("X","Y","M") & cross=="F2" & (p_HM1 < homo | p_HM2 < homo | p_HT < hetero) ~ 1,
+      mutate(exclude_prop=case_when(!chr %in% c("X","Y","M") & cross=="F2" & (p_HM1 < homo | p_HM2 < homo | p_HT < hetero) ~ 1,
                                     !chr %in% c("X","Y","M") & cross=="N2" & ((p_HM2 == 0 & p_HM1 < homo) |
                                                                                 (p_HM1 == 0 & p_HM2 < homo) |
                                                                                 (p_HT < hetero) |
@@ -88,8 +86,8 @@ mark_prop <- function(tab,cross,homo=NA,hetero=NA,pval=NA,homo1X=NULL,homo2X=NUL
         mutate(exclude_prop=case_when(chr == "X" & p_HM1 >= p_HM2 & !between(p_HM1,homo1X[1],homo1X[2]) ~ 1,
                                       chr == "X" & p_HM2 > p_HM1 & !between(p_HM2,homo1X[1],homo1X[2]) ~ 1,
                                       T ~ exclude_prop
-                                      )
-               )
+        )
+        )
     }
 
     if(is.null(homo2X)==FALSE){
@@ -97,16 +95,16 @@ mark_prop <- function(tab,cross,homo=NA,hetero=NA,pval=NA,homo1X=NULL,homo2X=NUL
         mutate(exclude_prop=case_when(chr == "X" & p_HM1 >= p_HM2 & !between(p_HM2,homo2X[1],homo2X[2]) ~ 1,
                                       chr == "X" & p_HM2 > p_HM1 & !between(p_HM1,homo2X[1],homo2X[2]) ~ 1,
                                       T ~ exclude_prop
-                                      )
-              )
+        )
+        )
     }
 
     if(is.null(heteroX)==FALSE){
       tab <- tab %>%
         mutate(exclude_prop=case_when(chr == "X" & p_HM1 >= p_HM2 & !between(p_HT,heteroX[1],heteroX[2]) ~ 1,
                                       T ~ exclude_prop
-                                      )
-              )
+        )
+        )
     }
 
     #exclude with pval chisq.test
diff --git a/stuart_1.0.5.tar.gz b/stuart_1.0.5.tar.gz
index ffe005a89d01aa88b963831fc718ece038c1e233..c74c1bff8ed4a413106168806a91ca21aae2f4be 100644
GIT binary patch