read10x vs read10x_h5 file extensions

quick question if anyone can help,

I'm trying to create a function that reads in multiple geo scRNAseq data sets so ideally want to just use the .h5 file extension to grab the data from the folders they are stored in,

I have code running perfectly for in-house data that's in a 10x 3 file format when I use the read10x function, but when I try to replace the read10X function with read10X_h5 to read in geo data, the files can be located unless I put the full file name in. do I have to use the full file name for each file?

top line works, bottom line doesn't

tmp = Read10X_h5("/filtered_feature_bc_matrix/GSM4339769_C141_filtered_feature_bc_matrix.h5")
tmp = Read10X_h5("/filtered_feature_bc_matrix/*.h5")

any thoughts?



Read10X_h5 is not a vectorised function in that it take a single file at a time.
if you want to apply it repeatedly to multiple files you need to prepare a list of files, and then iterate over them and put the results somewhere

result_from_files <- map(myfiles, ~myfunc(.))

which would perform myfunc() on each member of 'myfiles' and make a big list of results.
in your case myfunc would be this read10X function.
dir() is a base function
map() is in purrr/tidyverse
and you might find it convenient to manipulate paths with withr package.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.