mojaveazure / loomR

An R-based interface for loom files
61 stars 16 forks source link

DATA NOT CORRELATED WITH CLUSTERS #43

Open SaraVilla opened 5 years ago

SaraVilla commented 5 years ago

Hi, I am trying to work with the aggregated loom files. I have managed to convert to a .csv file the loom file, but it's missing the identification of the different clusters. My code is the following:

library(loomR) lfile <- connect(filename = "l6_r4_spinal_cord_inhibitory_neurons.agg.loom", mode = "r+") lfile lfile[["col_attrs"]] lfile[["row_attrs"]]

make the matrix into a dataframe

numbers_df<-as.data.frame(lfile[["matrix"]][, ])

transpose so columns becomes cells and rows becomes genes

numbers_df_t<-t(numbers_df)

make gene names and accessions into a vector (THIS STEP DOESN'T WORK)

genes<-lfile[["row_attrs/Gene"]][] accession<-lfile[["row_atters/Accession"]][]

add them to the numbers_df_t

dataset<-cbind(genes, numbers_df_t) write.csv(dataset, file="SingleCellSCinhbTrans.csv")


How can I get the columns identified by cluster?

thanks!