A class that corresponds to a single locus in a Complete Genomics variant file. More...
#include <Locus.hpp>
Public Member Functions | |
Locus () | |
Construct a dummy locus (for use with std::vector, for example). | |
Locus (const CrrFile &crr) | |
Construct an empty locus. | |
Locus (const Locus &other) | |
Copy and assignment must be overridden because Allele has a pointer to this. | |
Locus & | operator= (const Locus &other) |
Copy and assignment must be overridden because Allele has a pointer to this. | |
const std::vector< Call > & | getCalls () const |
Retrieve the calls for this locus, in order as found in the variant file. | |
std::vector< Call > & | getCalls () |
Retrieve the calls for this locus, in order as found in the variant file. | |
const std::vector< Allele > & | getAlleles () const |
Retrieve the alleles for this locus, in order by haplotype. | |
const Range & | getRange () const |
Get the reference range for this locus. | |
void | setRange (const Range &range) |
Set range, only for loci with one call. | |
const CrrFile & | getReference () const |
Get the reference crr file associated with this locus. | |
boost::uint32_t | getId () const |
Get the locus id (locus column in the variant file). | |
void | setId (boost::uint32_t locusId) |
Set the locus id (locus column in the variant file). | |
boost::uint16_t | getPloidy () const |
Get the ploidy of this locus. | |
void | setHapLink (size_t alleleOffset, const std::string &hapLink) |
Update all the hapLinks for the given allele of this locus. | |
bool | isRefCallLocus () const |
Returns true iff this locus is a one-call reference-called locus. | |
bool | isNoCallLocus () const |
Returns true iff this locus is a one-call no-called locus. | |
bool | isRefConsistent () const |
Returns true iff each call in this locus is consistent with the reference. | |
bool | hasNoCalls () const |
Returns true iff this locus has one or more calls whose sequence contains N or ? characters. | |
void | clearCalls () |
Clears the set of calls for this locus. | |
void | addCall (const Call &call) |
Adds a call to the locus. | |
void | initFromCalls (bool relaxedReferenceValidation=true) |
After adding calls by Locus::addCall(), this function must be called to prepare the Locus for use. | |
void | locationCalls (const Location &loc, std::vector< std::pair< char, const Call * > > &calls) const |
Returns in the calls parameter the bases called by this locus at the specified location (or - or ., in accordance with snpdiff interpretation of those values), as well as the Call used to determine each base call. | |
std::string | getType () const |
Returns locus type, as specified for simplified variation files. | |
std::string | getZygosity () const |
Returns locus zygosity, as specified for simplified variation files. | |
void | reorderAlleles () |
Changes the allele order to the one specified for simplified variation files (i.e. | |
void | writeAsOneLine (std::ostream &out, bool writeExtras=true, char sep= '\t') const |
Writes this locus to the stream in the format specified for simplified one-line-per-locus variation files. | |
Static Public Member Functions | |
static void | writeOneLineFileHeader (std::ostream &out, char sep= '\t') |
Public Attributes | |
std::vector< std::string > | extras_ |
Additional annotation columns. |
A class that corresponds to a single locus in a Complete Genomics variant file.
cgatools::variants::Locus::Locus | ( | const CrrFile & | crr | ) | [inline] |
Construct an empty locus.
The Locus cannot be used until its calls have been added by Locus::addCall() and it has been initialized by Locus::initFromCalls().
cgatools::variants::Locus::Locus | ( | const Locus & | other | ) |
Copy and assignment must be overridden because Allele has a pointer to this.
std::vector<Call>& cgatools::variants::Locus::getCalls | ( | ) | [inline] |
Retrieve the calls for this locus, in order as found in the variant file.
const std::vector<Call>& cgatools::variants::Locus::getCalls | ( | ) | const [inline] |
Retrieve the calls for this locus, in order as found in the variant file.
bool cgatools::variants::Locus::hasNoCalls | ( | ) | const |
Returns true iff this locus has one or more calls whose sequence contains N or ? characters.
void cgatools::variants::Locus::initFromCalls | ( | bool | relaxedReferenceValidation = true |
) |
After adding calls by Locus::addCall(), this function must be called to prepare the Locus for use.
bool cgatools::variants::Locus::isRefCallLocus | ( | ) | const |
Returns true iff this locus is a one-call reference-called locus.
bool cgatools::variants::Locus::isRefConsistent | ( | ) | const |
Returns true iff each call in this locus is consistent with the reference.
void cgatools::variants::Locus::locationCalls | ( | const Location & | loc, | |
std::vector< std::pair< char, const Call * > > & | calls | |||
) | const |
Returns in the calls parameter the bases called by this locus at the specified location (or - or ., in accordance with snpdiff interpretation of those values), as well as the Call used to determine each base call.
Copy and assignment must be overridden because Allele has a pointer to this.
void cgatools::variants::Locus::reorderAlleles | ( | ) |
Changes the allele order to the one specified for simplified variation files (i.e.
"more interesting allele first").
void cgatools::variants::Locus::setId | ( | boost::uint32_t | locusId | ) |
Set the locus id (locus column in the variant file).
This updates all calls in the locus.
void cgatools::variants::Locus::writeAsOneLine | ( | std::ostream & | out, | |
bool | writeExtras = true , |
|||
char | sep = '\t' | |||
) | const |
Writes this locus to the stream in the format specified for simplified one-line-per-locus variation files.