sampleSNPs  0.9
Fast ordered sampling of records from files
Public Member Functions | Protected Member Functions | List of all members
sampFiles::HmpFileI Class Reference

HMP file input class. More...

#include <varfiles.hpp>

Inheritance diagram for sampFiles::HmpFileI:
Inheritance graph
[legend]
Collaboration diagram for sampFiles::HmpFileI:
Collaboration graph
[legend]

Public Member Functions

 HmpFileI ()
 Default constructor.
 
 HmpFileI (const string &fileName)
 File name constructor. More...
 
 HmpFileI (const HmpFileI &in)=default
 Copy constructor.
 
HmpFileIoperator= (const HmpFileI &in)=default
 Copy assignment.
 
 HmpFileI (HmpFileI &&in)=default
 Move constructor.
 
HmpFileIoperator= (HmpFileI &&in)=default
 Move assignment.
 
 ~HmpFileI ()
 Destructor.
 
void open ()
 Open stream to read.
 
void sample (HmpFileO &out, const uint64_t &n)
 Sample SNPs and save to HMP file. More...
 
uint64_t nsnp ()
 Number of SNPs in the object.
 

Protected Member Functions

uint64_t _numLines ()
 Get number of SNPs in the HMP file. More...
 

Detailed Description

HMP file input class.

Reads HMP files, skipping or copying the header as necessary.

Constructor & Destructor Documentation

◆ HmpFileI()

HmpFileI::HmpFileI ( const string &  fileName)

File name constructor.

Parameters
[in]fileNamefile name including extension

Member Function Documentation

◆ _numLines()

uint64_t HmpFileI::_numLines ( )
protected

Get number of SNPs in the HMP file.

Assumes Unix-like line endings. Header is not counted.

Returns
number of SNPs
Here is the caller graph for this function:

◆ sample()

void HmpFileI::sample ( HmpFileO out,
const uint64_t &  n 
)

Sample SNPs and save to HMP file.

Sample \(n\) SNPs without replacement from the file represented by the current object and save to the out object. Uses Vitter's [3] method. Number of samples has to be smaller that the number of SNPs in the file.

Parameters
[in]outoutput object
[in]nnumber of SNPs to sample
Here is the call graph for this function:

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