mantispy.pp.correct_chromosome_arm#
- mantispy.pp.correct_chromosome_arm(adata, *, expression=None, cell_line=None, gene='Metadata_Gene', arm='Metadata_ChromosomeArm', unexpressed=None, tpm_cutoff=0.5, min_genes=20, key_added=None, copy=False)[source]#
Remove the chromosome-arm (proximity-bias) background from CRISPR knockout profiles.
A CRISPR cut can change the copy number along the gene’s chromosome arm, so knockouts on the same arm tend to share a background that is not their biology. Following Chandrasekaran et al. [2023]’s profiling recipe, this subtracts, from every well on an arm, the mean profile of that arm’s wells whose gene is not expressed in the screened cell line, since an unexpressed gene’s knockout carries only the arm background.
The unexpressed genes are read from DepMap for the screened cell line, so the correction is tied to the line rather than to any hard-coded reference. Pass the DepMap expression matrix and the cell line’s model id, or a ready-made set of unexpressed genes.
This is for CRISPR knockout data. ORF overexpression wells carry no such arm background, so do not run it on them even though
mantispy.pp.annotate_jump()also gives them a chromosome arm.- Parameters:
adata (
AnnData) – Object to correct, with one perturbed gene per well.expression (
str|Path|DataFrame|None(default:None)) – A DepMap expression matrix, as a path or a loaded frame, read bymantispy.io.unexpressed_genes()whenunexpressedis not given.cell_line (
str|None(default:None)) – The DepMap model id of the screened line, such as"ACH-000364"for U2OS.gene (
str(default:'Metadata_Gene')) – Column holding each well’s gene symbol.arm (
str(default:'Metadata_ChromosomeArm')) – Column holding each well’s chromosome arm, such as"1p". Wells with no arm are left untouched.mantispy.ds.jump_crispr()writes both columns.unexpressed (
Collection[str] |None(default:None)) – Gene symbols counted as unexpressed. WhenNone, they are read fromexpressionforcell_line.tpm_cutoff (
float(default:0.5)) – The log2(TPM+1) value at or below which a gene counts as unexpressed, used whenunexpressedisNone. The default admits lowly-expressed genes, not only those at zero TPM, so that enough genes sit on each arm to estimate its background, matching the permissive threshold the recipe uses.min_genes (
int(default:20)) – Correct an arm only when more than this many of its unexpressed genes are present, so the background is estimated from enough wells.key_added (
str|None(default:None)) – Write tolayers[key_added]instead of overwritingX.copy (
bool(default:False)) – Return a modified copy instead of mutating in place.
- Return type:
- Returns:
None, or the modified copy. WritesXorlayers[key_added], and the corrected arms with the count of unexpressed genes behind each touns["mantispy"]["chromosome_arm"].- Raises:
KeyError –
geneorarmis not a column ofadata.obs.ValueError – neither
unexpressednor bothexpressionandcell_lineare given.