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). More... | |
bool | write (IFILE filePtr) const |
Write the record to the specified file. More... | |
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. More... | |
bool | setRecordType (uint8_t recType) |
Set the record type. More... | |
bool | setRefBaseInt (uint8_t refBase) |
Set the reference base from an integer value. More... | |
bool | setOffset (uint32_t offset) |
Set the offset from the precedent record. More... | |
bool | setMinDepth (uint32_t minDepth) |
Set the minimum likelihood and the read depth. More... | |
bool | setMinLk (uint8_t minLk) |
Set the minimum likelihood. More... | |
bool | setReadDepth (uint32_t readDepth) |
Set the the read depth. More... | |
bool | setRmsMapQ (uint8_t rmsMapQ) |
Set the RMS of mapping qualities of reads covering the site. More... | |
int | getRecordType () const |
Return the record type. More... | |
int | getRefBase () const |
Return the reference base as an integer. More... | |
char | getRefBaseChar () const |
Return the reference base as a character. More... | |
uint32_t | getOffset () const |
Return the offset from the precedent record. More... | |
uint32_t | getMinDepth () const |
Return the minimum likelihood and read depth. More... | |
uint8_t | getMinLk () const |
Return the minimum likelihood. More... | |
uint32_t | getReadDepth () const |
Return the read depth. More... | |
uint8_t | getRmsMapQ () const |
Return the RMS of mapping qualities of reads covering the site. More... | |
Record Type 1 Accessors | |
Record Type 1: Simple Likelihood Record | |
bool | setLk (int index, uint8_t value) |
Set the likelihood for the specified genotype. More... | |
uint8_t | getLk (int index) |
Get the likelihood for the specified genotype index. More... | |
Record Type 2 Accessors | |
Record Type2: Indel Likelihood Record | |
bool | setLkHom1 (uint8_t lk) |
Set the likelihood of the first homozygous indel allele. More... | |
bool | setLkHom2 (uint8_t lk) |
Set the likelihood of the 2nd homozygous indel allele. More... | |
bool | setLkHet (uint8_t lk) |
Set the likelihood of a heterozygote. More... | |
bool | setInsertionIndel1 (const std::string &indelSeq) |
Set the sequence of the first indel allele if the first indel is an insertion. More... | |
bool | setDeletionIndel1 (const std::string &indelSeq) |
Set the sequence of the first indel allele if the first indel is an deletion. More... | |
bool | setInsertionIndel2 (const std::string &indelSeq) |
Set the sequence of the 2nd indel allele if the 2nd indel is an insertion. More... | |
bool | setDeletionIndel2 (const std::string &indelSeq) |
Set the sequence of the 2nd indel allele if the 2nd indel is an deletion. More... | |
uint8_t | getLkHom1 () |
Return the likelihood of the 1st homozygous indel allele. More... | |
uint8_t | getLkHom2 () |
Return the likelihood of the 2nd homozygous indel allele. More... | |
uint8_t | getLkHet () |
Return the likelihood of a heterozygote. More... | |
int16_t | getIndel1 (std::string &indelSeq) |
Get the sequence and length (+:ins, -:del) of the 1st indel allele. More... | |
int16_t | getIndel2 (std::string &indelSeq) |
Get the sequence and length (+:ins, -:del) of the 2nd indel allele. More... | |
This class allows a user to easily get/set the fields in a GLF record.
Definition at line 28 of file GlfRecord.h.
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.
Referenced by getRefBase().
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 GlfStatus::FAIL_IO, getRecordType(), ifread(), ifwrite(), and GlfStatus::UNKNOWN.
Referenced by getRefBase().
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.
Referenced by getRefBase().
uint8_t GlfRecord::getLkHet | ( | ) |
Return the likelihood of a heterozygote.
Definition at line 442 of file GlfRecord.cpp.
References getRecordType(), and GlfStatus::UNKNOWN.
Referenced by getRefBase().
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.
Referenced by getRefBase().
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.
Referenced by getRefBase().
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.
Referenced by getRefBase().
uint8_t GlfRecord::getMinLk | ( | ) | const |
Return the minimum likelihood.
Definition at line 293 of file GlfRecord.cpp.
References getRecordType(), and GlfStatus::UNKNOWN.
Referenced by getRefBase().
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.
Referenced by getRefBase().
uint32_t GlfRecord::getReadDepth | ( | ) | const |
Return the read depth.
Definition at line 308 of file GlfRecord.cpp.
References getRecordType(), and GlfStatus::UNKNOWN.
Referenced by getRefBase().
|
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.
References getIndel1(), getIndel2(), getLk(), getLkHet(), getLkHom1(), getLkHom2(), getMinDepth(), getMinLk(), getOffset(), getReadDepth(), getRefBaseChar(), getRmsMapQ(), setDeletionIndel1(), setDeletionIndel2(), setInsertionIndel1(), setInsertionIndel2(), setLk(), setLkHet(), setLkHom1(), and setLkHom2().
Referenced by print().
char GlfRecord::getRefBaseChar | ( | ) | const |
Return the reference base as a character.
Definition at line 251 of file GlfRecord.cpp.
Referenced by getRefBase(), and 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.
Referenced by getRefBase().
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().
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.
Referenced by getRefBase().
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.
Referenced by getRefBase().
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.
Referenced by getRefBase().
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.
Referenced by getRefBase().
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.
Referenced by getRefBase().
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.
Referenced by getRefBase().
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.
Referenced by getRefBase().
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.
Referenced by getRefBase().
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().