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 | Protected Attributes | Static Protected Attributes | List of all members
sampFiles::BedFile Class Reference

BED file base class. More...

#include <varfiles.hpp>

Inheritance diagram for sampFiles::BedFile:
[legend]
Collaboration diagram for sampFiles::BedFile:
[legend]

Public Member Functions

 BedFile ()
 Default constructor.
 
 BedFile (const string &stubName)
 File name constructor. More...
 
 BedFile (const BedFile &in)=default
 Copy constructor.
 
BedFileoperator= (const BedFile &in)=default
 Copy assignment.
 
 BedFile (BedFile &&in)=default
 Move constructor.
 
BedFileoperator= (BedFile &&in)=default
 Move assignment.
 
 ~BedFile ()
 Destructor.
 
virtual void open ()
 Open stream (does nothing)
 
void close ()
 Close stream.
 
- Public Member Functions inherited from sampFiles::GbinFile
 GbinFile ()
 Default constructor.
 
 GbinFile (const string &fileName, const size_t &nCols, const size_t &elemSize)
 Constructor with file name. More...
 
 GbinFile (const GbinFile &in)=default
 Copy constructor.
 
GbinFileoperator= (const GbinFile &in)=default
 Copy assignment.
 
 GbinFile (GbinFile &&in)=default
 Move constructor.
 
GbinFileoperator= (GbinFile &&in)=default
 Move assignment.
 
 ~GbinFile ()
 Destructor.
 
- Public Member Functions inherited from sampFiles::VarFile
 VarFile (const VarFile &in)=default
 Copy constructor.
 
VarFileoperator= (const VarFile &in)=default
 Copy assignment.
 
 VarFile (VarFile &&in)=default
 Move constructor.
 
VarFileoperator= (VarFile &&in)=default
 Move assignment.
 
 ~VarFile ()
 Destructor.
 

Protected Attributes

fstream _famFile
 Corresponding .fam file stream.
 
fstream _bimFile
 Corresponding .bim file stream.
 
string _fileStub
 File name stub (minus the extension)
 
- Protected Attributes inherited from sampFiles::GbinFile
string _fileName
 File name.
 
size_t _nCols
 Number of elements in a row.
 
size_t _elemSize
 Size of each element in bytes.
 
- Protected Attributes inherited from sampFiles::VarFile
fstream _varFile
 Variant file stream.
 

Static Protected Attributes

static const vector< char > _masks = {static_cast<char>(0x03), static_cast<char>(0x0C), static_cast<char>(0x30), static_cast<char>(0xC0)}
 Genotype bit masks. More...
 
static const unordered_map< char, string > _tests
 Genotype bit tests. More...
 

Additional Inherited Members

- Protected Member Functions inherited from sampFiles::VarFile
 VarFile ()
 Default constructor (protected)
 

Detailed Description

BED file base class.

Sets up streams for the auxiliary files.

Constructor & Destructor Documentation

◆ BedFile()

BedFile::BedFile ( const string &  stubName)

File name constructor.

Parameters
[in]stubNamefile name minus the extension

Member Data Documentation

◆ _masks

const vector< char > BedFile::_masks = {static_cast<char>(0x03), static_cast<char>(0x0C), static_cast<char>(0x30), static_cast<char>(0xC0)}
staticprotected

Genotype bit masks.

Used to isolate each of the four genotypes (moving from the last bit pair) from the .bed two-bit genotype coding.

◆ _tests

const unordered_map< char, string > BedFile::_tests
staticprotected
Initial value:
= {
{'M', {static_cast<char>(0x01), static_cast<char>(0x04), static_cast<char>(0x10), static_cast<char>(0x40)}},
{'H', {static_cast<char>(0x02), static_cast<char>(0x08), static_cast<char>(0x20), static_cast<char>(0x80)}}
}

Genotype bit tests.

Used to test each of the four genotypes (moving from the last bit pair) from the .bed two-bit genotype coding for the possible states.


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