| 54 | | counts.all <- Read10X(data.dir = input.counts.filename) |
| 55 | | }}} |
| 56 | | |
| | 54 | counts.data <- Read10X(data.dir = input.counts.filename) |
| | 55 | }}} |
| | 56 | |
| | 57 | * This is how you would load the counts from a file with gene counts: |
| | 58 | {{{ |
| | 59 | library("Seurat") |
| | 60 | message("Loaded Seurat version", packageDescription("Seurat")$Version) |
| | 61 | counts.data <- read.table(file = paste0("./exp1_forSeurat.txt")) |
| | 62 | }}} |
| | 63 | |
| | 64 | * Example of input data if starting with gene counts (only a few samples): |
| | 65 | {{{ |
| | 66 | E25-35_A4 E25-35_A5 E25-35_A6 E25-35_B4 E25-35_B5 E25-35_B6 E25-35_C4 E25-35_C5 E25-35_C6 |
| | 67 | ENSMUSG00000064372_mt-Tp 7 10 7 10 3 17 13 4 |
| | 68 | ENSMUSG00000064371_mt-Tt 0 0 0 1 0 5 0 0 |
| | 69 | }}} |
| | 70 | * Make the Seurat object and calculate the percentage of mitochondrial reads |
| | 71 | {{{ |
| | 72 | seuratObject <- CreateSeuratObject(counts = counts.data,project = "ProjectName") |
| | 73 | seuratObject[["percent.mt"]] <- PercentageFeatureSet(object = seuratObject, pattern = "^mt-") |
| | 74 | }}} |
| | 75 | === Filter cells with high % reads mapping to mitochondrial transcripts and with low number of genes detected === |
| | 76 | These cutoffs are specific for each experiment |
| | 77 | {{{ |
| | 78 | MIN.NUM.GENES = 200 |
| | 79 | MAX.NUM.GENES = 8000 |
| | 80 | MAX.PERCENT.MITO = 20 |
| | 81 | all_Filt <- subset(x = seuratObject, subset = nFeature_RNA > MIN.NUM.GENES & nFeature_RNA < MAX.NUM.GENES & percent.mt < MAX.PERCENT.MITO) |
| | 82 | }}} |
| | 83 | |
| | 84 | === Normalize data === |
| | 85 | {{{ |
| | 86 | all_Filt <- NormalizeData(object = all_Filt, normalization.method = "LogNormalize", scale.factor = 10000) |
| | 87 | }}} |
| | 88 | |
| | 89 | === Identify of highly variable features === |
| | 90 | {{{ |
| | 91 | num.variable.features.to.find = 2000 |
| | 92 | all_Filt <- FindVariableFeatures(object = all_Filt, selection.method = "vst", nfeatures = num.variable.features.to.find) |
| | 93 | |
| | 94 | }}} |
| | 95 | === Scale data === |
| | 96 | {{{ |
| | 97 | all.genes <- rownames(x = all_Filt) |
| | 98 | all_Filt <- ScaleData(object = all_Filt, features = all.genes) |
| | 99 | }}} |