cellink.tl.external.prepare_scprs_data#
- cellink.tl.external.prepare_scprs_data(adata, labels, gwas_file, prefix, prs_dir, p_thresholds=None, r2_thresholds=None, n_pcs_knn=20, knn_n_neighbors=25, overwrite=False)#
Prepare scPRS input data from pre-computed PLINK score files.
Reads PLINK score files generated by the SLURM array job (
write_slurm_array_job()) into a(n_samples, n_cells, 21)PRS matrix, builds the kNN graph, and serialises(X, y, edge)as a pickle forrun_scprs().- Parameters:
adata (AnnData) – Reference scATAC-seq AnnData. LSI embedding should be in
adata.obsm["X_lsi"](preferred) oradata.obsm["X_pca"].labels (pd.Series) – Binary case/control labels (1=case, 0=control) indexed by donor ID, matching the sample IDs in the PLINK
.famfile.gwas_file (str or Path) – Post-QC GWAS summary statistics (tab-separated). Only used to determine p-value thresholds if not supplied explicitly.
prefix (str) – Output prefix for all files.
prs_dir (str or Path) – Directory containing pre-computed PLINK score files in the layout
{prs_dir}/{r2}/{cell}.{p}.profileproduced by the SLURM array job. Runwrite_slurm_array_job()first, then pass the sameprs_dirhere.p_thresholds (list of float, optional) – C+T p-value thresholds. Default:
[1e-5, 1e-4, 1e-3, 0.01, 0.05, 0.1, 0.5]r2_thresholds (list of float, optional) – C+T LD r² thresholds. Default:
[0.1, 0.3, 0.5]n_pcs_knn (int, default=20) – Number of LSI/PCA dimensions used for kNN graph.
knn_n_neighbors (int, default=25) – k for kNN graph (paper default: 25).
overwrite (bool, default=False) – Re-run even if the output pickle already exists.
- Return type:
- Returns:
str Path to the generated pickle file
{prefix}_scprs_data.pkl.