cpsnpic

This module implements the cpSNP-IC calculation pipeline, exposing both a Click CLI group and Python-callable wrappers.

CLI Commands

oddSNP cpsnpic

Usage

oddSNP cpsnpic [OPTIONS] COMMAND [ARGS]...

calculate-cpsnpic

Calculate the cpSNP-IC for pairs of cells. Returns the name of the file

where the DataFrame with the cpSNP-IC counts per cell pair is stored.

Arguments:

INPATH: Path to the folder containing pileup related files. The folder should

contain at least the following files: cellSNP.samples.tsv, cellSNP.tag.AD/DP and OTH matrices

OUPATH: Path to the output folder where results will be saved.

Usage

oddSNP cpsnpic calculate-cpsnpic [OPTIONS] INPATH OUPATH

Options

--nproc <nproc>

Number of parallel processes to use

--batch_size <batch_size>

Number of cell pairs to process in each batch.

--force

Override target file.

Arguments

INPATH

Required argument

OUPATH

Required argument

generate-histogram

Generate a histogram of cpSNP-IC values from a cpSNP-IC counts file. Returns the name of the file where the histogram DataFrame is stored.

Arguments:

CPFILE: Path to the cpSNP-IC counts file (pkl.gz) generated by calculate_cpsnpic.

OUPATH: Path to the folder where to store the histogram file.

Usage

oddSNP cpsnpic generate-histogram [OPTIONS] CPFILE OUPATH

Options

--force

Override target file.

Arguments

CPFILE

Required argument

OUPATH

Required argument

run-all

Run all cpSNP-IC calculation steps.

Arguments:

INPATH: Path to the folder containing pileup related files. The folder should

contain at least the following files: cellSNP.samples.tsv, cellSNP.tag.AD/DP and OTH matrices

OUPATH: Path to the output folder where results will be saved.

Usage

oddSNP cpsnpic run-all [OPTIONS] INPATH OUPATH

Options

--nproc <nproc>

Number of parallel processes to use

--batch_size <batch_size>

Number of cell pairs to process in each batch.

--force

Override target files.

Arguments

INPATH

Required argument

OUPATH

Required argument

save-cpsnpic-plot

Save a cpSNP-IC histogram figure

Arguments:

HISTOFILE The file where histogram data is stored

OUTPUT The output file where to save the figure (with extension .html)

Usage

oddSNP cpsnpic save-cpsnpic-plot [OPTIONS] HISTOFILE OUTPUT

Options

--force

Override target file.

Arguments

HISTOFILE

Required argument

OUTPUT

Required argument

Python API

oddSNP.cpsnpic.call_calculate_cpsnpic(inpath, oupath, nproc, batch_size, force)[source]

Python API wrapper for calculate_cpsnpic().

Parameters:
  • inpath – Path to the folder containing pileup related files. The folder should contain at least the following files: cellSNP.samples.tsv, cellSNP.tag.AD/DP and OTH matrices

  • oupath – Path to the output folder where results will be saved.

  • nproc – Number of parallel processes to use

  • batch_size – Number of cell pairs to process in each batch.

  • force – If True, override the target file.

oddSNP.cpsnpic.call_generate_histogram(cpfile, oupath, force)[source]

Python API wrapper for generate_histogram().

Parameters:
  • cpfile – Path to the cpSNP-IC counts file (pkl.gz)

  • oupath – Path to the folder where to store the histogram file

  • force – If True, override the target file.

oddSNP.cpsnpic.call_run_all(inpath, oupath, nproc, batch_size, force)[source]

Python API wrapper for run_all().

Parameters:
  • inpath – Path to the folder containing pileup related files.

  • oupath – Path to the output folder where results will be saved.

  • nproc – Number of parallel processes to use.

  • batch_size – Number of cell pairs to process in each batch.

  • force – If True, override target files.

oddSNP.cpsnpic.call_save_cpsnpic_plot(histofile, output, force)[source]

Python API wrapper for save_cpsnpic_plot().

Parameters:
  • histofile – The file where histogram data is stored

  • output – The output file where to save the figure (with extension .html)

  • force – If True, override the target file.

oddSNP.cpsnpic.matchingSNPs(snps1, snps2)[source]

Calculate the sum of min OTH+DP for matching SNPs between two cells.

Parameters:
  • snps1 – DataFrame with SNPs for cell 1

  • snps2 – DataFrame with SNPs for cell 2

Returns:

A list with [cell1_bcode, cell2_bcode, sum_min_OTH+DP]