Skip to contents

This function is used to read data from a table-format file. The user needs to specify the format of the table using the parameter is.geneBYcell:

  • TRUE (the default): the rows will be treated as genes, while the columns will be treated as cells;

  • FALSE: the rows will be treated as cells, while the columns will be treated as genes.

Usage

readInput_table(
  table_file,
  sep = "\t",
  is.geneBYcell = TRUE,
  removeSuffix = FALSE,
  addPrefix = NULL
)

Arguments

table_file

The table format file (e.g. txt, tsv, csv, and others) which the data are to be read from.

sep

String, The field separator character. Default: "\t".

is.geneBYcell

Logical, whether the table is organized in gene (row) by cell (column) format. If FALSE, the rows will be treated as cells. Default: TRUE.

removeSuffix

Logical, whether to remove the suffix "-1" when present in all cell barcodes. Default: FALSE.

addPrefix

Character or NULL, add a prefix to the cell barcodes, like Sample ID. It is highly recommended to use a prefix containing letters and/or numbers only, and not starting with numbers. Default: NULL.

Value

A sparse gene expression matrix, genes by cells

Examples

table_file <- system.file("extdata/demo_inputs/table_file/demoData2.txt.gz", package = "scMINER") # path to text-table file
sparseMatrix <- readInput_table(table_file,
                                sep = "\t",
                                is.geneBYcell = TRUE,
                                removeSuffix = FALSE,
                                addPrefix = "demoSample")
#> Reading table file: /private/var/folders/v0/njhqcmrs32xgrjgx2wz8d50r0000gp/T/Rtmpf8JULY/temp_libpath11ae7194479/scMINER/extdata/demo_inputs/table_file/demoData2.txt.gz ...
#> Done! The sparse gene expression matrix has been generated: 1000 genes, 100 cells.