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

Issue sorting AND reordering groups #74

Open
emilya21 opened this issue Jan 28, 2021 · 2 comments
Open

Issue sorting AND reordering groups #74

emilya21 opened this issue Jan 28, 2021 · 2 comments
Labels
bug Incorrect results

Comments

@emilya21
Copy link

Hi, I am having an issue trying to both re-order and sort my groups. It seems that I can only do one or the other - and not both. My group labels are non-contiguous and I am using the most up-to-date version of pophelper.

This is what I am using to plot:

p3 <- plotQ(alignK(qlist[c(1:9)]),imgoutput="join",returnplot=T,exportplot=F,basesize=11,
grplab=inds,grplabsize=3.5,linesize=0.8,pointsize=3,showindlab=F,sharedindlab=F,sortind="all",
ordergrp=T,subset=c("AB", "SK", "ID", "CO", "CN", "CV", "CE", "AZ", "TX"),splab=spnames[1:9],
splabsize = 20)

This plot is sorted, but the groups are not re-ordered. The only way that I can get the groups re-ordered to what I have specified in "subset" is to remove sortind="all" from the above code.

I have noticed that there is not an example of both re-ordering AND sorting in the vignette, so I am wondering if it is possible to do both of these at the same time. Visually, it is important for me to group my locations based on how close they are to each other, but without the sorted data, the plot is pretty useless.

Thank you!

@royfrancis
Copy link
Owner

I have tried out similar to what you have described and it seems like sortind, ordergrp and subset together doesn't seem to work.

library(pophelper)
sfiles <- list.files(path=system.file("files/structure",package="pophelper"), full.names=T)
slist <- readQ(files=sfiles[1],indlabfromfile=T)

threelabset <- read.delim(system.file("files/metadata.txt", package="pophelper"), header=T,stringsAsFactors=F)
onelabset <- threelabset[,3,drop=F]

plot(plotQ(slist,returnplot=T,exportplot=F,basesize=11,showindlab=T,grplab=onelabset)$plot[[1]])

a

Plot with one label set which is by default not ordered.

plot(plotQ(slist,returnplot=T,exportplot=F,basesize=11,showindlab=T,sortind="all",grplab=onelabset)$plot[[1]])

b

Adding sortind="all" sorts the individuals within group. The groups itself are still not ordered.

plot(plotQ(slist,returnplot=T,exportplot=F,basesize=11,showindlab=T,sortind="all",grplab=onelabset,order=T)$plot[[1]])

c

Adding order=T orders labels alphabetically. And individuals are sorted within the new ordered groups.

Now, to rearrange the groups manually, we use subset.

plot(plotQ(slist,returnplot=T,exportplot=F,basesize=11,showindlab=T,sortind="all",grplab=onelabset,order=T,subset=c("Greece","Panama","Brazil"))$plot[[1]])

d

The result is the same as the previous step. It doesn't work as intended.

@royfrancis royfrancis added the bug Incorrect results label Mar 1, 2021
@vinod1981
Copy link

Dear Roy,
Is this bug corrected or still it is not possible to use both sortind and subsetgrp together? I just tried it and it is not working.
Thanks,

Vinod,

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

No branches or pull requests

3 participants