kkdey / CountClust

A R package for Grade of Membership model and Visualization of counts data:
31 stars 11 forks source link

StructureGGplot #35

Closed eleozzr closed 6 years ago

eleozzr commented 6 years ago

Hi Kushai When I test the "StructureGGplot" function, I find there is something wrong in the 194th line in your StructureGGplot.R.

# find the dominant cluster across samples
sample_order <- as.numeric(attr(table(each_sample_order), "name")[1])

I know your propose is to find the dominant cluster across samples, but the code you write above that does work, for example, if the variable _each_sampleorder is sampled from poisson distribution,

set.seed(100)
each_sample_order=rpois(200,lambda=2)
table(each_sample_order)
each_sample_order
#0  1  2  3  4  5  6 
#26 53 56 37 15 10  3 

the dominant cluster should be 2, but in your code it will return the first name 0? So, I am wondering is there something wrong in your code or maybe I couldn't fully understand your purpose.

kkdey commented 6 years ago

Hi, thanks for the comments. I added an option called sample_order_opts in StructureGGplot () function, can you please check if it matches your expectations?

eleozzr commented 6 years ago

Yeah.