Question: Error: In seq_len(ncol(assay)) : first element used of 'length.out' argument
0
gravatar for Marina V.V.
22 months ago by
Spain
Marina V.V.0 wrote:

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 • 3.5k views
ADD COMMENTlink modified 22 months ago • written 22 months ago by Marina V.V.0
Answer: Error: In seq_len(ncol(assay)) : first element used of 'length.out' argument
2
gravatar for davide risso
22 months ago by
davide risso830
University of Padova
davide risso830 wrote:

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 COMMENTlink written 22 months ago by davide risso830
Answer: Error: In seq_len(ncol(assay)) : first element used of 'length.out' argument
0
gravatar for Marina V.V.
22 months ago by
Spain
Marina V.V.0 wrote:

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 COMMENTlink written 22 months ago by Marina V.V.0
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 159 users visited in the last hour