Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NA.char other than "-9" lead to potential problems with Microsat data #348

Open
grolshausen opened this issue Mar 22, 2023 · 0 comments
Open

Comments

@grolshausen
Copy link

Hello,

Quick question concerning the "read.structure" function:

I just found out that running the parameter NA.char=0 (or "0") will remove/ignore any sample with alleles that have a "0" anywhere (!)... meaning that e.g. alleles such as "120" or "90" (e.g. for Microsat data) will lead to complete exclusion of that sample, thus miscalculating allele-freqs etc.

Example data:

loc1a loc1b
ind1 1 126 132
ind2 1 118 120
ind3 1 126 128
ind4 1 0 0

genind.obj@loc.n.all (read in with NA.char="0") gives:
L1.126 L1.132 L1.128
ind1 1 1 0
ind3 1 0 1

(correctly excluding ind4, but incorrectly excluding ind2 !)

genind.obj@loc.n.all (read in with NA.char="-9") gives:

genind.obj@tab
L1.126 L1.132 L1.118 L1.120 L1.128 L1.0
ind1 1 1 0 0 0 0
ind2 0 0 1 1 0 0
ind3 1 0 0 0 1 0
ind4 0 0 0 0 0 2

(now of course listing "0" as an allele, but correctly not ignoring the "120" allele of ind2)

Could this be a bug? I know that the help file gives the note that "... in any case, series of zero (like "000") are interpreted as NA too". But that does not really cover those cases where alleles themselves are coded with 0s as part of their length, as in Microsats with length 120.

I guess the best workaround is to always use "-9" as NA-character in input files.
Any thoughts/comments ?

I also want to say Thanks for the great work on this package! It's really awesome what has been put together here by Thibaut.

Best,
gregor rolshausen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant