Seurat Metadata to Dataframe Manipulation
1
0
Entering edit mode
21 months ago

This is perhaps a question that is too simple, but I have been stuck on this for the past two hours.

I currently have a Seurat object and converted this into a data frame for further processing with another file. I need a certain pattern removed from the row names such that I am only left with the Cell IDs. Right now I have:

flox_1_TCAGAT-1
ko_1_TAGCAA-1

flox_2_TCAGAT-1
ko_2_TAGCAA-1

flox_3_TCAGAT-1
ko_3_TAGCAA-1

flox_4_TCAGAT-1
ko_4_TAGCAA-1

My approach has been:

rownames(df)<- sub("flox_1", " ", as.character(rownames(df)))

However when I reapply this again for flox_2, ko_1, ko_2, ko_3, etc. I receive the error: Error in .rowNamesDF<-(x, value = value) : duplicate 'row.names' are not allowed

Any other suggestions on how to mitigate this issue?

rstudio seurat scrna-seq • 1.4k views
ADD COMMENT
0
Entering edit mode
21 months ago
tomas4482 ▴ 430

rownames must be "unique". Your barcodes are duplicated between different samples. There is no way to replace your rownames with these barcodes because of this issue.

ADD COMMENT
0
Entering edit mode

I may have oversimplified it too much. The row names are cell ids for one sample, CKO_AO2_TTTCCTCTCCTTGACC-1

CKO_AO2_ACACCCTAGCAAATCA-1

FLOX_AO1_CCTCTGAGTACTCAAC-1

I need to intersect these cell ids with another sample. The pattern for the reference dataset is: TTTCCTCTCCTTGACC-1

ACACCCTAGCAAATCA-1

CCTCTGAGTACTCAAC-1

ADD REPLY
0
Entering edit mode

I don't get your point.

What do you really want to do and what data do you have right now?

ADD REPLY

Login before adding your answer.

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