Sample SNPs
Fast ordered sampling of rows from large text or binary files. Special cases for DNA variant files (.bed, VCF, HapMap, etc).
Public Member Functions | List of all members
sampFiles::PopIndex Class Reference

Population index. More...

#include <populations.hpp>

Public Member Functions

 PopIndex ()
 Default constructor.
 
 PopIndex (const int *arr, const size_t &N)
 Array constructor. More...
 
 PopIndex (const string &inFileName)
 File read constructor. More...
 
vector< size_t > & operator[] (const size_t &i)
 Vector subscript operator. More...
 
const vector< size_t > & operator[] (const size_t &i) const
 const vector subscript operator More...
 
size_t popSize (const size_t &i)
 Population size. More...
 
size_t popSize (const size_t &i) const
 const population size More...
 
size_t size ()
 Total sample size. More...
 
size_t size () const
 const total sample size More...
 
size_t popNumber ()
 Number of populations. More...
 
size_t popNumber () const
 const number of populations More...
 

Detailed Description

Population index.

For each population, contains indexes of the lines that belong to it.

Constructor & Destructor Documentation

◆ PopIndex() [1/2]

PopIndex::PopIndex ( const int *  arr,
const size_t &  N 
)

Array constructor.

The input array has an element for each line, and the value of that element is the population ID in the form of an int that is base-1 (i.e., if line N is in the first population, then arr[N] == 1).

Parameters
[in]arrarray of population IDs
[in]Narray length

◆ PopIndex() [2/2]

PopIndex::PopIndex ( const string &  inFileName)

File read constructor.

The input file has an entry for each line (separated by white space), and the value of that entry is the population ID in the form of an int that is base-1 (i.e., if line N is in the first population, then arr[N] == 1).

Parameters
[in]inFileNameinput file name

Member Function Documentation

◆ operator[]() [1/2]

vector<size_t>& sampFiles::PopIndex::operator[] ( const size_t &  i)
inline

Vector subscript operator.

Returns the index of population i.

Parameters
[in]ipopulation index
Returns
index of line IDs

◆ operator[]() [2/2]

const vector<size_t>& sampFiles::PopIndex::operator[] ( const size_t &  i) const
inline

const vector subscript operator

Returns the index of population i.

Parameters
[in]ipopulation index
Returns
index of line IDs

◆ popNumber() [1/2]

size_t sampFiles::PopIndex::popNumber ( )
inline

Number of populations.

Returns
number of populations

◆ popNumber() [2/2]

size_t sampFiles::PopIndex::popNumber ( ) const
inline

const number of populations

Returns
number of populations

◆ popSize() [1/2]

size_t sampFiles::PopIndex::popSize ( const size_t &  i)
inline

Population size.

Parameters
[in]ipopulation index
Returns
size of the _i_th population

◆ popSize() [2/2]

size_t sampFiles::PopIndex::popSize ( const size_t &  i) const
inline

const population size

Parameters
[in]ipopulation index
Returns
size of the _i_th population

◆ size() [1/2]

size_t sampFiles::PopIndex::size ( )
inline

Total sample size.

Returns
total sample size

◆ size() [2/2]

size_t sampFiles::PopIndex::size ( ) const
inline

const total sample size

Returns
total sample size

The documentation for this class was generated from the following files: