read_matrix_from_folder: Read Matrix from Folder

read_matrix_from_folderR Documentation

Read Matrix from Folder

Description

This function reads a matrix, barcodes, and features from a specified directory and returns the matrix with appropriate row and column names.

Usage

read_matrix_from_folder(dir)

Arguments

dir

Character. The directory containing the matrix, barcodes, and features files.

Details

The specified directory must contain the following files:

  • Matrix file: A file with the extension .mtx.gz or .mtx. This file contains the count matrix in Matrix Market format.

  • Barcodes file: A file with the name barcodes.tsv.gz or barcodes.tsv. This file contains the barcodes for the columns of the matrix.

  • Features file: A file with the name features.tsv.gz or features.tsv. This file contains the features (e.g., gene names) for the rows of the matrix.

The function will search for these files in the specified directory and read them using appropriate functions. The matrix will be returned with barcodes as column names and features as row names.

Value

A sparse matrix with barcodes as column names and features as row names.

Examples


## Not run: 
  matrix_dir <- "path/to/matrix/folder"
  matrix <- read_matrix_from_folder(matrix_dir)
  print(matrix)

## End(Not run)


theMILOlab/SPATA2 documentation built on Feb. 8, 2025, 11:41 p.m.