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

problem in df2genind when alleles encoding contain a . #132

Closed
jgx65 opened this issue Mar 1, 2016 · 8 comments
Closed

problem in df2genind when alleles encoding contain a . #132

jgx65 opened this issue Mar 1, 2016 · 8 comments

Comments

@jgx65
Copy link
Collaborator

jgx65 commented Mar 1, 2016

I stumbled on a little bug in df2genind when some alleles encoding contain a dot:

dat<-data.frame(pop=c(1,1,2,2),loc1=c("1/1","1/2","1.1/2","2/2"),loc2=c("1/1","1/2","1/2","2/2"))
(datgi<-df2genind(dat[,-1],sep="/",pop=dat[,1]))

If the dot is replaced by e.g. a dash, no problems:

dat<-data.frame(pop=c(1,1,2,2),loc1=c("1/1","1/2","1_1/2","2/2"),loc2=c("1/1","1/2","1/2","2/2"))
(datgi<-df2genind(dat[,-1],sep="/",pop=dat[,1]))

Any chance to either fix it or warn that dots should not enter allele encoding?

@zkamvar
Copy link
Collaborator

zkamvar commented Mar 1, 2016

Which is the more desirable outcome?

  • throw error and let user fix it
  • throw warning and replace dot with underscore

There's currently a mechanism to do this with locus names, but not with alleles.

@EricArcher
Copy link
Collaborator

I vote for "throw warning and replace dot with underscore". This would work unless the underscore causes other issues, like it is already being used as a separator. In which case, maybe replacing with something ugly like a # would make the replacement obvious and unlikely to cause other conflicts...

@thierrygosselin
Copy link
Collaborator

I had the same issue last week and now change the dot to : to avoid potential problems with underscore.

@thibautjombart
Copy link
Owner

My vote goes to option 2: send a warning and replace with underscore

@zkamvar zkamvar closed this as completed in f33c01b Mar 1, 2016
zkamvar added a commit that referenced this issue Mar 1, 2016
@zkamvar
Copy link
Collaborator

zkamvar commented Mar 1, 2016

I've addressed this so that underscores are still allowable separators.

input fix
1/1.1 1/1_1
1_1.1 1_1p1

@thibautjombart
Copy link
Owner

Cool. Pull request? ;)

@zkamvar
Copy link
Collaborator

zkamvar commented Mar 2, 2016

Whoops. Already on master.

Sent from my iPhone

On Mar 2, 2016, at 06:07, Thibaut Jombart notifications@github.com wrote:

Cool. Pull request? ;)


Reply to this email directly or view it on GitHub.

@thibautjombart
Copy link
Owner

Perfect!

Dr Thibaut Jombart
Lecturer, Department of Infectious Disease Epidemiology
Imperial College London
https://sites.google.com/site/thibautjombart/
https://github.com/thibautjombart
Twitter: @TeebzR https://twitter.com/TeebzR

On 2 March 2016 at 15:39, Zhian N. Kamvar notifications@github.com wrote:

Whoops. Already on master.

Sent from my iPhone

On Mar 2, 2016, at 06:07, Thibaut Jombart notifications@github.com
wrote:

Cool. Pull request? ;)


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub
#132 (comment)
.

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

5 participants