Skip to content

Converting Spectre file to Seurat Object after running FlowSOM #110

Discussion options

You must be logged in to vote

@pavitraviswanath

To get you started:

library('Spectre')
library('Seurat')

Here's a quick example with the demo dataset:

Spectre::demo.clustered
as.matrix(names(Spectre::demo.clustered))

Here you pick whichever columns you want for the primary 'data' (i.e, in this case replacing counts)

use.cols <- names(Spectre::demo.clustered)[c(11:19)]
use.cols
dat <- Spectre::demo.clustered[,use.cols, with = FALSE]
dat

Here we can turn the data into a matrix, then into a sparse matrix, and transpose it.

dat <- as.matrix(dat)
dat <- Matrix::Matrix(dat, sparse = TRUE)
rownames(dat) <- paste0('Cell', '-', c(1:nrow(dat)))
dat <- Matrix::t(dat)
dat

We can then use this input to initialise a Seurat obj…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@pavitraviswanath
Comment options

@denvercal1234GitHub
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by pavitraviswanath
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants