- class scirpy.io.AirrCell(cell_id, cell_attribute_fields=(), *, logger=<module 'scanpy.logging' from 'C:\\\\hostedtoolcache\\\\windows\\\\Python\\\\3.9.13\\\\x64\\\\lib\\\\site-packages\\\\scanpy\\\\logging.py'>)
Data structure for a Cell with immune receptors. Represents one row of
This data structure is compliant with the AIRR rearrangement schema v1.0. An AirrCell can hold multiple chains (i.e. rows from the rearrangement TSV) which belong to the same cell. A chain is represented as a dictionary, where the keys are AIRR-rearrangement fields.
The AirrCell can, additionally, hold cell-level attributes which can be set in a dict-like fashion. Keys marked as “cell-level” via
cell_attribute_fieldswill be automatically transferred to the cell-level when added through a chain. They are required to have the same value for all chains.
- cell_id :
cell id or barcode. Needs to match the cell id used for transcriptomics data (i.e. the
- cell_attribute_fields :
List of field-names which are supposed to be stored at the cell-level rather than the chain level. If a chain with these fields is added to the cell, they are set on the cell-level instead. If the values already exist on the cell-level, a
ValueErroris raised, if they differ from the values that are already present.
A logger to write messages to. If not specified, use scanpy’s default logger.
- cell_id :
Valid chains are IMGT locus names see https://docs.airr-community.org/en/latest/datarep/rearrangements.html#locus-names
Identifiers of loci with a V-D-J junction
Identifiers of loci with a V-J junction
Unique identifier (barcode) of the cell.
List of chain-dictionaries added to the cell.
Return a list of all fields (chain-level and cell-level)
Add a chain to the cell.
Add chains serialized as JSON.
Generate an empty chain dictionary, containing all required AIRR columns, but set to
If key is not found, d is returned if given, otherwise KeyError is raised.
as a 2-tuple; but raise KeyError if D is empty.
Iterate over chains as AIRR-Rearrangent compliant dictonaries.
Convert the cell to a scirpy record (i.e.
If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v