ProteoWizard
|
A class for reading demux matrices from file. More...
#include <DemuxDebugReader.hpp>
Public Member Functions | |
DemuxDebugReader (const std::string &fileName) | |
Constructs a DemuxDebugReader to read the debug file with the given filename. More... | |
~DemuxDebugReader () | |
Destructor closes the file. More... | |
size_t | NumBlocks () const |
Number of blocks (sets of matrices) that are contained in the file. More... | |
void | ReadDeconvBlock (uint64_t &spectrumIndex, DemuxTypes::MatrixPtr masks, DemuxTypes::MatrixPtr solution, DemuxTypes::MatrixPtr signal) |
Can be used to read through the blocks sequntially. More... | |
void | ReadDeconvBlock (size_t blockIndex, uint64_t &spectrumIndex, DemuxTypes::MatrixPtr masks, DemuxTypes::MatrixPtr solution, DemuxTypes::MatrixPtr signal) |
Used for random-access reading of the blocks. More... | |
bool | IsOpen () const |
Should be called after construction to verify that the file was opened successfully. More... | |
Private Member Functions | |
void | ReadHeader () |
Reads the header/footer which contains information about the number of blocks and their locations in the file for random access. More... | |
Private Attributes | |
std::ifstream | _reader |
Input file stream of the debug file. More... | |
std::vector< std::pair< uint64_t, int64_t > > | _fileIndex |
Set of pointers to blocks in the file extracted from the header/footer information. More... | |
size_t | _currentBlockIndex |
Current block index used for tracking progress through file when sequential iteration of ReadDeconvBlock() is used. More... | |
A class for reading demux matrices from file.
The primary purpose of writing demux matrices to file is for analysis externally, so the intent of this class is to provide a method to test the output of the DemuxDebugWriter class. This class follows the RAII of ifstream and so the file is kept open until the destructor is called.
Definition at line 37 of file DemuxDebugReader.hpp.
|
explicit |
Constructs a DemuxDebugReader to read the debug file with the given filename.
During construction the file header is read to inform the NumBlocks() function of the filesize and to build a map of pointers to the matrix blocks for random access.
fileName | Filename of debug matrices file |
pwiz::analysis::DemuxDebugReader::~DemuxDebugReader | ( | ) |
Destructor closes the file.
size_t pwiz::analysis::DemuxDebugReader::NumBlocks | ( | ) | const |
Number of blocks (sets of matrices) that are contained in the file.
This is the number of times that ReadDeconvBlock can be called sequentially. Throws error if IsOpen() returns false.
Referenced by DemuxDebugRWTest::ReadWriteTest().
void pwiz::analysis::DemuxDebugReader::ReadDeconvBlock | ( | uint64_t & | spectrumIndex, |
DemuxTypes::MatrixPtr | masks, | ||
DemuxTypes::MatrixPtr | solution, | ||
DemuxTypes::MatrixPtr | signal | ||
) |
Can be used to read through the blocks sequntially.
Each time this is called the next set of blocks is returned. This can be called NumBlocks() times before an out_of_range error will be thrown. Throws error if IsOpen() returns false.
[out] | spectrumIndex | The index of the spectrum corresponding to this block |
[out] | masks | The masks matrix |
[out] | solution | The solution matrix |
[out] | signal | The signal matrix |
Referenced by DemuxDebugRWTest::ReadWriteTest().
void pwiz::analysis::DemuxDebugReader::ReadDeconvBlock | ( | size_t | blockIndex, |
uint64_t & | spectrumIndex, | ||
DemuxTypes::MatrixPtr | masks, | ||
DemuxTypes::MatrixPtr | solution, | ||
DemuxTypes::MatrixPtr | signal | ||
) |
Used for random-access reading of the blocks.
The block indices range from 0 to NumBlocks() - 1. Throws error if IsOpen() returns false.
[in] | blockIndex | index of the block to read |
[out] | spectrumIndex | The index of the spectrum corresponding to this block |
[out] | masks | The masks matrix |
[out] | solution | The solution matrix |
[out] | signal | The signal matrix |
bool pwiz::analysis::DemuxDebugReader::IsOpen | ( | ) | const |
Should be called after construction to verify that the file was opened successfully.
Referenced by DemuxDebugRWTest::ReadWriteTest().
|
private |
Reads the header/footer which contains information about the number of blocks and their locations in the file for random access.
|
private |
Input file stream of the debug file.
Definition at line 88 of file DemuxDebugReader.hpp.
|
private |
Set of pointers to blocks in the file extracted from the header/footer information.
Definition at line 91 of file DemuxDebugReader.hpp.
|
private |
Current block index used for tracking progress through file when sequential iteration of ReadDeconvBlock() is used.
Definition at line 94 of file DemuxDebugReader.hpp.