Reads an extraction directory, applies the cell QC (cell_qc(); with a qc_pass column of cell_meta a cell must
also have qc_pass TRUE; cells restricts the run to a set of cells instead, without QC), annotates arms, filters bins (default: bin_filter() on the kept cells, chr1-22
and chrX), normalises depth (normalise_depth(): celltype for normal tissue, model for tumours), builds the
regions (region_set()), the depth features (depth_features()), the molecule votes
(read_votes()) and the oriented allele features (allelic_features()), and joins them into the
long features table (vignette("scphasedcn-outputs", package = "scphasedcn")).
Usage
cell_features(
dir,
cells = NULL,
cell_meta = NULL,
method = c("celltype", "model"),
ref_cells = NULL,
min_cells_type = 20,
use = NULL,
sex = NULL,
centromeres = NULL,
classes = c("arm", "chrom", "5Mb", "10Mb", "20Mb", "50Mb"),
events = NULL,
null_exclude = character(),
phasing = "auto",
groups = NULL,
mol_gap = params$mol_gap,
keep_votes = TRUE,
layers = character(),
qc = list(),
params = caller_defaults(),
verbose = FALSE,
exclude_atoms = NULL
)Arguments
- dir
extraction directory (bins_100kb.h5ad, fragments.tsv.gz + .tbi, cells_qc.tsv)
- cells
NULL (QC-pass cells) or the cells to use (no QC)
- cell_meta
NULL or a data.table with
celland optionalqc_pass, cell_type, flat, fold, group, stratum, n_frag(used as-is; NA cell_type = no type-matched reference; NA or missingstratum/n_fragkeep the QC values). WithcellsNULL only cells ofcell_metaare used, and with aqc_passcolumn (e.g.make_cell_meta()) only those withqc_passTRUE that also passcell_qc()with theqcarguments- method
depth normalisation, "celltype" or "model" (any
normalise_depth()method is accepted)- ref_cells
reference cells of the normalisation (selector; NULL = all)
- min_cells_type
celltype: minimal reference cells of a type
- use
NULL or a logical bin filter
- sex
"female" / "male" (case-insensitive, or "F" / "M"; any other value stops; NULL: the cells'
sexcolumn, whose non-missing values must all give the same sex)- centromeres
centromere table or path (Battenberg layout, see
arm_table(); NULL: the hg38 table shipped with the package,hg38_centromeres())- classes
region classes
- events
named events (see
region_set())- null_exclude
chromosomes / regions without null rows (known events)
- phasing
"auto", "chromosome", "block" (= "loo"), "loo" or "mirrored".
auto=chromosomewhendetect_phasing()finds chromosome-wide phase sets, elseloo. Chromosome-wide phasing is recommended for normal tissue (scphasedcn hybrid-phase;vignette("scphasedcn-inputs")for its limits):looorients each block by the other cells, cannot show allelic events carried by few cells and aligns allelic bias shared by all cells- groups
NULL, the name of a
cell_metacolumn, a vector named by cell, or one label per kept cell: the pseudobulk groups of the block orientation (NA = all-cell pseudobulk)- mol_gap
molecule gap (bp; default
params$mol_gap, 2000);params$mol_split_psandparams$votes_cleanset the molecule split by phase set and the blacklist filter of the votes (read_votes())- keep_votes
keep the votes table in the result
- layers
bin layers to read (none are needed by the depth normalisation)
- qc
named list of
cell_qc()arguments- params
- verbose
log each step (the run notes) as it happens
- exclude_atoms
NULL or atom ids whose votes are left out of the allele features (see
allelic_features())
Value
scn_features list: long (features, keyed by cell and region), regions, cells (row order =
the votes' cell index), votes, atoms, win (window_matrices()), params, notes, use, phasing
(detected, orientation), phasing_chrom (the per-chromosome regimes, phasing_by_chrom(); the notes name
chromosomes whose regime differs from detected)