1
$\begingroup$

I have multiple single cell samples to analyze and I'm following the instructions in Satija Lab's website. I want to merge all the count files from all the samples at once, and associate the metadata to each sample.

For the Read10x command, is there a way to read multiple files at once, such as merging all the filter_featire_bc_matrix files?

I have all the samples saved in a directory on my desktop, is it possible to call the directory within the script for it to read all the raw counts?

This is what I have thus far:

# load the required libraries
library(dplyr)
library(Seurat) 
library(ggplot2)

-----------------------------------------------

# set up the working directory

wd = ("~/Seurat") setwd(wd)

# read all metadata

metadata = read.table("metadata_Jan2020.csv", sep=';', header=T, stringsAsFactors=F)
rownames(metadata) = metadata$LibraryID

#metadata
#mf = metadata

mf = metadata %>% filter(Type %in% c("PDAC", "NORMAL"))
mf = mf %>% filter(!(ID %in% c("PDAC-HTB2854")))`
$\endgroup$
2
$\begingroup$

Seurat has a vignette specifically for combining multiple 10x libraries.

$\endgroup$
8
  • $\begingroup$ Yes, I know. But I'm wondering if there is a way to merge all counts before creating a Seurat object. I'd like to just create one Seurat object with all the counts. $\endgroup$
    – mmpp
    Feb 23 '20 at 15:27
  • $\begingroup$ You don't have to keep the intermediate Seurat objects. $\endgroup$
    – burger
    Feb 24 '20 at 2:05
  • $\begingroup$ To merge all counts before creating individual Seurat objects, you will need to give a prefix or a suffix to cell names. I would however advise to create individual Seurat objects with apply() or mclapply() and then reduce() these with Seurat's merge(), this will give you a single Seurat object with all your samples. $\endgroup$
    – haci
    Feb 24 '20 at 10:24
  • $\begingroup$ @haci How do I give a prefix or suffix? $\endgroup$
    – mmpp
    Feb 24 '20 at 17:54
  • $\begingroup$ Note that a month later, they put out a new vignette about merging data sets which is more complex: satijalab.org/seurat/pancreas_integration_label_transfer.html $\endgroup$
    – swbarnes2
    Feb 28 '20 at 22:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.