to_scanpy#
- SingleCell.to_scanpy(*, QC_column='passed_QC')[source]#
Converts this SingleCell dataset to an AnnData object, the representation used by Scanpy.
Make sure to remove cells failing QC with sc.filter_obs(QC_column) first, or specify subset=True in qc(). Alternatively, to include cells failing QC in the AnnData object, set QC_column to None.
Note that there is no from_scanpy(); simply do SingleCell(anndata_object) to initialize a SingleCell dataset from an in-memory AnnData object.
- Parameters:
QC_column: str | None
if not None, raise an error if this column is present in obs and not all cells pass QC
- Returns:
An AnnData object. For AnnData versions older than 0.11.0, which do not support csr_array/csc_array, counts will be converted to csr_matrix/csc_matrix.
- Return type:
AnnData
Note
The count matrix is not copied during the conversion to save memory. This means modifying the AnnData object’s count matrix will also modify the original SingleCell dataset. If this behavior is undesirable, explicitly copy the dataset before converting with sc.copy().to_scanpy().