Search code examples
rbioinformaticsbioconductor

Sleuth R Error: System is computationally singular


I am working with Kallisto and Sleuth to analyze some RNA seq data. I have a control set of macula data and a set of macula data with AMD. I am trying to analyze differential gene expression between the two sets.

 Design table:
 sample Tissue  Condition
 AMD_macula.11  Macula  AMD
 AMD_macula.12  Macula  AMD
 AMD_macula.14  Macula  AMD
 AMD_macula.17  Macula  AMD
 AMD_macula.18  Macula  AMD
 AMD_macula.19  Macula  AMD
 ctrl_macula.10 Macula  nodisease
 ctrl_macula.13 Macula  nodisease
 ctrl_macula.15 Macula  nodisease
 ctrl_macula.16 Macula  nodisease
 ctrl_macula.4  Macula  nodisease
 ctrl_macula.6  Macula  nodisease

I have created my sleuth object and now I am trying to fit the models so I can run linear regression and wald tests.

 so <- sleuth_fit(so, ~sample + Condition,'full')
 so <- sleuth_fit(so, ~Tissue, 'Tissue')
 models(so)

When running these, I cannot get past creating the first model because I am getting this error that is saying that the system is computationally singular.

 > so <- sleuth_fit(so, ~sample + Condition,'full')
 Error in solve.default(t(X) %*% X) : 
 system is computationally singular: reciprocal condition number = 3.82836e-18

Does anyone know how to solve this? I believe something is wrong with my design table, but I cannot think of how to fix it.

Thanks!


Solution

  • This is an instance of dreaded linear combination problem. In your case Condition is a linear combination of sample. The solution is to remove sample from the design since you don't have any replicates of this factor and probably aren't very interested in it anyway. Tissue only has one level, so it's pointless to include it as well. What you want is:

    so <- sleuth_fit(so, ~ Condition, 'full')
    so <- sleuth_fit(so, ~1, 'reduced')
    

    See here for an example of analysing a dataset with the same design.