welch-lab / liger

R package for integrating and analyzing multiple single-cell datasets
GNU General Public License v3.0
380 stars 78 forks source link

no slot name "defaultCluster" for this object of class "liger" #310

Open Obtusah opened 4 months ago

Obtusah commented 4 months ago

Hi, while running a code using liger package, The error seems to be caused of liger object. My

object@uns

doesn't have attribute 'defaultCluster'. I printed out the 'object@uns'. The contents were lines below "+++...++" in the image. only attributes named factorization and factorization$k were present.

I searched liger code and am guessing 'defaultCluster' is some kind of getter.

image

mvfki commented 4 months ago

Hi @Obtusah ,

defaultCluster is technically not a "slot" of a <liger> class object in R terms. You'll be able to access it with getter function defaultCluster(sr_liger) once you have it set. From the screenshot, it doesn't seem that you have any clustering result present at this moment, so you should get NULL when you call that getter. It'll be automatically set when you have your first clustering run. If you need to tweak parameters and save an alternative result with a different variable name, you might need to reset with defaultCluster(sr_liger) <- <newVariable>. If you really need to use symbol access like @, it is accessible at sr_liger@uns$defaultCluster. Note that defaultDimRed is accessed in a similar way.

Best, Yichen