cellink.tl.external.write_slurm_array_job#
- cellink.tl.external.write_slurm_array_job(adata, gwas_file, plink_bfile, prs_dir, output_dir='.', job_name='scprs_plink', ld_bfile=None, p_thresholds=None, r2_thresholds=None, clump_kb=250, maf=0.01, plink_cmd='plink', plink_threads=4, slurm_partition=None, slurm_qos=None, slurm_mem='8G', slurm_cpus=4, slurm_time='04:00:00', slurm_max_simultaneous=200, extra_sbatch_lines=None)#
Prepare per-cell GWAS files and write a SLURM array job for the PLINK C+T step.
Pre-generates per-cell filtered GWAS files in
prs_dir(Python step, requires AnnData, must be run once before cluster submission).Writes
{output_dir}/{job_name}_commands.txt— one shell command per cell, where each command runs PLINK clumping + scoring for all r² thresholds for that cell.Writes
{output_dir}/{job_name}_array.sh— a SLURM array job script where task$SLURM_ARRAY_TASK_IDexecutes the corresponding line of the commands file.Logs the
sbatchcommand and the follow-up Python call to run after all jobs complete.
After all array tasks finish, load the results with:
pkl = prepare_scprs_data( adata=adata, labels=labels, gwas_file=gwas_file, prefix="my_prefix", prs_dir="{prs_dir}", )
- Parameters:
adata (AnnData) – Reference scATAC-seq AnnData with peak coordinates in
adata.var.gwas_file (str or Path) – Post-QC GWAS summary statistics.
plink_bfile (str or Path) – PLINK binary prefix for the target cohort (scoring).
prs_dir (str or Path) – Directory where per-cell GWAS files and PLINK score files are written. Pass this same path to
prepare_scprs_data()afterwards.output_dir (str or Path, default=".") – Where to write the commands file and SLURM script.
job_name (str, default="scprs_plink") – SLURM job name and file prefix.
ld_bfile (str or Path, optional) – PLINK prefix for LD estimation. Defaults to
plink_bfile.p_thresholds (list of float, optional) – C+T p-value thresholds.
r2_thresholds (list of float, optional) – C+T LD r² thresholds.
clump_kb (int, default=250) – Clumping window in kb.
maf (float, default=0.01) – MAF filter for PLINK scoring.
plink_cmd (str, default="plink") – PLINK executable name (
plinkorplink2).plink_threads (int, default=4) –
--threadspassed to every PLINK call. Should equalslurm_cpusso the CPU allocation is fully utilised.slurm_partition (str, optional) –
#SBATCH --partitionvalue (-pflag). IfNone, the line is omitted — useful on clusters where the default partition is fine or where-q/--qosselects the queue instead.slurm_qos (str, optional) –
#SBATCH -qvalue. IfNone, the line is omitted.slurm_mem (str, default="8G") – Memory per task. Clumping on 1000G EUR (~8 M variants, 503 samples) needs ~4-6 GB. Increase for larger cohorts (e.g.
"32G"for UKB).slurm_cpus (int, default=4) –
--cpus-per-task. Should matchplink_threads.slurm_time (str, default="04:00:00") – Wall-clock time limit per task (
HH:MM:SS). Increase threads conservatively.slurm_max_simultaneous (int, default=200) – Maximum number of concurrently running array tasks (the
%Nsuffix on--array). Reduce to avoid overwhelming shared storage.extra_sbatch_lines (list of str, optional) – Additional raw
#SBATCHlines inserted verbatim, e.g.["#SBATCH --nice=0", "#SBATCH --gres=gpu:0"].
- Return type:
- Returns:
dict with keys:
commands_fileAbsolute path to the commands text file.
script_fileAbsolute path to the SLURM array script.
n_cellsNumber of cells with at least one peak-overlapping GWAS variant (= number of array tasks).
submit_cmdThe
sbatchcommand string to run.next_stepReminder string describing the Python call to make after all jobs finish.