To use PyPairs import the package as i.e. follows:

from pypairs import pairs, datasets, settings, utils


This function implements the classification step of the pair-based prediction method described by Scialdone et al. (2015) [Scialdone15].

To illustrate, consider classification of cells into G1 phase. Pairs of marker genes are identified with sandbag(), where the expression of the first gene in the training data is greater than the second in G1 phase but less than the second in all other phases.

pairs.sandbag(data[, annotation, …]) Calculate ‘marker pairs’ from a genecount matrix.


For each cell, cyclone() calculates the proportion of all marker pairs where the expression of the first gene is greater than the second in the new data (pairs with the same expression are ignored). A high proportion suggests that the cell is likely to belong to this category, as the expression ranking in the new data is consistent with that in the training data. Proportions are not directly comparable between phases due to the use of different sets of gene pairs for each phase. Instead, proportions are converted into scores that account for the size and precision of the proportion estimate. The same process is repeated for all phases, using the corresponding set of marker pairs in pairs.

pairs.cyclone(data[, marker_pairs, …]) Score samples for each category based on marker pairs.

While this method is described for cell cycle phase classification, any biological groupings can be used here. However, for non-cell cycle phase groupings users should manually apply their own score thresholds for assigning cells into specific groups.


datasets.leng15([mode, gene_sub, sample_sub]) Single cell RNA-seq data of human hESCs to evaluate Oscope [Leng15]
datasets.default_cc_marker([dataset]) Cell cycle marker pairs derived from [Leng15] with the default sandbag() settings.

Quality Assesment

utils.evaluate_prediction(prediction, reference) Calculates F1 Score, Recall and Precision of a cyclone() prediction.


utils.export_marker(marker, fname[, defaultpath]) Export marker pairs to json-File.
utils.load_marker(fname[, defaultpath]) Export marker pairs to json-File.


The default directories for saving figures and caching files.

settings.figdir Directory for saving figures (default: './figures/').
settings.cachedir Directory for cache files (default: './cache/').

The verbosity of logging output, where verbosity levels have the following meaning: 0=’error’, 1=’warning’, 2=’info’, 3=’hint’

settings.verbosity Verbosity level (default: 1).

Print versions of packages that might influence numerical results.

log.print_versions() Versions that might influence the numerical results.