mennodejong1986 / SambaR

SambaR: Snp datA Management and Basic Analyses in R
MIT License
24 stars 6 forks source link

Error in findstructure() #18

Closed kcairns closed 2 years ago

kcairns commented 2 years ago

Hello, I've been getting this error after installing the new version of SambaR and unsure how to fix it. I've been running the previous version (1.05) and haven't had this error before with the same dataset. Is there a way to get the DAPC figures with the group ellipses?

Running DAPC analyses for various number of expected clusters (K). Observe the screeplot in the 'dapc.summarystatistics'-plot to find the optimal K value (lowest point or flattening of decline). K = 2 Number of retained PC's is below 4. Skipping dapc plot's for K=4 and higher. Number of retained PC's is below 4. Skipping dapc plot's for K=4 and higher. K = 3 Number of retained PC's is below 4. Skipping dapc plot's for K=4 and higher. Number of retained PC's is below 4. Skipping dapc plot's for K=4 and higher. K = 4 Number of retained PC's is below 4. Skipping dapc plot's for K=4 and higher. Number of retained PC's is below 4. Skipping dapc plot's for K=4 and higher. K = 5 Number of retained PC's is below 4. Skipping dapc plot's for K=4 and higher. Number of retained PC's is below 4. Skipping dapc plot's for K=4 and higher. K = 6 Number of retained PC's is below 4. Skipping dapc plot's for K=4 and higher. Number of retained PC's is below 4. Skipping dapc plot's for K=4 and higher. Not plotting correspondence between expected and inferred clusters because the flag 'plotheatmap' is set to FALSE. Calculating overlap between inferred and expected clusters... Error in dimnames(x) <- dn : length of 'dimnames' [1] not equal to array extent In addition: Warning messages: 1: In [<-.factor(*tmp*, inds$pop == my_pop, value = 1L) : invalid factor level, NA generated 2: In [<-.factor(*tmp*, inds$pop == my_pop, value = 2L) : invalid factor level, NA generated 3: In [<-.factor(*tmp*, inds$pop == my_pop, value = 3L) : invalid factor level, NA generated 4: In [<-.factor(*tmp*, inds$pop == my_pop, value = 4L) : invalid factor level, NA generated 5: In [<-.factor(*tmp*, inds$pop == my_pop, value = 5L) : invalid factor level, NA generated

mennodejong1986 commented 2 years ago

Hi, I will try to find time tomorrow or later this week to fix the issue (and investigate how to add group ellipses identical to original DAPC plots). In the meantime, you could run the findstructure function without dapc (i.e.: findstructure(do_dapc=FALSE) ) in case you would be helped with the output of other structure analyses (such as LEA admixture plots).

mennodejong1986 commented 2 years ago

I just uploaded a new SambaR source script. The findstructure function now contains the option 'dapc_ellipse'. If set to TRUE, ellipses will be added to the DAPC plots. Not exactly the same as the original DAPC plots, but this is as close as I can do for now. The size of the ellipse can be controlled with the 'dapc_ellipse_level' flag (default is 0.5).

I did not manage to reproduce your error, but I hope that by setting the flag 'dapc_heatmap' to FALSE, you can still run DAPC analyses without encountering the error.

Another change I made is that from now onwards by default the findstructure function will run a limited number of key analyses only. To run all analyses, including DAPC, set the flag 'quickrun' to FALSE.

kcairns commented 2 years ago

Thank you – I will try it out over the next few weeks and see if I can get it working!

Kylie

Dr Kylie M Cairns

Research Fellow Centre for Ecosystem Science School of Biological, Earth and Environmental Sciences UNSW Australia Sydney NSW 2052 M: 0414601553 E: @.**@.> E: @.**@.> Twitter: @dr_cairns Facebook: @dingogenetics @.*** www.ecosystem.unsw.edu.auhttp://www.ecosystem.unsw.edu.au/

*Co-chair – Dingo Working Group, IUCN Canid Specialist Group (www.canids.orghttp://www.canids.org)

*You can support Dr Cairns’ research into dingo genetics and ancestry via the UNSW giving portal https://alumni.unsw.edu.au/giving/SCI/DingoGenetics

From: mennodejong1986 @.> Date: Sunday, 19 December 2021 at 5:47 am To: mennodejong1986/SambaR @.> Cc: Kylie Cairns @.>, Author @.> Subject: Re: [mennodejong1986/SambaR] Error in findstructure() (Issue #18)

I just uploaded a new SambaR source script. The findstructure function now contains the option 'dapc_ellipse'. If set to TRUE, ellipses will be added to the DAPC plots. Not exactly the same as the original DAPC plots, but this is as close as I can do for now. The size of the ellipse can be controlled with the 'dapc_ellipse_level' flag (default is 0.5).

I did not manage to reproduce your error, but I hope that by setting the flag 'dapc_heatmap' to FALSE, you can still run DAPC analyses without encountering the error.

Another change I made is that from now onwards by default the findstructure function will run a limited number of key analyses only. To run all analyses, including DAPC, set the flag 'quickrun' to FALSE.

— Reply to this email directly, view it on GitHubhttps://github.com/mennodejong1986/SambaR/issues/18#issuecomment-997267675, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AMW3FJ3WN63ZEE3MJBY2VRTURTJJ3ANCNFSM5JSBR3QQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you authored the thread.Message ID: @.***>