satijalab / seurat

R toolkit for single cell genomics
http://www.satijalab.org/seurat
Other
2.25k stars 904 forks source link

define new ident #895

Closed kunUCSD closed 5 years ago

kunUCSD commented 5 years ago

Hey, I want to use seurat to generate the DEG list between WT and KO samples, and I tried to set the genotype as the @ident, but got the below error. Here is my code and relevant info. Any help will be appreciated! Best, Kun

> head(mOSN@meta.data)
                             nGene nUMI orig.ident percent.mito genotype  day res.2 ident1023
oe2_wt_day0_GACGCGTCATGCATGT  1782 3583        oe2   0.08042446       wt day0  <NA>    mOSN-7
oe3_ko_day0_AACGTTGAGACGCAAC  1875 3813        oe3   0.08761805       ko day0  <NA>    mOSN-7
oe3_ko_day0_AGCTTGATCCACGAAT  1798 3378        oe3   0.10420367       ko day0  <NA>    mOSN-7
oe3_ko_day0_AACCATGTCAGGCGAA  1447 2799        oe3   0.08503037       ko day0  <NA>    mOSN-7
oe3_ko_day0_TACCTTAGTTAAGACA  1820 4060        oe3   0.08869180       ko day0  <NA>    mOSN-7
ko3_GCTCCTATCGATCCCT          1942 4160       oe18   0.08894231       ko day0    18    mOSN-7
> meta<-mOSN@meta.data[names(mOSN@ident),]
> mOSN@ident<-meta$genotype
Error in (function (cl, name, valueClass)  : 
  assignment of an object of class “character” is not valid for @‘ident’ in an object of class “seurat”; is(value, "factor") is not TRUE
satijalab commented 5 years ago

Hi Kun! Good to hear from you-

I think you want our SetAllIdent function, i.e.

mOSN = SetAllIdent(mOSN, "genotype")

Let us know if that works for you-

best, Rahul

kunUCSD commented 5 years ago

Hi Rahul,

it works, much easier! Thanks,

Best, Kun

Email : kutan@ucsd.edu


From: satijalab [notifications@github.com] Sent: Thursday, October 25, 2018 12:12 PM To: satijalab/seurat Cc: Tan, Kun; Author Subject: Re: [satijalab/seurat] define new ident (#895)

Hi Kun! Good to hear from you-

I think you want our SetAllIdent function, i.e.

mOSN = SetAllIdent(mOSN, "genotype")

Let us know if that works for you-

best, Rahul

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/satijalab/seurat/issues/895#issuecomment-433171341, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AgAWC5ceqmF2ZPr9xLrmSEs_dRHdUNYHks5uog0QgaJpZM4X61-l.

satijalab commented 5 years ago

Glad to hear it - apologies (I had confused you with Kun Zhang :)