Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do process a scanpy cell-by-gene matrix? #4

Open
gmurtaza404 opened this issue Mar 15, 2024 · 1 comment
Open

How do process a scanpy cell-by-gene matrix? #4

gmurtaza404 opened this issue Mar 15, 2024 · 1 comment

Comments

@gmurtaza404
Copy link

Can you share any scripts that you have to convert an arbitrary scRNA-seq cell-by-gene matrix into the format your model inputs?

Thanks

@RanZhang08
Copy link
Contributor

Here's an example script (please refer to https://gist.github.com/xie186/332eff13dcac50f101f91494402b4bd1#file-csv2mex-r for more details).

library(Matrix)

# generate single-cell RNA seq data
count <- read.csv(input_matrix, header=T, row.names = 1)
gbm <- t(count)

# save sparse matrix
sparse.gbm <- Matrix(gbm , sparse = T )
writeMM(obj = sparse.gbm, file="matrix.mtx")

# save genes and cells names
write(x = rownames(gbm), file = "genes.txt")
write(x = colnames(gbm), file = "barcodes.tsv")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants