From ee215b2c0bd541ede806189ae4e5da2ccec57a9e Mon Sep 17 00:00:00 2001 From: Thierry Gosselin Date: Thu, 22 Sep 2016 08:45:27 -0400 Subject: [PATCH] **v.0.3.** * `fst_WC84`: bug fix, the function was not properly configured for multi-allelic markers (e.g. microsatellite, and haplotype format from STACKS). Thanks to Craig McDougall for catching this. --- .DS_Store | Bin 0 -> 10244 bytes DESCRIPTION | 4 ++-- R/.DS_Store | Bin 0 -> 6148 bytes R/fst_WC84.R | 32 ++++++++++++++++++++++---------- README.md | 5 +++++ man/.DS_Store | Bin 0 -> 6148 bytes vignettes/.DS_Store | Bin 0 -> 6148 bytes 7 files changed, 29 insertions(+), 12 deletions(-) create mode 100644 .DS_Store create mode 100644 R/.DS_Store create mode 100644 man/.DS_Store create mode 100644 vignettes/.DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..6524d9eed78cdc1ecd0f3a1325ed22e1be1297e8 GIT binary patch literal 10244 zcmeHM&u<$=6n^6*jh&>4o1}#nK`li{t%y>mRS*$}x^7ApL7K=8X``lf*Y?I)y53#w zu9Lb^kS|Dx8@F7zwEX-B_zw_B^g=5Hs1ikjBL|L^K!k5*$M$Z1frNx2F=NfV*?I4K z^X41RtY=I_EL$s&6QzhKj?87U55+Et>v`UhVzT8lBmi-bDP0Roef zG9zUpkOB&y!RdiXD3eDF7QmrTadXIwl#M_JaAE?YrD8xa zu#*9Pc2Ce4P2ucb2%q2WQqi=F(DDWK8uF>li8XI94ZCA;bf z^yX9ki=*YEYEMm-YkrC7(YtRC3X71gyr<4t3Hf}O=D?n2T!^hgR`V_*93#uYE<6@K z`W&qQ;mO;JdURCm`)!C`fpBooVbfcv*MQW?jiO>V{~0RGO!xV;4b&d~+dMsd@*R(9 zAIm0de`guyuzN=AoxFD+W7B9=a56@9s*)KUo#12>5wNW-5lJ8H9eh^7L|yPMagJYn zqvrW8tWMIK0aGZ?pbySDc*CcT=PALbLq(wP;8}x}C+Cq{oq>n_dbuKd+0zF2{vBTV z+{>AajxhEM>`x)bW(LRkotR) zNBVE%SM0UCulY4EtGU<3lTp@-vOcHzE6w`6ZJVvSR$MUjwL)_EqHXz_Vd-uNx^&gB z%Jy2;u32SoDIfT|YLxwzLh|UGtFHn&r&;=f;Tc84H2iu3DV``KPpq$xPfna2O`V;X z+!#%*kDr@-c{DX~F1@jlwBqsSPETBzS#&nuyLbP?k3Rn7(=Wc{Oo0*k+l7XL=T`X@ zS5nR>tx7W3J54fvY?IO3cesBbd1PR4U}$Lg=&|Ip#|z1!qE@n{|A{w!8)1^&l5D*VU|wo~_?7wW4m$T3Oro?dmlH5%Q>nyS$^7 z468D7o_~{(5+fPD`jC<|5>#+hO|p4QtLjkB1#Kgl*QGK}FVd?tLko19?$Z180ewcF z)7SJZ{Y<~oQ^r_~^|Hh47<+~tXD_gmO!|*Cr{zSmn?N$$kMn7Xtf8(BCuj|?pT|KA zunn)Bc57tablu|aVY_WzC$JM;q6^puXCTM0iptUT!}yykynYg5hvx4&9lNQI(u>6U z(!D={*u^Rod*ks84`+9));_S0Rb*_V8R1M7iUGxdVn8vV7*GrxSOz+R$Wr_?ehI&` z_W1w*z{alvQw%5u{yhV%b1FZTg`eg@XuC^(*PcSYh0GJTYXnk2P>AbzNO2vHhd9*Y me1*0&>LQ_@;T6b6AW=j5&;JY%R|o3+j|&5J{-^)v`TsB0(%NwV literal 0 HcmV?d00001 diff --git a/DESCRIPTION b/DESCRIPTION index 6d12378..a55047f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: assigner Type: Package Title: Assignment Analysis with GBS/RADseq Data using R -Version: 0.3.2 -Date: 2016-07-20 +Version: 0.3.3 +Date: 2016-09-22 Encoding: UTF-8 Authors@R: c( person("Thierry", "Gosselin", email = "thierrygosselin@icloud.com", role = c("aut", "cre")), diff --git a/R/.DS_Store b/R/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..3f5aaa8b141b6c05311339fe18c8090d64393cf0 GIT binary patch literal 6148 zcmeHKK~BR!3>-s|D#4*gj{5>6eh^hH5?A;Dlp=%_S_#TMH=e}v%6M&1qLeEKG>+`a zddJyh4)HDko4>Cwff;})-4P!i#^&?xBRk5Bqt$0TVS^VuGVVs~!wIiF!#&=3J)>WL zft%}g`><-aD{}k=Kj|B~?e~np3D#)wii1qM>M<)_K?+C#DIf);fE1tt?AdP9(?CTj zAO)nrj{^RGD0Igru?wuf4hG-8`~1Ywjra8|K`c3L61zao&@4)cQEGX_uqbD~B(F*A z0;3#OSLSnaWy=$a)zz6Vl@4nH6{Ua_7%Ffa!#% filter(POP_ID %in% c("upj", "dsj")) # Markers in common between all populations ******************************** pop.number <- n_distinct(x$POP_ID) @@ -505,19 +505,31 @@ fst_WC84 <- function(data, ) data.genotyped.het <- x %>% - mutate(het = ifelse(stri_sub(GT, 1, 3) != stri_sub(GT, 4, 6), 1, 0)) - + mutate( + het = ifelse(stri_sub(GT, 1, 3) != stri_sub(GT, 4, 6), 1, 0), + AL1 = stri_sub(GT, 1, 3), + AL2 = stri_sub(GT, 4, 6) + ) %>% + select(-GT) %>% + tidyr::gather(data = ., key = ALLELES_GROUP, value = ALLELES, -c(INDIVIDUALS, MARKERS, POP_ID, het)) %>% + select(-ALLELES_GROUP) %>% + group_by(MARKERS, POP_ID, ALLELES) %>% + summarise(n = length(het[het == 1])) %>% + group_by(MARKERS, ALLELES) %>% + tidyr::spread(data = ., key = POP_ID, value = n, fill = 0) %>% + tidyr::gather(data = ., key = POP_ID, value = mho, -c(MARKERS, ALLELES)) fst.stats.prep <- suppressWarnings( data.genotyped.het %>% - group_by(MARKERS, POP_ID) %>% + # group_by(MARKERS, POP_ID) %>% # = the number of heterozygote individuals per pop and markers - summarise(mho = sum(het, na.rm = TRUE)) %>% - group_by(MARKERS) %>% - tidyr::spread(data = ., key = POP_ID, value = mho) %>% - tidyr::gather(key = POP_ID, value = mho, -MARKERS) %>% - mutate(mho = as.numeric(stri_replace_na(str = mho, replacement = 0))) %>% - full_join(freq.al.locus.pop, by = c("POP_ID", "MARKERS")) %>% + # summarise(mho = sum(het, na.rm = TRUE)) %>% + # group_by(MARKERS) %>% + # tidyr::spread(data = ., key = POP_ID, value = mho) %>% + # tidyr::gather(key = POP_ID, value = mho, -MARKERS) %>% + # mutate(mho = as.numeric(stri_replace_na(str = mho, replacement = 0))) %>% + # full_join(freq.al.locus.pop, by = c("POP_ID", "MARKERS")) %>% + full_join(freq.al.locus.pop, by = c("POP_ID", "MARKERS", "ALLELES")) %>% mutate( mhom = round(((2 * nal * P - mho)/2), 0), dum = nal * (P - 2 * P^2) + mhom diff --git a/README.md b/README.md index 4785cad..7392eb2 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,11 @@ The Amazon image can be imported into Google Cloud Compute Engine to start a new ## New features Change log, version, new features and bug history now lives in the [NEWS.md file] (https://github.com/thierrygosselin/assigner/blob/master/NEWS.md) + +**v.0.3.3** +* `fst_WC84`: bug fix, the function was not properly configured for multi-allelic markers (e.g. microsatellite, and haplotype format from STACKS). Thanks to Craig McDougall for catching this. + + **v.0.3.2** * `assignment_mixture`: added a check that throws an error when pop.levels != the pop.id in strata diff --git a/man/.DS_Store b/man/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0