I/O Functions
load_10x​
Load a 10X CellRanger output directory and build a SoupChannel.
from SoupX import load_10x
sc = load_10x(
data_dir = 'path/to/cellranger/outs/',
cell_ids = None,
channel_name = None,
include_features = ('Gene Expression',),
verbose = True,
)
Parameters:
data_dir- Top-level CellRanger output directory. Must containraw_feature_bc_matrix/(v3) orraw_gene_bc_matrices/(v2)cell_ids- Barcodes of droplets that are cells. If None, uses the filtered matrixchannel_name- Name for this channel. Defaults todata_dirinclude_features- Feature types to retain (v3 multi-modal data)verbose- Print loading progress
Returns: SoupChannel with soup profile estimated from raw droplets
load_10x_h5​
Build a SoupChannel from 10X HDF5 files. 5–10× faster than MEX format for large datasets.
from SoupX import load_10x_h5
sc = load_10x_h5(
raw_h5 = 'outs/raw_feature_bc_matrix.h5',
filtered_h5 = 'outs/filtered_feature_bc_matrix.h5',
)
Parameters:
raw_h5- Path toraw_feature_bc_matrix.h5(all droplets)filtered_h5- Path tofiltered_feature_bc_matrix.h5. Required whencell_idsis Nonecell_ids- Cell barcodes. Overridesfiltered_h5when supplied
Returns: Constructed SoupChannel
read_10x​
Read a 10X MEX-format directory, returning the raw matrix without building a SoupChannel.
from SoupX import read_10x
mat, gene_names, barcodes = read_10x('path/to/matrix_dir/')[:3]
Parameters:
data_dir- Directory containingmatrix.mtx(.gz),barcodes.tsv(.gz), andgenes/features.tsv(.gz)
Returns: Tuple of (sparse matrix, gene names, barcodes, feature_types)
read_10x_h5​
Read a CellRanger HDF5 file, returning the raw matrix.
from SoupX import read_10x_h5
mat, gene_names, barcodes, feature_types = read_10x_h5('matrix.h5')
Parameters:
h5_path- Path to.h5filegenome- Genome group name for v2 multi-genome files
Returns: Tuple of (sparse matrix, gene names, barcodes, feature_types)