libStatGen Software 1
|
This class allows a user to easily get/set the fields in a GLF record. More...
#include <GlfRecord.h>
Public Member Functions | |
GlfRecord () | |
Constructor. | |
~GlfRecord () | |
Destructor. | |
void | reset () |
Clear this record back to the default setting. | |
bool | read (IFILE filePtr) |
Read the record from the specified file (file MUST be in the correct position for reading a record). | |
bool | write (IFILE filePtr) const |
Write the record to the specified file. | |
void | print () const |
Print the reference section in a readable format. | |
Generic Accessors for Record Types 1 & 2 | |
bool | setRtypeRef (uint8_t rtypeRef) |
Set the record type and reference base. | |
bool | setRecordType (uint8_t recType) |
Set the record type. | |
bool | setRefBaseInt (uint8_t refBase) |
Set the reference base from an integer value. | |
bool | setOffset (uint32_t offset) |
Set the offset from the precedent record. | |
bool | setMinDepth (uint32_t minDepth) |
Set the minimum likelihood and the read depth. | |
bool | setMinLk (uint8_t minLk) |
Set the minimum likelihood. | |
bool | setReadDepth (uint32_t readDepth) |
Set the the read depth. | |
bool | setRmsMapQ (uint8_t rmsMapQ) |
Set the RMS of mapping qualities of reads covering the site. | |
int | getRecordType () const |
Return the record type. | |
int | getRefBase () const |
Return the reference base as an integer. | |
char | getRefBaseChar () const |
Return the reference base as a character. | |
uint32_t | getOffset () const |
Return the offset from the precedent record. | |
uint32_t | getMinDepth () const |
Return the minimum likelihood and read depth. | |
uint8_t | getMinLk () const |
Return the minimum likelihood. | |
uint32_t | getReadDepth () const |
Return the read depth. | |
uint8_t | getRmsMapQ () const |
Return the RMS of mapping qualities of reads covering the site. | |
Record Type 1 Accessors | |
Record Type 1: Simple Likelihood Record | |
bool | setLk (int index, uint8_t value) |
Set the likelihood for the specified genotype. | |
uint8_t | getLk (int index) |
Get the likelihood for the specified genotype index. | |
Record Type 2 Accessors | |
Record Type2: Indel Likelihood Record | |
bool | setLkHom1 (uint8_t lk) |
Set the likelihood of the first homozygous indel allele. | |
bool | setLkHom2 (uint8_t lk) |
Set the likelihood of the 2nd homozygous indel allele. | |
bool | setLkHet (uint8_t lk) |
Set the likelihood of a heterozygote. | |
bool | setInsertionIndel1 (const std::string &indelSeq) |
Set the sequence of the first indel allele if the first indel is an insertion. | |
bool | setDeletionIndel1 (const std::string &indelSeq) |
Set the sequence of the first indel allele if the first indel is an deletion. | |
bool | setInsertionIndel2 (const std::string &indelSeq) |
Set the sequence of the 2nd indel allele if the 2nd indel is an insertion. | |
bool | setDeletionIndel2 (const std::string &indelSeq) |
Set the sequence of the 2nd indel allele if the 2nd indel is an deletion. | |
uint8_t | getLkHom1 () |
Return the likelihood of the 1st homozygous indel allele. | |
uint8_t | getLkHom2 () |
Return the likelihood of the 2nd homozygous indel allele. | |
uint8_t | getLkHet () |
Return the likelihood of a heterozygote. | |
int16_t | getIndel1 (std::string &indelSeq) |
Get the sequence and length (+:ins, -:del) of the 1st indel allele. | |
int16_t | getIndel2 (std::string &indelSeq) |
Get the sequence and length (+:ins, -:del) of the 2nd indel allele. | |
This class allows a user to easily get/set the fields in a GLF record.
Definition at line 28 of file GlfRecord.h.
GlfRecord::GlfRecord | ( | ) |
Constructor.
Definition at line 25 of file GlfRecord.cpp.
References reset().
GlfRecord::~GlfRecord | ( | ) |
int16_t GlfRecord::getIndel1 | ( | std::string & | indelSeq | ) |
Get the sequence and length (+:ins, -:del) of the 1st indel allele.
indelSeq | string to set with the sequence of the 1st indel allele |
Definition at line 453 of file GlfRecord.cpp.
References getRecordType(), and GlfStatus::UNKNOWN.
int16_t GlfRecord::getIndel2 | ( | std::string & | indelSeq | ) |
Get the sequence and length (+:ins, -:del) of the 2nd indel allele.
indelSeq | string to set with the sequence of the 2nd indel allele |
Definition at line 465 of file GlfRecord.cpp.
References getRecordType(), and GlfStatus::UNKNOWN.
uint8_t GlfRecord::getLk | ( | int | index | ) |
Get the likelihood for the specified genotype index.
Throws an exception if index is out of range.
index | index of the genotype for which the likelihood should be returned. See: GenotypeIndexTable |
Definition at line 355 of file GlfRecord.cpp.
References getRecordType(), and GlfStatus::UNKNOWN.
uint8_t GlfRecord::getLkHet | ( | ) |
Return the likelihood of a heterozygote.
Definition at line 442 of file GlfRecord.cpp.
References getRecordType(), and GlfStatus::UNKNOWN.
uint8_t GlfRecord::getLkHom1 | ( | ) |
Return the likelihood of the 1st homozygous indel allele.
Definition at line 420 of file GlfRecord.cpp.
References getRecordType(), and GlfStatus::UNKNOWN.
uint8_t GlfRecord::getLkHom2 | ( | ) |
Return the likelihood of the 2nd homozygous indel allele.
Definition at line 431 of file GlfRecord.cpp.
References getRecordType(), and GlfStatus::UNKNOWN.
uint32_t GlfRecord::getMinDepth | ( | ) | const |
Return the minimum likelihood and read depth.
Formatted as: min_lk<<24|read_dpeth. (min_lk capped at 255)
Definition at line 278 of file GlfRecord.cpp.
References getRecordType(), and GlfStatus::UNKNOWN.
uint8_t GlfRecord::getMinLk | ( | ) | const |
Return the minimum likelihood.
Definition at line 293 of file GlfRecord.cpp.
References getRecordType(), and GlfStatus::UNKNOWN.
uint32_t GlfRecord::getOffset | ( | ) | const |
Return the offset from the precedent record.
Definition at line 263 of file GlfRecord.cpp.
References getRecordType(), and GlfStatus::UNKNOWN.
uint32_t GlfRecord::getReadDepth | ( | ) | const |
Return the read depth.
Definition at line 308 of file GlfRecord.cpp.
References getRecordType(), and GlfStatus::UNKNOWN.
|
inline |
Return the record type.
Definition at line 126 of file GlfRecord.h.
Referenced by getIndel1(), getIndel2(), getLk(), getLkHet(), getLkHom1(), getLkHom2(), getMinDepth(), getMinLk(), GlfFile::getNextRecord(), getOffset(), getReadDepth(), getRmsMapQ(), print(), read(), write(), and GlfFile::writeRecord().
|
inline |
Return the reference base as an integer.
Definition at line 134 of file GlfRecord.h.
Referenced by print().
char GlfRecord::getRefBaseChar | ( | ) | const |
Return the reference base as a character.
Definition at line 251 of file GlfRecord.cpp.
Referenced by print().
uint8_t GlfRecord::getRmsMapQ | ( | ) | const |
Return the RMS of mapping qualities of reads covering the site.
Definition at line 323 of file GlfRecord.cpp.
References getRecordType(), and GlfStatus::UNKNOWN.
void GlfRecord::print | ( | ) | const |
Print the reference section in a readable format.
Definition at line 143 of file GlfRecord.cpp.
References getRecordType(), getRefBase(), and getRefBaseChar().
bool GlfRecord::read | ( | IFILE | filePtr | ) |
Read the record from the specified file (file MUST be in the correct position for reading a record).
filePtr | file to read from that is in the correct position. |
Definition at line 65 of file GlfRecord.cpp.
References GlfStatus::FAIL_IO, getRecordType(), ifread(), and GlfStatus::INVALID.
Referenced by GlfFile::getNextRecord().
void GlfRecord::reset | ( | ) |
Clear this record back to the default setting.
Definition at line 38 of file GlfRecord.cpp.
Referenced by GlfRecord(), and ~GlfRecord().
bool GlfRecord::setDeletionIndel1 | ( | const std::string & | indelSeq | ) |
Set the sequence of the first indel allele if the first indel is an deletion.
indelSeq | sequence of the first indel allele (deletion). |
Definition at line 399 of file GlfRecord.cpp.
bool GlfRecord::setDeletionIndel2 | ( | const std::string & | indelSeq | ) |
Set the sequence of the 2nd indel allele if the 2nd indel is an deletion.
indelSeq | sequence of the 2nd indel allele (deletion). |
Definition at line 413 of file GlfRecord.cpp.
bool GlfRecord::setInsertionIndel1 | ( | const std::string & | indelSeq | ) |
Set the sequence of the first indel allele if the first indel is an insertion.
indelSeq | sequence of the first indel allele (insertion). |
Definition at line 392 of file GlfRecord.cpp.
bool GlfRecord::setInsertionIndel2 | ( | const std::string & | indelSeq | ) |
Set the sequence of the 2nd indel allele if the 2nd indel is an insertion.
indelSeq | sequence of the 2nd indel allele (insertion). |
Definition at line 406 of file GlfRecord.cpp.
bool GlfRecord::setLk | ( | int | index, |
uint8_t | value | ||
) |
Set the likelihood for the specified genotype.
Throws an exception if index is out of range.
index | index for the genotype for which the likelihood is being set.
| ||||||||||||||||||||||
value | likelihood for the genotype at the specified index. |
Definition at line 340 of file GlfRecord.cpp.
References GlfStatus::UNKNOWN.
bool GlfRecord::setLkHet | ( | uint8_t | lk | ) |
Set the likelihood of a heterozygote.
lk | likelihood of a heterozygote (capped at 255) |
Definition at line 386 of file GlfRecord.cpp.
bool GlfRecord::setLkHom1 | ( | uint8_t | lk | ) |
Set the likelihood of the first homozygous indel allele.
lk | likelihood of the 1st homozygous indel allele (capped at 255) |
Definition at line 374 of file GlfRecord.cpp.
bool GlfRecord::setLkHom2 | ( | uint8_t | lk | ) |
Set the likelihood of the 2nd homozygous indel allele.
lk | likelihood of the 2nd homozygous indel allele (capped at 255) |
Definition at line 380 of file GlfRecord.cpp.
bool GlfRecord::setMinDepth | ( | uint32_t | minDepth | ) |
Set the minimum likelihood and the read depth.
minDepth | minimum likelihood and read depth. Formatted as: min_lk<<24|read_dpeth. (min_lk capped at 255) |
Definition at line 222 of file GlfRecord.cpp.
Referenced by setMinLk(), and setReadDepth().
bool GlfRecord::setMinLk | ( | uint8_t | minLk | ) |
Set the minimum likelihood.
minLk | minimum likelihood (capped at 255). |
Definition at line 229 of file GlfRecord.cpp.
References setMinDepth().
bool GlfRecord::setOffset | ( | uint32_t | offset | ) |
Set the offset from the precedent record.
0-based coordinate of the record minus the coordinate of the precedent record. For the first record in a reference sequence, the previous coordinate is 0. For insertions between x & x+1, the coordinate is x. For deletions between x & y, the coordinate is x.
offset | offset from the precedent record. |
Definition at line 215 of file GlfRecord.cpp.
bool GlfRecord::setReadDepth | ( | uint32_t | readDepth | ) |
Set the the read depth.
readDepth | read depth. |
Definition at line 236 of file GlfRecord.cpp.
References setMinDepth().
bool GlfRecord::setRecordType | ( | uint8_t | recType | ) |
Set the record type.
recType | record type: 1 - simple likelihood record, 2 - indel likelihood record, 0 - end maker |
Definition at line 194 of file GlfRecord.cpp.
bool GlfRecord::setRefBaseInt | ( | uint8_t | refBase | ) |
Set the reference base from an integer value.
refBase | integer representation of the reference base.
|
Definition at line 201 of file GlfRecord.cpp.
bool GlfRecord::setRmsMapQ | ( | uint8_t | rmsMapQ | ) |
Set the RMS of mapping qualities of reads covering the site.
rmsMapQ | RMS of mapping qualities |
Definition at line 243 of file GlfRecord.cpp.
bool GlfRecord::setRtypeRef | ( | uint8_t | rtypeRef | ) |
Set the record type and reference base.
rtypeRef | record type & reference base. Formatted as: record_type<<4|numeric_ref_base. |
Definition at line 188 of file GlfRecord.cpp.
bool GlfRecord::write | ( | IFILE | filePtr | ) | const |
Write the record to the specified file.
filePtr | file to write to that is in the correct position. |
Definition at line 113 of file GlfRecord.cpp.
References getRecordType(), and GlfStatus::INVALID.
Referenced by GlfFile::writeRecord().
int16_t GlfRecord::indelLen1 |
Definition at line 317 of file GlfRecord.h.
int16_t GlfRecord::indelLen2 |
Definition at line 318 of file GlfRecord.h.
uint8_t GlfRecord::lk[GlfRecord::NUM_REC1_LIKELIHOOD] |
Definition at line 304 of file GlfRecord.h.
uint8_t GlfRecord::lkHet |
Definition at line 316 of file GlfRecord.h.
uint8_t GlfRecord::lkHom1 |
Definition at line 314 of file GlfRecord.h.
uint8_t GlfRecord::lkHom2 |
Definition at line 315 of file GlfRecord.h.
uint32_t GlfRecord::min_depth |
Definition at line 302 of file GlfRecord.h.
uint32_t GlfRecord::offset |
Definition at line 301 of file GlfRecord.h.
uint8_t GlfRecord::rmsMapQ |
Definition at line 303 of file GlfRecord.h.