importBUStools {singleCellTK} | R Documentation

## Construct SCE object from BUStools output

### Description

Read the barcodes, features (genes), and matrix from BUStools output. Import them as one SingleCellExperiment object. Note the cells in the output files for BUStools 0.39.4 are not filtered.

### Usage

    importBUStools(
      BUStoolsDirs,
      samples,
      matrixFileNames = "genes.mtx",
      featuresFileNames = "genes.genes.txt",
      barcodesFileNames = "genes.barcodes.txt",
      gzipped = "auto",
      class = c("Matrix", "matrix"),
      delayedArray = TRUE
    )

### Arguments

`BUStoolsDirs` | A vector of paths to BUStools output files. Each sample should have its own path. For example: `./genecount`. Must have the same length as `samples`.
`samples` | A vector of user-defined sample names for the samples to be imported. Must have the same length as `BUStoolsDirs`.
`matrixFileNames` | Filenames for the Market Exchange Format (MEX) sparse matrix files (.mtx files). Must have length 1 or the same length as `samples`.
`featuresFileNames` | Filenames for the feature annotation files. Must have length 1 or the same length as `samples`.
`barcodesFileNames` | Filenames for the cell barcode list file. Must have length 1 or the same length as `samples`.
`gzipped` | Boolean. `TRUE` if the BUStools output files (barcodes.txt, genes.txt, and genes.mtx) were gzip compressed. `FALSE` otherwise. This is `FALSE` in BUStools 0.39.4. Default `"auto"` which automatically detects if the files are gzip compressed. Must have length 1 or the same length as `samples`.
`class` | Character. The class of the expression matrix stored in the SCE object. Can be one of "Matrix" (as returned by readMM function), or "matrix" (as returned by matrix function). Default "Matrix".
`delayedArray` | Boolean. Whether to read the expression matrix as DelayedArray-class object or not. Default `TRUE`.

### Value

A `SingleCellExperiment` object containing the count matrix, the gene annotation, and the cell annotation.

### Examples

    # Example #1
    # FASTQ files were downloaded from
    # https://support.10xgenomics.com/single-cell-gene-expression/datasets/3.0.0
    # /pbmc_1k_v3
    # They were concatenated as follows:
    # cat pbmc_1k_v3_S1_L001_R1_001.fastq.gz pbmc_1k_v3_S1_L002_R1_001.fastq.gz >
    # pbmc_1k_v3_R1.fastq.gz
    # cat pbmc_1k_v3_S1_L001_R2_001.fastq.gz pbmc_1k_v3_S1_L002_R2_001.fastq.gz >
    # pbmc_1k_v3_R2.fastq.gz
    # The following BUStools command generates the gene, cell, and
    # matrix files

    # bustools correct -w ./3M-february-2018.txt -p output.bus | \
    #   bustools sort -T tmp/ -t 4 -p - | \
    #   bustools count -o genecount/genes \
    #     -g ./transcripts_to_genes.txt \
    #     -e matrix.ec \
    #     -t transcripts.txt \
    #     --genecounts -

    # The top 20 genes and the first 20 cells are included in this example.
    sce <- importBUStools(
      BUStoolsDirs = system.file("extdata/BUStools_PBMC_1k_v3_20x20/genecount/",
        package = "singleCellTK"),
      samples = "PBMC_1k_v3_20x20")

[Package singleCellTK version 2.0.0 Index]