How to convert large gene counts data into matrix?
0
0
Entering edit mode
@sambunga094-21466
Last seen 5.3 years ago

Hi, I have a gene counts table which something looks like this:

enter image description here

When i'm trying to convert this into a matrix im getting this following error:

Error in asMethod(object) : 
  Cholmod error 'problem too large' at file ../Core/cholmod_dense.c, line 105`

This is the code that i'm using which i borrowed from a tutorial online:

library(Matrix)
library(data.table)
f<-as.data.frame(fread(file="Z:/sc_wizard/data.counts",h=T,sep='\t'))
sm = sparseMatrix(as.numeric(factor(f$gene)), as.numeric(factor(f$cell)), x=f$count)
rownames(sm)<-levels(factor(f$gene))
colnames(sm)<-levels(factor(f$cell))
write.table(as.matrix(sm),file = "out.tsv",sep='\t',col.names=T,row.names=T,quote=F)`

Help is really appreciated. Thank you!!

R Bioconductor singlecell bioinformatics seurat • 4.1k views
ADD COMMENT

Login before adding your answer.

Traffic: 562 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6