cellink.tl.external.calculate_pcs#
- cellink.tl.external.calculate_pcs(dd, prefix, out=None, num_pcs=10, run=True, save_cmd_file=None, plink_export_kwargs={})#
Run PLINK to calculate genetic PCs using the
--pcaoption.- Parameters:
dd (DonorData) – Object containing donor-level genotype (
dd.G) and cell-level expression data (dd.C).prefix (str) – Prefix to PLINK binary files (.bed/.bim/.fam).
out (str, optional) – Output file prefix. Defaults to <prefix>_pca.
num_pcs (int, default=10) – Number of principal components to compute.
run (bool, default=True) – If True, run the command. If False, return the command string.
save_cmd_file (str, optional) – If provided, writes the command to a file.
plink_export_kwargs (dict, optional) – Additional keyword arguments for
to_plinkfunction.
- Return type:
DataFrame|str- Returns:
pd.DataFrame or str PC dataframe if run, or command string if run=False.