Skip to content

atac_dim_reduction() may throw a BLAS error: Fix by removing NAs #3

@hypercompetent

Description

@hypercompetent

Hi Andrew and Darren,

I was testing the atac_dim_reduction() function today on a subset of my data, and got a mysterious BLAS error at the SVDtsne = irlba(tf_idf_counts, 50, 50, maxit=1000) step:

Error in irlba(tf_idf_counts, 50, 50, maxit = 1000) : 
  BLAS/LAPACK routine 'DLASCL' gave error code -4

After a little troubleshooting, I found that I had some NA values in my tf_idf_counts matrix. I added this line, and it runs well:

tf_idf_counts = nfreqs * log(1 + ncol(ncounts) / Matrix::rowSums(ncounts))

tf_idf_counts@x[is.na(tf_idf_counts@x)] <- 0 ## New line to remove NAs

## Do SVD
set.seed(0)
SVDtsne = irlba(tf_idf_counts, 50, 50, maxit=1000)

I'm not sure if this will come up for every dataset - a larger set of cells it didn't seem to throw this error - but I thought I'd post here in case anybody else hits the same issue.

Thanks for sharing these functions!
-Lucas

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions