snpic¶
This module implements the SNP-IC calculation pipeline, exposing both a Click CLI group and Python-callable wrappers.
CLI Commands¶
oddSNP snpic¶
Usage
oddSNP snpic [OPTIONS] COMMAND [ARGS]...
calculate-snpic¶
Computes the SNP Information Content (SNP-IC) for each cell based on the
pileup output of cellSNP and saves the per-cell counts to a compressed
pickle file. Results are stored in snpic_counts.pkl.gz under OUPATH.
Arguments:
INPATH: Path to the folder containing cellSNP output files. Must contain
cellSNP.samples.tsv,cellSNP.tag.AD.mtx,cellSNP.tag.DP.mtx, andcellSNP.tag.OTH.mtx.OUPATH: Path where the SNP-IC counts will be saved
Usage
oddSNP snpic calculate-snpic [OPTIONS] INPATH OUPATH
Options
- --force¶
Override target file.
Arguments
- INPATH¶
Required argument
- OUPATH¶
Required argument
estimate-donor-assignment¶
Estimate donor assignment for each barcode based on SNP-IC values.
Arguments:
BARCODES: Path to the list of barcodes to be assigned
AGFILE: Path to the SNP-IC counts file (pkl.gz) generated by calculate_snpic.
OUPATH: Path to the folder where to store the resulting bars file
N: Number of donors (ex: 5) or List of probabilities (ex: [0.1,0.3,0.4,0.2] - no spaces).
Usage
oddSNP snpic estimate-donor-assignment [OPTIONS] BARFILE AGFILE OUPATH N
Options
- --seed <seed>¶
Seed used for reproducible results.
- --force¶
Override target files
Arguments
- BARFILE¶
Required argument
- AGFILE¶
Required argument
- OUPATH¶
Required argument
- N¶
Required argument
generate-histogram¶
Generate a histogram of SNP-IC values from a SNP-IC counts file. Returns the name of the file where the histogram DataFrame is stored.
Arguments:
AGFILE: Path to the SNP-IC counts file (pkl.gz) generated by calculate_snpic.
OUPATH: Path to the folder where to store the histogram file.
Usage
oddSNP snpic generate-histogram [OPTIONS] AGFILE OUPATH
Options
- --force¶
Override target file.
Arguments
- AGFILE¶
Required argument
- OUPATH¶
Required argument
run-all¶
Full SNP-IC calculation pipeline.
Arguments:
- INPATH: Path to the folder containing cellSNP output files. The folder
should contain at least the following files: cellSNP.samples.tsv, cellSNP.tag.AD.mtx, cellSNP.tag.DP.mtx, and cellSNP.tag.OTH.mtx.
OUPATH: Path to the output folder where all results will be stored.
Usage
oddSNP snpic run-all [OPTIONS] INPATH OUPATH
Options
- --force¶
Override target files.
Arguments
- INPATH¶
Required argument
- OUPATH¶
Required argument
save-donor-estimation-plot¶
Save a donor estimation plot
Arguments:
- BARFILE: Path to the bar definitions file (pkl) generated by the
estimate_donor_assignment function
OUTPUT: Path to the output file where to save the figure
Usage
oddSNP snpic save-donor-estimation-plot [OPTIONS] BARFILE OUTPUT
Options
- --force¶
Override target file.
Arguments
- BARFILE¶
Required argument
- OUTPUT¶
Required argument
save-snpic-plot¶
Save a SNP-IC histogram plot.
Arguments:
HISTOFILE: Path to the SNP-IC histogram file (pkl) generated by generate_histogram.
OUTPUT: Path to the output file where to save the figure (should end with .html).
Usage
oddSNP snpic save-snpic-plot [OPTIONS] HISTOFILE OUTPUT
Options
- --force¶
Override target file.
Arguments
- HISTOFILE¶
Required argument
- OUTPUT¶
Required argument
Python API¶
- oddSNP.snpic.call_calculate_snpic(inpath, oupath, force)[source]¶
Python API wrapper for
calculate_snpic().- Parameters:
inpath – Path to the folder containing cellSNP output files. Must contain
cellSNP.samples.tsv,cellSNP.tag.AD.mtx,cellSNP.tag.DP.mtx, andcellSNP.tag.OTH.mtx.oupath – Path where the SNP-IC counts will be saved.
force – If
True, overrides any existing output file.
- Returns:
Path to
snpic_counts.pkl.gz.- Return type:
pathlib.Path
- oddSNP.snpic.call_estimate_donor_assignment(barfile, agfile, oupath, n, seed=None, force=False)[source]¶
Python API wrapper for
estimate_donor_assignment()- Parameters:
barfile (str) – Path to the list of barcodes to be assigned
agfile (str) – Path to the SNP-IC counts file (pkl.gz) generated by calculate_snpic
oupath (str) – Path to the folder where to store the resulting bars file
n (int or list) – Number of donors or list of probabilities
seed (int, optional) – Seed used for reproducible results
force (bool) – Override target files
- Returns:
Path to the generated bars file
- Return type:
Path
- oddSNP.snpic.call_generate_histogram(agfile, oupath, force)[source]¶
Python API wrapper for
generate_histogram().- Parameters:
agfile – Path to the SNP-IC counts file (pkl.gz) generated by calculate_snpic.
oupath – Path to the folder where to store the histogram file.
force – If
True, overrides any existing output file.
- Returns:
Path to the generated histogram file.
- Return type:
pathlib.Path
- oddSNP.snpic.call_run_all(inpath, oupath, force)[source]¶
Python API wrapper for
run_all().- Parameters:
inpath – Path to the folder containing cellSNP output files. The folder should contain at least the following files: cellSNP.samples.tsv, cellSNP.tag.AD.mtx, cellSNP.tag.DP.mtx, and cellSNP.tag.OTH.mtx.
oupath – Path to the output folder where all results will be stored.
force – If
True, overrides any existing output files.
- oddSNP.snpic.call_save_donor_estimation_plot(barfile, output, force)[source]¶
Python API wrapper for
save_donor_estimation_plot()- Parameters:
barfile (str) – Path to the bar definitions file (pkl) generated by the estimate_donor_assignment function
output (str) – Path to the output file where to save the figure
force (bool) – Override target file
- oddSNP.snpic.call_save_snpic_plot(histofile, output, force)[source]¶
Python API wrapper for
save_snpic_plot().- Parameters:
histofile – Path to the SNP-IC histogram file (pkl) generated by generate_histogram.
output – Path to the output file where to save the figure (should end with .html).
force – If
True, overrides any existing output file.
- Returns:
Path to the generated figure file.
- Return type:
pathlib.Path