Skip to contents

Create a Fragment object to store fragment file information. This object stores a 32-bit MD5 hash of the fragment file and the fragment file index so that any changes to the files on-disk can be detected. A check is also performed to ensure that the expected cells are present in the fragment file.

Usage

CreateFragmentObject(
  path,
  index = NULL,
  cells = NULL,
  seqlevels = NULL,
  validate.fragments = TRUE,
  verbose = TRUE,
  ...
)

Arguments

path

A path to the fragment file.

index

Path to the fragment file index. If NULL, the index file is assumed to be in the same directory as the fragment file.

cells

A named character vector containing cell barcodes contained in the fragment file. This does not need to be all cells in the fragment file, but there should be no cells in the vector that are not present in the fragment file. A search of the file will be performed until at least one fragment from each cell is found. If NULL, don't check for expected cells.

Each element of the vector should be a cell barcode that appears in the fragment file, and the name of each element should be the corresponding cell name in the object.

seqlevels

A named vector of sequence levels (eg, chromosome name) where each element is the sequence name as it appears in the fragment file, and the name of each element is the corresponding sequence name as stored in the object. If NULL, the sequence names are assumed to be the same in the fragment file and object.

validate.fragments

Check that expected cells are present in the fragment file.

verbose

Display messages

...

Additional arguments passed to ValidateCells

Examples

fpath <- system.file("extdata", "fragments.tsv.gz", package = "Signac")
cells <- colnames(x = atac_small)
names(x = cells) <- paste0("test_", cells)
frags <- CreateFragmentObject(
  path = fpath, cells = cells, verbose = FALSE, tolerance = 0.5
)