NCBI C++ ToolKit
|
Search Toolkit Book for CVCFVariantList
#include <gui/widgets/loaders/columnar_vcf_variants.hpp>
Public Member Functions | |
CVCFVariantList (const string &chr_name, bool load_all_info=true, const set< string > &info_fields=set< string >(), const map< unsigned, string > &sample_cols=map< unsigned, string >()) | |
CVCFVariantList (const string &chr_name, const vector< char > &data) | |
CVCFVariantList (const string &chr_name, const string &filename) | |
CVCFVariantList (const vector< char > &data, const string &data_version) | |
~CVCFVariantList () | |
void | ParseLine (const string &line) |
void | FinalizeReading () |
virtual bool | GetPositionsForVariant (const string &variant_id, vector< unsigned > &positions) |
virtual void | GetPositionsForMissingVarID (vector< unsigned > &positions) |
const string & | GetChrName () const |
const vector< char > & | GetSerializedData () const |
void | WriteSerializedData (const string &filename) |
bool | AreVariantIdsUnique (vector< pair< string, unsigned >> &copies) |
void | List (CNcbiOstream &out, bool only_sv_cols=false) const |
void | ListSamples (CNcbiOstream &out) const |
vector< string > | GetAllVariantIDS () const |
bool | operator== (const CVCFVariantList &other) const |
CVCFVariantList (const CVCFVariantList &)=delete | |
CVCFVariantList & | operator= (const CVCFVariantList &)=delete |
bool | SerializeVariantData (const string &prefix, CNcbiOstream *out=nullptr) |
bool | DeserializeAndCheck (const string &prefix, CNcbiOstream *out=nullptr) |
bool | RemoveSerializedOutput (const string &prefix) |
void | GetStatistics (CNcbiOstream &out) |
Public Member Functions inherited from CVCFVariantsBase | |
virtual | ~CVCFVariantsBase () |
const CVariantDescriptors & | GetDescriptors () const |
unsigned | GetPositionForIndex (const size_t &index) const |
size_t | GetIndexForPosition (const unsigned &pos, CPosToIndex::EType type) const |
TSeqPos | GetStart () const |
TSeqPos | GetStop () const |
unsigned | Count () const |
unsigned | Count (const TSeqRange &range) const |
void | GetHistogram (svector &hist, const svector::size_type &bin_width) const |
void | GetHistogram (TIndexVector &hist, const svector::size_type &bin_width) |
bool | operator== (const CVCFVariantsBase &other) const |
void | ListPositionVectors (CNcbiOstream &out) const |
TSeqPos | GetLeftShiftedStartPos (const TSeqRange &range) const |
const vector< size_t > * | GetIncludedItems () const |
unique_ptr< vector< size_t > > | Filter (const TSeqRange &range) const |
CVCFVariantsBase (const CVCFVariantsBase &)=delete | |
CVCFVariantsBase & | operator= (const CVCFVariantsBase &)=delete |
size_t | GetNumberOfIndexVecs () const |
const size_t & | GetMaxIndex () const |
const unsigned & | GetMaxFeatLength () const |
Public Member Functions inherited from CObject | |
CObject (void) | |
Constructor. More... | |
CObject (const CObject &src) | |
Copy constructor. More... | |
virtual | ~CObject (void) |
Destructor. More... | |
CObject & | operator= (const CObject &src) THROWS_NONE |
Assignment operator. More... | |
bool | CanBeDeleted (void) const THROWS_NONE |
Check if object can be deleted. More... | |
bool | IsAllocatedInPool (void) const THROWS_NONE |
Check if object is allocated in memory pool (not system heap) More... | |
bool | Referenced (void) const THROWS_NONE |
Check if object is referenced. More... | |
bool | ReferencedOnlyOnce (void) const THROWS_NONE |
Check if object is referenced only once. More... | |
void | AddReference (void) const |
Add reference to object. More... | |
void | RemoveReference (void) const |
Remove reference to object. More... | |
void | ReleaseReference (void) const |
Remove reference without deleting object. More... | |
virtual void | DoNotDeleteThisObject (void) |
Mark this object as not allocated in heap – do not delete this object. More... | |
virtual void | DoDeleteThisObject (void) |
Mark this object as allocated in heap – object can be deleted. More... | |
void * | operator new (size_t size) |
Define new operator for memory allocation. More... | |
void * | operator new[] (size_t size) |
Define new[] operator for 'array' memory allocation. More... | |
void | operator delete (void *ptr) |
Define delete operator for memory deallocation. More... | |
void | operator delete[] (void *ptr) |
Define delete[] operator for memory deallocation. More... | |
void * | operator new (size_t size, void *place) |
Define new operator. More... | |
void | operator delete (void *ptr, void *place) |
Define delete operator. More... | |
void * | operator new (size_t size, CObjectMemoryPool *place) |
Define new operator using memory pool. More... | |
void | operator delete (void *ptr, CObjectMemoryPool *place) |
Define delete operator. More... | |
virtual void | DebugDump (CDebugDumpContext ddc, unsigned int depth) const |
Define method for dumping debug information. More... | |
Public Member Functions inherited from CDebugDumpable | |
CDebugDumpable (void) | |
virtual | ~CDebugDumpable (void) |
void | DebugDumpText (ostream &out, const string &bundle, unsigned int depth) const |
void | DebugDumpFormat (CDebugDumpFormatter &ddf, const string &bundle, unsigned int depth) const |
void | DumpToConsole (void) const |
Private Member Functions | |
string | x_ParseNextColumn (string &line, size_t &pos) |
string | x_GetFilePrefix (const string &prefix) const |
Private Attributes | |
string | m_ChrName |
size_t | m_Index { 0 } |
Additional Inherited Members | |
Public Types inherited from CVCFVariantsBase | |
using | TSparseStrVector = CVariantDescriptors::TSparseStrVector |
using | TSparseOptVector = CVariantDescriptors::TSparseOptVector |
using | TIndexVector = CPosToIndex::TIndexVector |
using | svector = CPosToIndex::svector |
Public Types inherited from CObject | |
enum | EAllocFillMode { eAllocFillNone = 1 , eAllocFillZero , eAllocFillPattern } |
Control filling of newly allocated memory. More... | |
typedef CObjectCounterLocker | TLockerType |
Default locker type for CRef. More... | |
typedef atomic< Uint8 > | TCounter |
Counter type is CAtomiCounter. More... | |
typedef Uint8 | TCount |
Alias for value type of counter. More... | |
Static Public Member Functions inherited from CVCFVariantsBase | |
static const vector< string > & | s_GetColNames () |
does not contain sm_INFO and sm_SAMPLES More... | |
static const vector< string > & | s_GetAllColNames () |
contains sm_INFO, sm_SAMPLES More... | |
static string | s_GetPreviousVersion () |
static string | s_GetCurrentVersion (bool format_only=false) |
Static Public Member Functions inherited from CObject | |
static NCBI_XNCBI_EXPORT void | ThrowNullPointerException (void) |
Define method to throw null pointer exception. More... | |
static NCBI_XNCBI_EXPORT void | ThrowNullPointerException (const type_info &type) |
static EAllocFillMode | GetAllocFillMode (void) |
static void | SetAllocFillMode (EAllocFillMode mode) |
static void | SetAllocFillMode (const string &value) |
Set mode from configuration parameter value. More... | |
Static Public Member Functions inherited from CDebugDumpable | |
static void | EnableDebugDump (bool on) |
Static Public Attributes inherited from CVCFVariantsBase | |
static const string | sm_MissingValue = "." |
static const string | sm_ID = "ID" |
static const string | sm_REF = "REF" |
static const string | sm_ALT = "ALT" |
static const string | sm_QUAL = "QUAL" |
static const string | sm_FILTER = "FILTER" |
static const string | sm_INFO = "INFO" |
static const string | sm_FORMAT = "FORMAT" |
static const string | sm_SAMPLES = "SAMPLES" |
Static Public Attributes inherited from CObject | |
static const TCount | eCounterBitsCanBeDeleted = 1 << 0 |
Define possible object states. More... | |
static const TCount | eCounterBitsInPlainHeap = 1 << 1 |
Heap signature was found. More... | |
static const TCount | eCounterBitsPlaceMask |
Mask for 'in heap' state flags. More... | |
static const int | eCounterStep = 1 << 2 |
Skip over the "in heap" bits. More... | |
static const TCount | eCounterValid = TCount(1) << (sizeof(TCount) * 8 - 2) |
Minimal value for valid objects (reference counter is zero) Must be a single bit value. More... | |
static const TCount | eCounterStateMask |
Valid object, and object in heap. More... | |
Protected Member Functions inherited from CVCFVariantsBase | |
CVCFVariantsBase () | |
CVCFVariantsBase (bool load_info, const set< string > &info_fields, const map< unsigned, string > &sample_cols) | |
void | x_SerializeData () const |
void | x_DeserializeAllData () |
void | x_DeserializeIndexVectors (const unsigned char *&buf_ptr, size_t &nr_cols, bool skip_feat_length=false) |
void | x_DeserializeDescr_All (const unsigned char *buf_ptr, const size_t &nr_cols) |
void | x_DeserializeDescr_Range (const unsigned char *buf_ptr, const size_t &nr_cols, const TSeqRange *range=nullptr, const set< string > &cols_to_decode=set< string >(), bool only_start=false) |
bool | x_DeserializeColumn (const string &col_name, const unsigned char *buf_ptr, const size_t &nr_cols) |
unique_ptr< vector< size_t > > | x_Filter (const TSeqPos &pos) const |
Returns a vector of indices of the variants that cross sequence position 'pos'. More... | |
unique_ptr< vector< size_t > > | x_NullOrFilterClinVar (const TSeqPos &pos) const |
Protected Member Functions inherited from CObject | |
virtual void | DeleteThis (void) |
Virtual method "deleting" this object. More... | |
Protected Attributes inherited from CVCFVariantsBase | |
CVariantDescriptors | m_Descriptors |
CPosToIndex | m_Posindexmap |
TSeqPos | m_StartPos { 0 } |
in genomic coordinates (1-based) More... | |
TSeqPos | m_StopPos { 0 } |
in genomic coordinates (1-based) More... | |
unsigned | m_MaxFeatLength { 0 } |
maximum feature variant length More... | |
unique_ptr< vector< size_t > > | m_VarsWithinRange |
variants included within a specific range More... | |
vector< char > * | m_Buffer { nullptr } |
bm::sparse_vector_deserializer< TSparseStrVector > | m_Deserializer |
bm::sparse_vector_deserializer< TSparseOptVector > | m_OptDeserializer |
Definition at line 50 of file columnar_vcf_variants.hpp.
CVCFVariantList::CVCFVariantList | ( | const string & | chr_name, |
bool | load_all_info = true , |
||
const set< string > & | info_fields = set<string>() , |
||
const map< unsigned, string > & | sample_cols = map<unsigned, string>() |
||
) |
Definition at line 45 of file columnar_vcf_variants.cpp.
Definition at line 84 of file columnar_vcf_variants.cpp.
References data, CVCFVariantsBase::m_Buffer, m_Index, and CVCFVariantsBase::x_DeserializeAllData().
Definition at line 53 of file columnar_vcf_variants.cpp.
References _ASSERT, CFileIO::Close(), CFileIO_Base::eOpen, CFileIO_Base::eRead, CFileIO::GetFileSize(), CException::GetMsg(), CVCFVariantsBase::m_Buffer, m_Index, NCBI_THROW, CFileIO::Open(), CFileIO::Read(), total_size, and CVCFVariantsBase::x_DeserializeAllData().
Definition at line 92 of file columnar_vcf_variants.cpp.
References _ASSERT, bm::str_sparse_vector< CharType, BV, STR_SIZE >::begin(), CVCFVariantsBase::Count(), count, data, CVariantDescriptors::GetInfoField(), CPosToIndex::GetMaxIndex(), CVCFVariantsBase::GetNumberOfIndexVecs(), CPosToIndex::GetPositionForIndex(), Info(), LOG_POST, CVCFVariantsBase::m_Buffer, CVCFVariantsBase::m_Descriptors, CVCFVariantsBase::m_MaxFeatLength, CVCFVariantsBase::m_Posindexmap, CVCFVariantsBase::m_StartPos, CVCFVariantsBase::m_StopPos, max(), NCBI_THROW, CVCFVariantsBase::s_GetPreviousVersion(), CVCFVariantsBase::sm_ID, NStr::StringToUInt(), total_size, NStr::UIntToString(), dtl::version, CVCFVariantsBase::x_DeserializeColumn(), and CVCFVariantsBase::x_DeserializeIndexVectors().
CVCFVariantList::~CVCFVariantList | ( | ) |
Definition at line 176 of file columnar_vcf_variants.cpp.
References CVCFVariantsBase::m_Buffer.
|
delete |
Definition at line 307 of file columnar_vcf_variants.cpp.
References CVCFVariantsBase::m_Descriptors, CVCFVariantsBase::sm_ID, and tmp.
bool CVCFVariantList::DeserializeAndCheck | ( | const string & | prefix, |
CNcbiOstream * | out = nullptr |
||
) |
Definition at line 501 of file columnar_vcf_variants.cpp.
References NVcfUtil::DeserializeColumn(), CPosToIndex::DeserializeVectors(), CVariantDescriptors::GetInfoFieldNames(), CException::GetMsg(), CVariantDescriptors::GetSampleNames(), Info(), label, LOG_POST, m_ChrName, CVCFVariantsBase::m_Descriptors, CVCFVariantsBase::m_Posindexmap, out(), CVCFVariantsBase::s_GetColNames(), CVariantDescriptors::SetInfoField(), CVariantDescriptors::SetSample(), CException::what(), and x_GetFilePrefix().
void CVCFVariantList::FinalizeReading | ( | ) |
Definition at line 278 of file columnar_vcf_variants.cpp.
References _ASSERT, CVariantDescriptors::FinalizeReading(), CPosToIndex::FinalizeReading(), CVariantDescriptors::GetMaxFeatureLength(), CPosToIndex::GetPositionForIndex(), CVCFVariantsBase::m_Descriptors, m_Index, CVCFVariantsBase::m_MaxFeatLength, CVCFVariantsBase::m_Posindexmap, CVCFVariantsBase::m_StartPos, CVCFVariantsBase::m_StopPos, and CVCFVariantsBase::sm_ID.
vector< string > CVCFVariantList::GetAllVariantIDS | ( | ) | const |
Definition at line 416 of file columnar_vcf_variants.cpp.
Definition at line 73 of file columnar_vcf_variants.hpp.
References m_ChrName.
Referenced by CColumnarVCFReader::ReadData(), and CVcfLoadingJob::x_OnVCFVariantListReady().
|
virtual |
Implements CVCFVariantsBase.
Definition at line 333 of file columnar_vcf_variants.cpp.
References CVariantDescriptors::GetIndicesForMissingVarID(), CPosToIndex::Lookup(), CVCFVariantsBase::m_Descriptors, and CVCFVariantsBase::m_Posindexmap.
Referenced by GetPositionsForVariant().
|
virtual |
Implements CVCFVariantsBase.
Definition at line 342 of file columnar_vcf_variants.cpp.
References CVariantDescriptors::GetIndicesForVariant(), GetPositionsForMissingVarID(), CPosToIndex::Lookup(), CVCFVariantsBase::m_Descriptors, CVCFVariantsBase::m_Posindexmap, CVCFVariantsBase::sm_MissingValue, and ct::sort().
const vector< char > & CVCFVariantList::GetSerializedData | ( | ) | const |
Definition at line 359 of file columnar_vcf_variants.cpp.
References CVCFVariantsBase::m_Buffer, and CVCFVariantsBase::x_SerializeData().
Referenced by NVcfUtil::ConvertFromPreviousVCFModel(), and CVcfLoadingJob::x_CreateColumnarVCFProjectItem().
void CVCFVariantList::GetStatistics | ( | CNcbiOstream & | out | ) |
Definition at line 426 of file columnar_vcf_variants.cpp.
References NVcfUtil::AddStats(), BM_SCALAR_VERSION, CPosToIndex::GetStatistics(), Info(), LOG_POST, CVCFVariantsBase::m_Descriptors, CVCFVariantsBase::m_Posindexmap, out(), bm::print_svector_stat(), NVcfUtil::PrintStats(), bm::bv_statistics::reset(), and CVCFVariantsBase::s_GetColNames().
void CVCFVariantList::List | ( | CNcbiOstream & | out, |
bool | only_sv_cols = false |
||
) | const |
Definition at line 387 of file columnar_vcf_variants.cpp.
References out().
void CVCFVariantList::ListSamples | ( | CNcbiOstream & | out | ) | const |
Definition at line 400 of file columnar_vcf_variants.cpp.
References CVariantDescriptors::GetSampleNames(), CVCFVariantsBase::m_Descriptors, and out().
|
delete |
bool CVCFVariantList::operator== | ( | const CVCFVariantList & | other | ) | const |
Definition at line 377 of file columnar_vcf_variants.cpp.
References m_ChrName, CVCFVariantsBase::m_Descriptors, m_Index, CVCFVariantsBase::m_Posindexmap, CVCFVariantsBase::m_StartPos, and CVCFVariantsBase::m_StopPos.
Definition at line 185 of file columnar_vcf_variants.cpp.
References _ASSERT, CPosToIndex::Add(), CVariantDescriptors::AreInsertersReady(), NStr::fConvErr_NoThrow, CVariantDescriptors::InitInserters(), kEmptyStr, m_ChrName, CVCFVariantsBase::m_Descriptors, m_Index, CVCFVariantsBase::m_Posindexmap, CVCFVariantsBase::m_StopPos, n, NCBI_THROW, NPOS, CVariantDescriptors::PushBack(), CVariantDescriptors::PushBackPos(), CVCFVariantsBase::s_GetAllColNames(), CVariantDescriptors::SetIndex(), ct::sort(), NStr::Split(), NStr::StringToUInt(), NStr::TruncateSpacesInPlace(), rapidjson::value, and x_ParseNextColumn().
Definition at line 542 of file columnar_vcf_variants.cpp.
References NVcfUtil::GenerateColFileName(), CVariantDescriptors::GetInfoFieldNames(), CException::GetMsg(), CVariantDescriptors::GetSampleNames(), Info(), label, LOG_POST, CVCFVariantsBase::m_Descriptors, CVCFVariantsBase::m_Posindexmap, NVcfUtil::RemoveFile(), CPosToIndex::RemoveSerializedOutput(), CVCFVariantsBase::s_GetColNames(), CException::what(), and x_GetFilePrefix().
bool CVCFVariantList::SerializeVariantData | ( | const string & | prefix, |
CNcbiOstream * | out = nullptr |
||
) |
Definition at line 451 of file columnar_vcf_variants.cpp.
References CVariantDescriptors::GetInfoField(), CVariantDescriptors::GetInfoFieldNames(), CException::GetMsg(), CVariantDescriptors::GetSample(), CVariantDescriptors::GetSampleNames(), Info(), label, LOG_POST, m_ChrName, CVCFVariantsBase::m_Descriptors, CVCFVariantsBase::m_Posindexmap, out(), CVCFVariantsBase::s_GetColNames(), NVcfUtil::SerializeColumn(), CPosToIndex::SerializeVectors(), CException::what(), and x_GetFilePrefix().
Definition at line 367 of file columnar_vcf_variants.cpp.
References _ASSERT, CVCFVariantsBase::m_Buffer, NVcfUtil::PrintToFile(), and CVCFVariantsBase::x_SerializeData().
Definition at line 575 of file columnar_vcf_variants.cpp.
References m_ChrName.
Referenced by DeserializeAndCheck(), RemoveSerializedOutput(), and SerializeVariantData().
Definition at line 290 of file columnar_vcf_variants.cpp.
References NPOS, and CVCFVariantsBase::sm_MissingValue.
Referenced by ParseLine().
|
private |
Definition at line 105 of file columnar_vcf_variants.hpp.
Referenced by DeserializeAndCheck(), GetChrName(), operator==(), ParseLine(), SerializeVariantData(), and x_GetFilePrefix().
|
private |
Definition at line 106 of file columnar_vcf_variants.hpp.
Referenced by CVCFVariantList(), FinalizeReading(), operator==(), and ParseLine().