singlepp_loaders
Load pre-processed reference datasets for SingleR
Loading...
Searching...
No Matches
Classes | Typedefs | Functions
singlepp_loaders Namespace Reference

Load pre-processed single reference datasets. More...

Classes

struct  LoadLabelsOptions
 Options for loading labels. More...
 
struct  LoadMarkersOptions
 Options for loading markers. More...
 
struct  LoadRankingsOptions
 Options for loading rankings. More...
 

Typedefs

template<typename Value_ = double, typename Index_ = int, typename Rank_ = int>
using RankMatrix = tatami::DenseMatrix< Value_, Index_, std::vector< Rank_ > >
 

Functions

template<typename Label_ = singlepp::DefaultLabel>
std::vector< Label_load_labels_from_text_file (const char *path, const LoadLabelsOptions &options)
 
template<typename Label_ = singlepp::DefaultLabel>
std::vector< Label_load_labels_from_gzip_file (const char *path, const LoadLabelsOptions &options)
 
template<typename Label_ = singlepp::DefaultLabel>
std::vector< Label_load_labels_from_zlib_buffer (const unsigned char *buffer, size_t len, const LoadLabelsOptions &options)
 
template<typename Index_ = singlepp::DefaultIndex>
singlepp::Markers< Index_load_markers_from_text_file (const char *path, const LoadMarkersOptions &options)
 
template<typename Index_ = singlepp::DefaultIndex>
singlepp::Markers< Index_load_markers_from_gzip_file (const char *path, const LoadMarkersOptions &options)
 
template<typename Index_ = singlepp::DefaultIndex>
singlepp::Markers< Index_load_markers_from_zlib_buffer (const unsigned char *buffer, size_t len, const LoadMarkersOptions &options)
 
template<typename Value_ = singlepp::DefaultValue, typename Index_ = singlepp::DefaultIndex>
RankMatrix< Value_, Index_load_rankings_from_text_file (const char *path, const LoadRankingsOptions &options)
 
template<typename Value_ = singlepp::DefaultValue, typename Index_ = singlepp::DefaultIndex>
RankMatrix< Value_, Index_load_rankings_from_gzip_file (const char *path, const LoadRankingsOptions &options)
 
template<typename Value_ = singlepp::DefaultValue, typename Index_ = singlepp::DefaultIndex>
RankMatrix< Value_, Index_load_rankings_from_zlib_buffer (const unsigned char *buffer, size_t len, const LoadRankingsOptions &options)
 
template<typename Value_ , typename Index_ , typename Rank_ , typename Label_ >
void verify (const RankMatrix< Value_, Index_, Rank_ > &rankings, const std::vector< Label_ > &labels, const singlepp::Markers< Index_ > &markers)
 

Detailed Description

Load pre-processed single reference datasets.

Typedef Documentation

◆ RankMatrix

Matrix of ranks as a dense column-major matrix. Each column corresponds to a sample while each row corresponds to a feature. Each column contains the ranked expression values for all features.

Template Parameters
Value_Numeric type for data in the matrix interface.
Index_Integer type for indices in the matrix interface.
Rank_Integer type for the ranks being stored.

Function Documentation

◆ load_labels_from_gzip_file()

template<typename Label_ = singlepp::DefaultLabel>
std::vector< Label_ > singlepp_loaders::load_labels_from_gzip_file ( const char path,
const LoadLabelsOptions options 
)
Template Parameters
Label_Integer type for the label identity.
Parameters
pathPath to a Gzip-compressed file containing the labels.
optionsOptions for reading the labels.
Returns
Vector containing the label index for each reference profile.

See load_labels_from_text_file() for details about the format.

◆ load_labels_from_text_file()

template<typename Label_ = singlepp::DefaultLabel>
std::vector< Label_ > singlepp_loaders::load_labels_from_text_file ( const char path,
const LoadLabelsOptions options 
)
Template Parameters
Label_Integer type for the label identity.
Parameters
pathPath to a text file containing the labels.
optionsOptions for reading the labels.
Returns
Vector containing the label index for each reference profile.

The file should contain one line per profile, containing an integer label index for that profile. Label indices refer to another array containing the actual names of the labels (see load_label_names_from_text_file()). The total number of lines should be equal to the number of profiles in the dataset. The file should not contain any header.

◆ load_labels_from_zlib_buffer()

template<typename Label_ = singlepp::DefaultLabel>
std::vector< Label_ > singlepp_loaders::load_labels_from_zlib_buffer ( const unsigned char buffer,
size_t  len,
const LoadLabelsOptions options 
)
Template Parameters
Label_Integer type for the label identity.
Parameters
[in]bufferPointer to an array containing a Zlib/Gzip-compressed string of labels.
lenLength of the array for buffer.
optionsOptions for reading the labels.
Returns
Vector containing the label index for each reference profile.

See load_labels_from_text_file() for details about the format.

◆ load_markers_from_gzip_file()

template<typename Index_ = singlepp::DefaultIndex>
singlepp::Markers< Index_ > singlepp_loaders::load_markers_from_gzip_file ( const char path,
const LoadMarkersOptions options 
)
Template Parameters
Index_Integer type for the marker indices.
Parameters
pathPath to a Gzip-compressed file containing the marker lists.
optionsFurther options for reading.
Returns
A Markers object containing the markers from each pairwise comparison between labels.

See load_markers_from_text_file() for details about the format.

◆ load_markers_from_text_file()

template<typename Index_ = singlepp::DefaultIndex>
singlepp::Markers< Index_ > singlepp_loaders::load_markers_from_text_file ( const char path,
const LoadMarkersOptions options 
)
Template Parameters
Index_Integer type for the marker indices.
Parameters
pathPath to a text file containing the marker lists.
optionsFurther options for reading.
Returns
A Markers object containing the markers from each pairwise comparison between labels.

The file should contain one line per pairwise comparison between labels. Each line should at least 3 tab-delimited fields - the index of the first label, the index of the second label, and then the indices of the features selected as marker genes for the first label relative to the second. Any (non-zero) number of marker indices may be reported provided they are ordered by marker strength. The total number of lines in this file should be equal to the total number of pairwise comparisons between different labels, including permutations.

◆ load_markers_from_zlib_buffer()

template<typename Index_ = singlepp::DefaultIndex>
singlepp::Markers< Index_ > singlepp_loaders::load_markers_from_zlib_buffer ( const unsigned char buffer,
size_t  len,
const LoadMarkersOptions options 
)
Template Parameters
Index_Integer type for the marker indices.
Parameters
[in]bufferPointer to an array containing a Zlib/Gzip-compressed string containing the marker lists.
lenLength of the array for buffer.
optionsFurther options for reading.
Returns
A Markers object containing the markers from each pairwise comparison between labels.

See load_markers_from_text_file() for details about the format.

◆ load_rankings_from_gzip_file()

template<typename Value_ = singlepp::DefaultValue, typename Index_ = singlepp::DefaultIndex>
RankMatrix< Value_, Index_ > singlepp_loaders::load_rankings_from_gzip_file ( const char path,
const LoadRankingsOptions options 
)
Template Parameters
Value_Numeric type for data in the matrix interface.
Index_Integer type for indices in the matrix interface.
Parameters
pathPath to a Gzip-compressed file containing the ranking matrix.
optionsOptions for reading the rankings.
Returns
A RankMatrix containing the feature rankings for each reference profile. Each column corresponds to a reference profile while each row corresponds to a feature.

See load_rankings_from_text_file() for details about the format.

◆ load_rankings_from_text_file()

template<typename Value_ = singlepp::DefaultValue, typename Index_ = singlepp::DefaultIndex>
RankMatrix< Value_, Index_ > singlepp_loaders::load_rankings_from_text_file ( const char path,
const LoadRankingsOptions options 
)
Template Parameters
Value_Numeric type for data in the matrix interface.
Index_Integer type for indices in the matrix interface.
Parameters
pathPath to a text file containing the ranking matrix.
optionsOptions for reading the rankings.
Returns
A RankMatrix containing the feature rankings for each reference profile. Each column corresponds to a reference profile while each row corresponds to a feature.

The file should contain one line per reference profile, with the total number of lines equal to the number of profiles in the dataset. Each line should contain the rank of each feature's expression within that profile, separated by commas. The number of comma-separated fields on each line should be equal to the number of features. Ranks should be strictly integer - tied ranks should default to the minimum rank among the index set of ties.

◆ load_rankings_from_zlib_buffer()

template<typename Value_ = singlepp::DefaultValue, typename Index_ = singlepp::DefaultIndex>
RankMatrix< Value_, Index_ > singlepp_loaders::load_rankings_from_zlib_buffer ( const unsigned char buffer,
size_t  len,
const LoadRankingsOptions options 
)
Template Parameters
Value_Numeric type for data in the matrix interface.
Index_Integer type for indices in the matrix interface.
Parameters
[in]bufferPointer to an array containing a Zlib/Gzip-compressed string containing the ranking matrix.
lenLength of the array for buffer.
optionsOptions for reading the rankings.
Returns
A RankMatrix containing the feature rankings for each reference profile. Each column corresponds to a reference profile while each row corresponds to a feature.

See load_rankings_from_text_file() for details about the format.

◆ verify()

void singlepp_loaders::verify ( const RankMatrix< Value_, Index_, Rank_ > &  rankings,
const std::vector< Label_ > &  labels,
const singlepp::Markers< Index_ > &  markers 
)

This checks the consistency of all components of the reference dataset after they have been loaded:

  • The number of columns of rankings should be equal to the length of labels.
  • The number of labels is defined as the largest value in labels plus 1.
  • The length of markers and the number of inner vectors in each element of markers should be equal to the number of labels.
  • Each gene index in markers should be non-negative and less than the number of rows in rankings.
Template Parameters
Value_Numeric type for data in the matrix interface.
Index_Integer type for indices in the matrix interface.
Rank_Integer type for the ranks being stored.
Label_Integer type for the labels.
Parameters
rankingsThe matrix produced by load_rankings_from_text_file() or related functions.
labelsVector of labels produced by load_labels_from_text_file() or related functions.
markersList of markers produced by load_markers_from_text_file() or related functions.