dyerlab / gstudio

An R package for the spatial analysis of population genetic data.
19 stars 6 forks source link

Issue with popgraph #17

Closed tanyasarkjain closed 3 years ago

tanyasarkjain commented 3 years ago

SAGraphMsat2 <- popgraph(x = SADataMsat2.mv, groups = pops2) Error in h(simpleError(msg, call)) : error in evaluating the argument 'x' in selecting a method for function 'diag': supply both 'x' and 'y' or a matrix-like 'x' In addition: Warning messages: In addition: Warning messages: 1: In popgraph(x = SADataMsat2.mv, groups = pops2) : You have strata ( Pop-11, Pop-12, Pop-13, Pop-5 ) that have fewer than 4 individuals. This analysis needs to have a good estimate of within stratum variance. 2: In popgraph(x = SADataMsat2.mv, groups = pops2) : 1 variables are collinear and being dropped from the discriminant rotation.

I understand the warning message, however I am confused as to why I am getting the error I am inputting a matrix. I do not get that error message when I use a different set of populations (instead of pops2) that correspond to a different division of the data than what was specified in the .gen file for this analysis.

dyerlab commented 3 years ago

Drop the sites with N<4 and try again.

Rodney J. Dyer, PhD Director, Center for Environmental Studies https://ces.vcu.edu/ Virginia Commonwealth University http://dyerlab.com

On Mon, Jun 28, 2021 at 3:08 AM tanyasarkinjain @.***> wrote:

SAGraphMsat2 <- popgraph(x = SADataMsat2.mv, groups = pops2) Error in h(simpleError(msg, call)) : error in evaluating the argument 'x' in selecting a method for function 'diag': supply both 'x' and 'y' or a matrix-like 'x' In addition: Warning messages: In addition: Warning messages: 1: In popgraph(x = SADataMsat2.mv, groups = pops2) : You have strata ( Pop-11, Pop-12, Pop-13, Pop-5 ) that have fewer than 4 individuals. This anlaysis needs to have a good estimate of within stratum variance. 2: In popgraph(x = SADataMsat2.mv, groups = pops2) : 1 variables are collinear and being dropped from the discriminant rotation.

I understand the warning message, however I am confused as to why I am getting the error I am inputting a matrix

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/dyerlab/gstudio/issues/17, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA5B3TXCHTG5P7WUFDMSGRLTVANVFANCNFSM47NLAMBQ .

tanyasarkjain commented 3 years ago

Thank you! That worked.

dyerlab commented 3 years ago

Yes, the issue is that the estimation of a pop graph requires that you have a good idea of the within site genetic variance. I put an artificial limit of 4 individuals to make a site as a lower boundary to ensure that we are not going to be dividing by zero at some point…

Rodney Dyer, PhD Professor, Director Center for Environmental Studies https://ces.vcu.edu/ Virginia Commonwealth University https://vcu.edu/ @. @.> dyerlab.org https://dyerlab.org/

On Jun 28, 2021, at 12:21 PM, tanyasarkinjain @.***> wrote:

Thank you! That worked.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/dyerlab/gstudio/issues/17#issuecomment-869823693, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA5B3TVJVVGBKPVX2IN3KILTVCOQRANCNFSM47NLAMBQ.