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

alignK not working across values of K #87

Open
weeds23 opened this issue Feb 4, 2022 · 4 comments
Open

alignK not working across values of K #87

weeds23 opened this issue Feb 4, 2022 · 4 comments

Comments

@weeds23
Copy link

weeds23 commented Feb 4, 2022

Hi,
I have created averaged barplots for each K using mergeQ, and would now like to plot them stacked together with each population cluster having the same colour across each plot. I had hoped to do this by first using alignK to align clusters across K as per the vignette (although in the vignette these were not averaged runs so I am not sure if this works) and then use plotQ. It plots the barplots for each K but the colours are not consistent across populations. AlignK seems to be aligning cluster assignments within each K, but not across all K. I have tried to do this both before and after averaging each K (see below) and neither works. I have confirmed that the object I'm using for alignK is in fact a qlist using is.qlist so I'm not sure why its not working.
Is there a way to achieve this for averaged plots? Sorry if this is simple, but I didn't see this specified in the vignette.
Here is example code, image attached of the plot I have so far:
#For K3. Repeated for each K
slist <- readQ(files=choose.files(multi=TRUE))
slist1 <- alignK(slist[c(1:10)]) #here alignK works
meanK3 <- mergeQ(slist1)

meanKs <- alignK(c(meanK3, meanK4, meanK5, meanK6, meanK7, meanK8)) #here it doesn't
is.qlist(meanKs)
poplabs <- read.table("Allpops_poplabels.txt", header=T)
plotQ(meanKs, imgoutput="join",
sortind=NA, grplab = poplabs, clustercol = clist$shiny,
returnplot=T, exportplot=F, basesize=11)

#I also tried aligning all runs of K before merging, but got the same end result:
slist3 <- readQ(files=choose.files(multi=TRUE))
slist4 <- readQ(files=choose.files(multi=TRUE))
slist5 <- readQ(files=choose.files(multi=TRUE))
slist6 <- readQ(files=choose.files(multi=TRUE))
slist7 <- readQ(files=choose.files(multi=TRUE))
slist8 <- readQ(files=choose.files(multi=TRUE))

Aligned <- alignK(c(slist3[c(1:10)], slist4[c(1:8)], slist5[c(1:10)], slist6[c(1:10)],
slist7[c(1:9)], slist8[c(1:9)])) #doesn't work
meanK3a <-mergeQ(Aligned[c(1:10)])
meanK4a <-mergeQ(Aligned[c(11:18)])
meanK5a <-mergeQ(Aligned[c(19:28)])
meanK6a <-mergeQ(Aligned[c(29:38)])
meanK7a <-mergeQ(Aligned[c(39:47)])
meanK8a <-mergeQ(Aligned[c(48:56)])
meanKs <- c(meanK3a, meanK4a, meanK5a, meanK6a, meanK7a, meanK8a)
p1 <- plotQ(meanKs,
sortind=NA, grplab = poplabs, clustercol = clist$shiny,
imgoutput="join",returnplot=T,exportplot=F,basesize=11)
grid.arrange(p1$plot[[1]]) #for some reason plotQ didn't work without using grid.arrange this time.

mean barplots_K3-8

I have also tried importing all runs of all K together at the same time as one qlist, but this didn't make a difference.

Other issues: I am also having additional issues that may or may not be related. I thought the above problem could be because it was not recognising my tess2 files properly, so I re-imported them specifying the filetype within readQ and then received this error "Error in append(dlist, dfr) : object 'dfr' not found". So I then tried importing them with readQTess instead, and didn't get the error and they apparently imported OK. I am also not getting the grplabels appearing on the plot, but I didn't get an error about this.

@weeds23 weeds23 changed the title Question: how to make cluster colours consistent across averaged barplots? alignK not working across values of K Feb 14, 2022
@Nico-laF
Copy link

Hello!! :) Has this issue been sorted for you @weeds23 or did you find a workaround?
I am currently dealing with the same issues :/

@weeds23
Copy link
Author

weeds23 commented Apr 27, 2022

Hello!! :) Has this issue been sorted for you @weeds23 or did you find a workaround? I am currently dealing with the same issues :/

Hi @Nico-laF! No, unfortunately I didn't get any response and I couldn't get it to work after much trying of various different things, so I ended up using the CLUMPAK server (http://clumpak.tau.ac.il/) directly to align K and produce the figures instead and it worked! If you need any further help LMK.

@k0k0kk0
Copy link

k0k0kk0 commented Sep 20, 2023

CLUMPAK http://clumpak.tau.ac.il/ is notfound!help! help! help!

@k0k0kk0
Copy link

k0k0kk0 commented Sep 20, 2023

Hello!! :) Has this issue been sorted for you @weeds23 or did you find a workaround? I am currently dealing with the same issues :/

Hi @Nico-laF! No, unfortunately I didn't get any response and I couldn't get it to work after much trying of various different things, so I ended up using the CLUMPAK server (http://clumpak.tau.ac.il/) directly to align K and produce the figures instead and it worked! If you need any further help LMK.

CLUMPAK http://clumpak.tau.ac.il/ is notfound!help! help! help!

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

3 participants