---
title: "Reading HTO UMI-count-matrix "
author: Anushka Gupta
date: February 16th 2021
---

# This notebook was used to read the output of CITE-seq-Count workflow (10.5281/zenodo.2585469), which is a UMI-count-matrix with hashtagged-antibodies as rows and cells as column.
# HTO barcode sequence and sample assignment could be found in Table S1A.

```{r setup}
knitr::opts_knit$set(root.dir = '~/Desktop/scRNA-seq_snRNA-seq_adipocyte_lineages/')
```

```{r}
# Load libraries
library(Matrix)

# Download UMI-count-matrix from GEO # . Update "matrix_dir" with the path to the downloaded folder on your local computer.   
matrix_dir = "umi_counts/htos/"
barcode.path <- paste0(matrix_dir, "barcodes.tsv.gz")
features.path <- paste0(matrix_dir, "features.tsv.gz")
matrix.path <- paste0(matrix_dir, "matrix.mtx.gz")
mat_HTO <- readMM(file = matrix.path)
feature.names = read.delim(features.path, header = FALSE, stringsAsFactors = FALSE)
barcode.names = read.delim(barcode.path, header = FALSE, stringsAsFactors = FALSE)
colnames(mat_HTO) = barcode.names$V1
rownames(mat_HTO) = c("HTO_251","HTO_252","HTO_253","HTO_254","Unmapped") # HTO information can be found in Table S1A

# Remove UMI-counts annotated as unmapped
mat_HTO=mat_HTO[1:4,]
save(mat_HTO,file = "rdata/umi.count.hto.rds")
```

