immunomind / immunarch

🧬 Immunarch: an R Package for Fast and Painless Exploration of Single-cell and Bulk T-cell/Antibody Immune Repertoires
https://immunarch.com
Apache License 2.0
311 stars 66 forks source link

Error when generating plot for "Gini coefficient" #389

Open KashingTang opened 1 year ago

KashingTang commented 1 year ago

🐛 Bug

I am using immunarch verison 0.9.0, R version 4.3.2 (2023-10-31 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 11 x64 (build 22621)

Using the command " repDiversity" and "vis ", I can generate plots using methods like chao1, hill, div, inv.simp, d50. But when I try to use the 'gini' method, I get an error.

Here is my code:

div_gini <- repDiversity(immdata$data, "gini") vis(div_gini)

And I get the following error:

Error in UseMethod("vis") : no applicable method for 'vis' applied to an object of class "c('immunr_gini', 'matrix', 'array')"

vadimnazarov commented 10 months ago

Hi KashinTang,

Thank you, we are missing a plot for gini coefficient data. We will implement a plot in the next major version, which we are working on at the moment. For now, please consider using ggplot2 for this. E.g.,

ginic = repDiversity(immdata$data, "gini")
ginic = data.frame(Gini = ginic[,1], Sample = row.names(ginic))
qplot(x=Sample, y=Gini, data=ginic)