trouble importing genalex

419 views
Skip to first unread message

nick.a...@gmail.com

unread,
Aug 7, 2015, 1:06:17 AM8/7/15
to poppr


Hello,

I am struggling simply importing a genalex into poppr. Any help would be greatly appreciated.

portion of my data... two populations, 1 locus with two alleles



 
> x<-getfile()
> x
$files
[1] "/Users/nickwong/Library/R/3.1/library/poppr/files/test.csv"

$path
[1] "/Users/nickwong/Library/R/3.1/library/poppr/files"

> myData<-read.genalex(x$files, ploidy = 2, geo = FALSE, region = FALSE)
Error in if (any(gena.mat == "0") & ploidy < 3) { : 
  missing value where TRUE/FALSE needed
> traceback()
1: read.genalex(x$files, ploidy = 2, geo = FALSE, region = FALSE)

> sessionInfo()
R version 3.2.1 (2015-06-18)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.4 (Yosemite)

locale:
[1] en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] poppr_2.0.2    adegenet_2.0.0 ade4_1.7-2    

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.0      spdep_0.5-88     plyr_1.8.3       pegas_0.8-1     
 [5] LearnBayes_2.15  tools_3.2.1      boot_1.3-16      digest_0.6.8    
 [9] nlme_3.1-120     gtable_0.1.2     lattice_0.20-31  mgcv_1.8-6      
[13] Matrix_1.2-1     igraph_1.0.1     shiny_0.12.2     DBI_0.3.1       
[17] parallel_3.2.1   proto_0.3-10     coda_0.17-1      cluster_2.0.1   
[21] dplyr_0.4.2      stringr_1.0.0    grid_3.2.1       R6_2.1.0        
[25] phangorn_1.99.14 sp_1.1-1         ggplot2_1.0.1    reshape2_1.4.1  
[29] seqinr_3.1-3     deldir_0.1-9     magrittr_1.5     nnls_1.4        
[33] scales_0.2.5     htmltools_0.2.6  MASS_7.3-40      splines_3.2.1   
[37] assertthat_0.1   permute_0.8-4    mime_0.3         ape_3.3         
[41] colorspace_1.2-6 xtable_1.7-4     httpuv_1.3.3     quadprog_1.5-5  
[45] stringi_0.5-5    munsell_0.4.2    vegan_2.3-0   

First time posting - hope this is enough.
Thanks very much

Nick

Zhian Kamvar

unread,
Aug 7, 2015, 11:11:22 AM8/7/15
to poppr

Hi Nick,


Thank you for your email and thank you for supplying the necessary diagnostic information. I believe you've discovered an edge case. I have tried it on some random data using the same entries and have run into an error as well (although not the same error). I will investigate this when I get in next week. Since you have one locus, I would suggest removing the first two rows of your spreadsheet and collapsing the last two columns into a single column (separating the alleles with "/") and importing that using read.table and then using df2genind like so:


my_df <- read.table("myData.csv", sep = ",", header = TRUE)
my_data
<- df2genind(my_df[-c(1, 2), , drop = FALSE], ind.names = my_df$ind, pop.names = my_df$pop, ploidy = TRUE, sep = "/")


Additionally:


[1] "/Users/nickwong/Library/R/3.1/library/poppr/files/test.csv"


This is from your output. You should not be saving files in your R library. This is a space only for packages. The example using getfile was simply an example using files that I could ship with poppr. 



> myData<-read.genalex(x$files, ploidy = 2, geo = FALSE, region = FALSE)
Error in if (any(gena.mat == "0") & ploidy < 3) { :
  missing value
where TRUE/FALSE needed
> traceback()
1: read.genalex(x$files, ploidy = 2, geo = FALSE, region = FALSE)

This error is telling me that there was a missing value in your data. You might have had extra rows or columns that didn't appear to have data in them; however given the error I got, the problem might go deeper. 

Again, I will be investigating this further and will have it fixed in the next release.

Cheers,
Zhian

Zhian Kamvar

unread,
Aug 9, 2015, 5:49:30 PM8/9/15
to poppr
Hello,

The issue should be fixed. 

Cheers,
Zhian

Camillo Rodriguiez

unread,
Feb 26, 2016, 6:17:59 PM2/26/16
to poppr
Dear Zhean, 

I am struggling exactly with the same problem of Nick. I have followed all the steps to reinstall POPPR from github, but  I still can not import my GenAlex file into POPPR. 
 
>p_cubensis2012<-read.genalex("/Users/milobello29/Desktop/lina.csv")
Error in if (any(gena.mat == "0") & ploidy < 3) { : 
  missing value where TRUE/FALSE needed

> sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.4 (Yosemite)

locale:
[1] C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] phangorn_2.0.2 ape_3.4        poppr_2.1.0    adegenet_2.0.1 ade4_1.7-3    

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.3      spdep_0.5-92     git2r_0.13.1     plyr_1.8.3       pegas_0.8-2     
 [6] LearnBayes_2.15  tools_3.2.2      boot_1.3-17      digest_0.6.9     memoise_1.0.0   
[11] nlme_3.1-121     gtable_0.1.2     lattice_0.20-33  mgcv_1.8-7       Matrix_1.2-2    
[16] igraph_1.0.1     shiny_0.13.1     DBI_0.3.1        curl_0.9.6       parallel_3.2.2  
[21] coda_0.18-1      knitr_1.12.3     withr_1.0.1      httr_1.1.0       dplyr_0.4.3     
[26] stringr_1.0.0    cluster_2.0.3    devtools_1.10.0  grid_3.2.2       R6_2.1.2        
[31] sp_1.2-2         ggplot2_2.0.0    reshape2_1.4.1   seqinr_3.1-3     deldir_0.1-9    
[36] magrittr_1.5     nnls_1.4         scales_0.3.0     htmltools_0.3    MASS_7.3-43     
[41] splines_3.2.2    assertthat_0.1   mime_0.4         permute_0.9-0    colorspace_1.2-6
[46] xtable_1.8-2     httpuv_1.3.3     quadprog_1.5-5   stringi_1.0-1    munsell_0.4.3   
[51] vegan_2.3-3

portion of my data... 13 populations, 7 locus with two alleles











Any help would be greatly appreciated.

Please, help me!

Julian 


Zhian Kamvar

unread,
Feb 26, 2016, 7:28:15 PM2/26/16
to Camillo Rodriguiez, poppr
Hi Camillo,

It's difficult to tell what might be causing the problem from this image. I think it might have something to do with how missing data are handled. I've made a change to the github version. Can you try that and see if it makes a difference?

devtools::install_github("grunwaldlab/poppr@24c8838977")

Best,
Zhian

--
You received this message because you are subscribed to the Google Groups "poppr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to poppr+un...@googlegroups.com.
To post to this group, send email to po...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/poppr/d76fa309-b5bf-41a0-a98f-64f1ea6c2be5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages