Error: In seq_len(ncol(assay)) : first element used of 'length.out' argument
2
0
Entering edit mode
@marina-vv-14943
Last seen 6.0 years ago
Spain

Hi, I am trying to make a SingleCellExperiment object to store my single-cell data and make some filtering of cells with library sizes and number of expressed genes before doing analysis. But when I try to do:

sce <- SingleCellExperiment(list(counts=ExprFinal)) #My dataframe is called ExprFinal and it has only counts (endogenous, mit and ERCCs) and colnames (cells) and rownames (genes).

I obtain this message:

Error in seq_len(ncol(assay)) : 
  argument must be coercible to non-negative integer
In addition: Warning message:
In seq_len(ncol(assay)) : first element used of 'length.out' argument

I do not know what it means. I have tried several things: to remove colnames and rownames from my dataframe, to convert my data to data.matrix... but it still does not work. Any help please? I think it has to be something related to the format of my data.

singlecellexperiment • 9.1k views
ADD COMMENT
2
Entering edit mode
davide risso ▴ 950
@davide-risso-5075
Last seen 6 weeks ago
University of Padova

Hi,

if I understand correctly your issue, you need to transform your data.frame into a matrix.

sce <- SingleCellExperiment(list(counts=as.matrix(ExprFinal)))

should work. If it doesn't, please paste here the results of

head(ExprFinal)

and we'll try to figure it out.

Note that this has nothing to do with colnames or rownames.

ADD COMMENT
0
Entering edit mode
@marina-vv-14943
Last seen 6.0 years ago
Spain

It finally work!! Thanks so much! I do not know that the data needs to be a matrix.

Now I have this warning when I write dim(sce):

dim(sce)
[1] 24487  9568
Warning messages:
1: In class(object) <- "environment" :
  Setting class(x) to "environment" sets attribute to NULL; result will no longer be an S4 object
2: In class(object) <- "environment" :
  Setting class(x) to "environment" sets attribute to NULL; result will no longer be an S4 object

Maybe I need to enter any other arguments in the function or it will not further work.

Thanks again for your rapid answer:)

ADD COMMENT

Login before adding your answer.

Traffic: 681 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