Biostar Beta. Not for public use.
Adding data to R S4 object
Entering edit mode
2.4 years ago
Za • 120


in this tutorial in spite of most of tutorials like making object in scater there is no something to help me how I adapt my own expression data in sc object


# Loading E16.5 data

# expression matrix

# cell information

# gene information

# The analysis starts with running the construct function to create an R S4 object,
# which will hold all the data and analysis results.
sc <- construct(exprmatrix=expressions,
                samplevector=paste("sample", cells$SAMPLE, sep=""))

I tried to replace my own data but returns error

> sc <- construct(exprmatrix=ipf.exprmatrix)
Error in construct(exprmatrix = ipf.exprmatrix) : 
  object 'rexpr' not found

and sc object already contains expression data and metadata

Any help please

R sc cell RNA-seq • 373 views
Entering edit mode

Hello Za/F !

It appears that your post has been cross-posted to another site:

This is typically not recommended as it runs the risk of annoying people in both communities.

Entering edit mode

in the code you've posted, you aren't replacing the values that are currently stored in sc; you are constructing a brand-new object and storing that in sc. It may be possible to hack it so that you can update the rexpr entry of the pre-existing sc using sc@rexpr <- ipf.exprmatrix. (I'd strongly urge you to construct a new object, or use whatever setter generics are provided by the author, rather than hacking the slots using @, though)

Entering edit mode

Sorry, but I am very bad in R and authors did not provide any information :(

Entering edit mode

Looking at the source code for sincera it looks like you've found a bug (see line 99 of ). Post as issue via github and make a pull request: you just need to change rexpr to rexprs. Sincera is throwing the error because it can't find rexpr, a variable that isn't defined in the construct function; it should really be looking for rexprs

Entering edit mode

Actually I can not figure out how to replace my own matrix

> sc <- construct(exprmatrix=my_matrix)
Error in construct(exprmatrix = my_matrix) : object 'rexpr' not found
> sc@rexprs=my_matrix
> sc <- construct(exprmatrix=rexprs)
Error in construct(exprmatrix = rexprs) : object 'rexprs' not found

sc@ rexprs exists but I don't know how to make Sincera object

Entering edit mode

But then, you are doing exactly the same thing you've just been doing. The error is inside the source code for the construct function. You can get around it if you pass in a samplevector in addition to your exprmatrix. Try downloading the github repo for sincera, modify the line of code i told you about, install the package from your modified source code, and then see if the problem remains.


then when that works, clone the repo, fix the code, submit a PR and the package will be fixed for whoever uses it next. If you need someone to explain how to submit pull-requests etc, I'm happy to help

Entering edit mode

Thank you

By changing rsampleinfo <- rep("sample1", dim(rexpr)[2]) to rsampleinfo <- rep("sample1", dim(rexprs)[2]) in source and running the source likely I construct my sincera object with my matrix

I am going to try the rest but I got confused about

> # gene information
> head(genes)
                          SYMBOL TF          TF_SOURCE use_as_marker_1 use_as_marker_2 use_as_marker_3 use_as_marker_5 use_as_marker_7 use_as_marker_8 use_as_marker_9
ENSMUSG00000044719 E230025N22Rik  0 genomatix_20140512               0               0               0               0               0               0               0
ENSMUSG00000044591    AC112933.1  0 genomatix_20140512               0               0               0               0               0               0               0
ENSMUSG00000044712       Slc38a6  0 genomatix_20140512               0               0               0               0               0               0               0
ENSMUSG00000044734     Serpinb1a  0 genomatix_20140512               0               0               0               0               0               0               0
ENSMUSG00000044726      BC030476  0 genomatix_20140512               0               0               0               0               0               0               0
ENSMUSG00000044724        Gpr152  0 genomatix_20140512               0               0               0               0               0               0               0

This data frame has been provided beforehand, does that mean I should have such a data frame before clustering and differential expression or this data frame would be produced after clustering and DE steps?


Login before adding your answer.

Similar Posts
Loading Similar Posts
Help About
Access RSS

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

Powered by the version 2.3.3