& strGff )
90 "Mandatory attribute ID missing.");
99 "Mandatory attribute Reference_seq and/or Variant_seq missing.");
107 const string& strGffType,
108 const string& strRawAttributes )
113 for(
size_tu=0; u <
attributes.size(); ++u ) {
124 if( strKey.empty() && strValue.empty() ) {
130 if( strKey ==
"Dbxref") {
154 const string& title,
194 for(
const auto& lineData: readerData) {
195 const auto& line = lineData.mData;
260annot.
SetData().SetFtable().push_back( pFeature );
287pLocation->
SetInt().SetId(*pId);
296list<string> range_borders;
301 if( range_borders.size() != 2 ) {
305 "Bad Start_range attribute: Start_range="+ strRange +
".");
309 if( range_borders.back() ==
".") {
313 else if( range_borders.front() ==
".") {
320pLocation->
SetInt().SetFuzz_from().SetRange().SetMin( lower-1 );
321pLocation->
SetInt().SetFuzz_from().SetRange().SetMax( upper-1 );
324 catch( std::exception& ) {
328 "Bad Start_range attribute: Start_range="+ strRange +
".");
334range_borders.clear();
338 if( range_borders.size() != 2 ) {
342 "Bad End_range attribute: End_range="+ strRange +
".");
346 if( range_borders.back() ==
".") {
350 else if( range_borders.front() ==
".") {
357pLocation->
SetInt().SetFuzz_to().SetRange().SetMin( lower-1 );
358pLocation->
SetInt().SetFuzz_to().SetRange().SetMax( upper-1 );
361 catch(std::exception&) {
365 "Bad End_range attribute: End_range="+ strRange +
".");
382pLocation->
SetPnt().SetId(*pId);
383 if(record.
Type() ==
"insertion") {
394 stringstrRangeLower, strRangeUpper;
395 boolhasLower = record.
GetAttribute(
"Start_range", strRangeLower);
396 boolhasUpper = record.
GetAttribute(
"End_range", strRangeUpper);
397 if(hasLower && hasUpper && strRangeLower != strRangeUpper) {
401 "Bad range attribute: Conflicting fuzz ranges for single point location.");
404 if(!hasLower && !hasUpper) {
409strRangeLower = strRangeUpper;
415 if(
bounds.size() != 2) {
419 "Bad range attribute: XXX_range="+ strRangeLower +
".");
423 if(
bounds.back() ==
".") {
427 else if(
bounds.front() ==
".") {
434pLocation->
SetPnt().SetFuzz().SetRange().SetMin(lower-1);
435pLocation->
SetPnt().SetFuzz().SetRange().SetMax(upper-1);
438 catch(std::exception&) {
442 "Bad range attribute: XXX_range="+ strRangeLower +
".");
453 return(nameAttr.find(
"ssv") != string::npos);
460 if( record.GetAttribute(
"Name", name ) ) {
480 if( strType ==
"snv") {
485 else if(strType ==
"insertion"||
486strType ==
"alu_insertion"||
487strType ==
"line1_insertion"||
488strType ==
"sva_insertion"||
489strType ==
"mobile_element_insertion"||
490strType ==
"mobile_sequence_insertion"||
491strType ==
"novel_sequence_insertion") {
496 else if(strType ==
"deletion"||
497strType ==
"alu_deletion"||
498strType ==
"line1_deletion"||
499strType ==
"sva_deletion"||
500strType ==
"herv_deletion"||
501(strType ==
"mobile_element_deletion"&&
507 else if(strType ==
"indel") {
512 else if(strType ==
"inversion") {
518 else if(strType ==
"tandem_duplication") {
523 else if(strType ==
"translocation"||
524strType ==
"interchromosomal_translocation"||
525strType ==
"intrachromosomal_translocation") {
531 else if(strType ==
"complex"||
532strType ==
"complex_substitution"||
533strType ==
"complex_chromosomal_rearrangement"||
534strType ==
"complex_sequence_alteration") {
539 else if(strType ==
"unknown"||
540strType ==
"other"||
541strType ==
"sequence_alteration") {
552feature.
SetData().SetVariation( *pVariation );
584pReference->SetData().SetInstance().SetType(
587pDelta->SetSeq().SetThis();
588pReference->SetData().SetInstance().SetDelta().push_back(pDelta);
589pReference->SetData().SetInstance().SetObservation(
591 variation.SetData().SetSet().SetVariations().push_back(
595 if( record.
GetAttribute(
"Variant_seq", strAlleles ) ) {
596list<string> alleles;
600 for( list<string>::const_iterator cit = alleles.begin();
601cit != alleles.end(); ++cit )
604 if(allele ==
"-") {
605pReference->SetVariant_prop().SetAllele_state(
606(alleles.size() == 1) ?
609pReference->SetData().SetInstance().SetObservation(
618 if(alleles.size() == 1) {
619pAllele->SetVariant_prop().SetAllele_state(
623pAllele->SetVariant_prop().SetAllele_state(
628pDelta->SetSeq().SetLiteral().SetLength(
629 static_cast<TSeqPos>(allele.size()));
630pDelta->SetSeq().SetLiteral().SetSeq_data().SetIupacna().Set(allele);
632pAllele->SetData().SetInstance().SetDelta().push_back(pDelta);
634pAllele->SetData().SetInstance().SetObservation(
637 variation.SetData().SetSet().SetVariations().push_back(
665 if( strType ==
"cnv"||
666strType ==
"copy_number_variation") {
670 if( strType ==
"gain"||
671strType ==
"copy_number_gain"||
672strType ==
"duplication") {
676 if( strType ==
"loss"||
677strType ==
"copy_number_loss"||
678(strType ==
"mobile_element_deletion"&& !
xIsDbvarCall(nameAttr)) ) {
682 if( strType ==
"loss_of_heterozygosity") {
686pConsequence->SetLoss_of_heterozygosity();
687 variation.SetConsequence().push_back( pConsequence );
694 "Bad data line: Unknown type \""+ strType +
"\".");
706CVariation_ref::C_Data::C_Set::eData_set_type_package );
868 variation.SetId().SetTag().SetStr(
id);
882 variation.SetParent_id().SetTag().SetStr(
id);
910 if( record.
GetAttribute(
"Genotype", strGenotype ) ) {
913 variation.SetVariant_prop().SetAllele_state( it->second );
916 variation.SetVariant_prop().SetAllele_state(
921 if( record.
GetAttribute(
"validated", strValidated ) ) {
922 if( strValidated ==
"1") {
923 variation.SetVariant_prop().SetOther_validation(
true);
925 if( strValidated ==
"0") {
926 variation.SetVariant_prop().SetOther_validation(
false);
940 if(!record.
GetAttribute(
"Reference_seq", strReference)) {
943pReference->SetData().SetInstance().SetType(
946pDelta->SetSeq().SetLiteral().SetLength(
947 static_cast<TSeqPos>(strReference.size()));
948pDelta->SetSeq().SetLiteral().SetSeq_data().SetIupacna().Set(
950pReference->SetData().SetInstance().SetDelta().push_back(pDelta);
951pReference->SetData().SetInstance().SetObservation(
953 variation.SetData().SetSet().SetVariations().push_back(
957 if(!record.
GetAttribute(
"Variant_seq", strAlleles)) {
960list<string> alleles;
964 for( list<string>::const_iterator cit = alleles.begin();
965cit != alleles.end(); ++cit )
968 if(allele == strReference) {
969pReference->SetVariant_prop().SetAllele_state(
970(alleles.size() == 1) ?
973pReference->SetData().SetInstance().SetObservation(
979pAllele->SetVariant_prop().SetAllele_state(
980(alleles.size() == 1) ?
984pDelta->SetSeq().SetThis();
986pAllele->SetData().SetInstance().SetDelta().push_back(pDelta);
989pAllele->SetData().SetInstance().SetObservation(
992 variation.SetData().SetSet().SetVariations().push_back(
1004 stringstrReference;
1006 if(record.
GetAttribute(
"Reference_seq", strReference)) {
1007pReference->SetData().SetInstance().SetType(
1010pDelta->SetSeq().SetLiteral().SetLength(
1011 static_cast<TSeqPos>(strReference.size()));
1012pDelta->SetSeq().SetLiteral().SetSeq_data().SetIupacna().Set(
1014pReference->SetData().SetInstance().SetDelta().push_back(pDelta);
1015pReference->SetData().SetInstance().SetObservation(
1017 variation.SetData().SetSet().SetVariations().push_back(
1022 if( record.
GetAttribute(
"Variant_seq", strAlleles ) ) {
1023list<string> alleles;
1027 for( list<string>::const_iterator cit = alleles.begin();
1028cit != alleles.end(); ++cit )
1030 stringallele(*cit);
1032 if(allele == strReference) {
1033pReference->SetVariant_prop().SetAllele_state(
1034(alleles.size() == 1) ?
1037pReference->SetData().SetInstance().SetObservation(
1042 if(alleles.size() == 1) {
1043pAllele->SetVariant_prop().SetAllele_state(
1047pAllele->SetVariant_prop().SetAllele_state(
1050vector<string> replaces;
1051replaces.push_back(*cit);
1053pAllele->SetData().SetInstance().SetObservation(
1055pAllele->SetData().SetInstance().SetType(
1057 variation.SetData().SetSet().SetVariations().push_back(
1071 stringstrAttribute;
1074ext.
SetType().SetStr(
"GvfAttributes");
1077 if( record.
Source() !=
".") {
1087 if( cit->first ==
"Start_range") {
1090 if( cit->first ==
"End_range") {
1093 if( cit->first ==
"validated") {
1097 stringstrAttribute;
1098 if( ! record.
GetAttribute( cit->first, strAttribute ) ) {
1102 "Suspicious data line: Funny attribute \""+ cit->first +
"\".");
1106 if( cit->first ==
"ID") {
1107ext.
AddField(
"id", strAttribute );
1110 if( cit->first ==
"Parent") {
1111ext.
AddField(
"parent", strAttribute );
1114 if( cit->first ==
"Variant_reads") {
1115ext.
AddField(
"variant-reads", strAttribute );
1118 if( cit->first ==
"Variant_effect") {
1119ext.
AddField(
"variant-effect", strAttribute );
1122 if( cit->first ==
"Total_reads") {
1123ext.
AddField(
"total-reads", strAttribute );
1126 if( cit->first ==
"Variant_copy_number") {
1127ext.
AddField(
"variant-copy-number", strAttribute );
1130 if( cit->first ==
"Reference_copy_number") {
1131ext.
AddField(
"reference-copy-number", strAttribute );
1134 if( cit->first ==
"Phased") {
1135ext.
AddField(
"phased", strAttribute );
1138 if( cit->first ==
"Name") {
1139ext.
AddField(
"name", strAttribute );
1142ext.
AddField(
string(
"custom-") + cit->first, strAttribute );
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
virtual bool xParseStructuredComment(const CTempString &)
virtual void xAssignAnnotId(CSeq_annot &, const CTempString={})
unsigned int mCurrentFeatureCount
TAttributes::const_iterator TAttrCit
static string xNormalizedAttributeValue(const CTempString &)
TAttributes::iterator TAttrIt
bool GetAttribute(const string &, string &) const
const TAttributes & Attributes() const
bool xSplitGffAttributes(const string &, vector< string > &) const
string x_NormalizedAttributeKey(const string &)
bool AssignFromGff(const string &) override
const string & Source() const
const string & Type() const
ENa_strand Strand() const
const string & Id() const
const string & NormalizedType() const
bool AssignFromGff(const string &) override
bool xAssignAttributesFromGff(const string &, const string &) override
void xProcessData(const TReaderData &, CSeq_annot &) override
bool xVariationMakeEversions(const CGvfReadRecord &, CVariation_ref &)
CRef< CAnnotdesc > m_Pragmas
bool xVariationMakeComplex(const CGvfReadRecord &, CVariation_ref &)
bool xParseStructuredComment(const CTempString &) override
bool xVariationSetInsertions(const CGvfReadRecord &, CVariation_ref &)
bool xVariationMakeCNV(const CGvfReadRecord &, CVariation_ref &)
bool xVariationMakeUnknown(const CGvfReadRecord &, CVariation_ref &)
bool xIsDbvarCall(const string &nameAttr) const
bool xGetNameAttribute(const CGvfReadRecord &record, string &name) const
bool xVariationMakeSNV(const CGvfReadRecord &, CVariation_ref &)
CGvfReader(TReaderFlags uFlags, const string &name="", const string &title="", CReaderListener *=nullptr)
virtual bool xMergeRecord(const CGvfReadRecord &, CSeq_annot &, ILineErrorListener *)
void xGetData(ILineReader &, TReaderData &) override
virtual bool xVariationSetName(const CGvfReadRecord &, CVariation_ref &)
bool xFeatureSetVariation(const CGvfReadRecord &, CSeq_feat &)
bool xParseFeature(const CTempString &, CSeq_annot &, ILineErrorListener *) override
bool xVariationMakeTranslocations(const CGvfReadRecord &, CVariation_ref &)
bool xVariationMakeDeletions(const CGvfReadRecord &, CVariation_ref &)
bool xVariationSetDeletions(const CGvfReadRecord &, CVariation_ref &)
bool xVariationMakeIndels(const CGvfReadRecord &, CVariation_ref &)
bool xFeatureSetLocationPoint(const CGff2Record &, CSeq_feat &)
virtual bool xVariationSetProperties(const CGvfReadRecord &, CVariation_ref &)
bool xFeatureSetLocationInterval(const CGff2Record &, CSeq_feat &)
bool xVariationMakeInsertions(const CGvfReadRecord &, CVariation_ref &)
virtual bool xVariationSetSnvs(const CGvfReadRecord &, CVariation_ref &)
virtual bool xVariationSetId(const CGvfReadRecord &, CVariation_ref &)
void xPostProcessAnnot(CSeq_annot &) override
virtual bool xFeatureSetExt(const CGvfReadRecord &, CSeq_feat &, ILineErrorListener *)
CRef< CSeq_annot > ReadSeqAnnot(ILineReader &, ILineErrorListener *=nullptr) override
Read an object from a given line reader, render it as a single Seq-annot, if possible.
bool xFeatureSetLocation(const CGff2Record &, CSeq_feat &)
bool xVariationMakeInversions(const CGvfReadRecord &, CVariation_ref &)
virtual bool xVariationSetParent(const CGvfReadRecord &, CVariation_ref &)
bool xVariationSetCommon(const CGvfReadRecord &, CVariation_ref &)
Common file reader utility functions.
virtual bool xParseBrowserLine(const CTempString &, CSeq_annot &)
unique_ptr< CReaderMessageHandler > m_pMessageHandler
SeqIdResolver mSeqIdResolve
unsigned int m_uLineNumber
vector< TReaderLine > TReaderData
virtual void xAddConversionInfo(CSeq_annot &, ILineErrorListener *)
virtual void xAssignTrackData(CSeq_annot &)
virtual void xGetData(ILineReader &, TReaderData &)
virtual CRef< CSeq_annot > ReadSeqAnnot(CNcbiIstream &istr, ILineErrorListener *pErrors=nullptr)
Read an object from a given input stream, render it as a single Seq-annot.
namespace ncbi::objects::
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
CUser_object & AddField(const string &label, const string &value, EParseField parse=eParse_String)
add a data field to the user object that holds a given value
Abstract base class for lightweight line-by-line reading.
container_type::const_iterator const_iterator
const_iterator begin() const
const_iterator end() const
const_iterator find(const key_type &key) const
static const char * bounds[]
Include a standard set of the NCBI C++ Toolkit most basic headers.
static const struct attribute attributes[]
static void fatal(const char *msg,...)
unsigned int TSeqPos
Type for sequence locations and lengths.
@ eDiag_Error
Error message.
@ eDiag_Warning
Warning message.
void SetStrand(ENa_strand strand)
Set the strand for all of the location's ranges.
CRef< C > Ref(C *object)
Helper functions to get CRef<> and CConstRef<> objects.
void Reset(void)
Reset reference object.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Split a string using specified delimiters.
static bool SplitInTwo(const CTempString str, const CTempString delim, string &str1, string &str2, TSplitFlags flags=0)
Split a string into two pieces using the specified delimiters.
static unsigned int StringToUInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to unsigned int.
CTempString substr(size_type pos) const
Obtain a substring from this string, beginning at a given offset.
void SetType(TType &value)
Assign a value to Type data member.
void SetLocation(TLocation &value)
Assign a value to Location data member.
void SetExt(TExt &value)
Assign a value to Ext data member.
void SetData(TData &value)
Assign a value to Data data member.
void SetData(TData &value)
Assign a value to Data data member.
void SetDesc(TDesc &value)
Assign a value to Desc data member.
TUser & SetUser(void)
Select the variant.
@ eType_snv
delta=[morph of length 1] NOTE: this is snV not snP; the latter requires frequency-based validation t...
@ eType_delins
delta=[del, ins]
@ eType_identity
delta=[]
@ eAction_del_at
excise sequence at location if multiplier is specified, delete len(location)*multiplier positions dow...
@ eAction_ins_before
insert seq before the location.start
@ eObservation_variant
inst represent the observed variant at a given position
@ eObservation_asserted
inst represents the asserted base at a position
@ eAllele_state_homozygous
@ eAllele_state_heterozygous
@ eAllele_state_hemizygous
map< string, CVariantProperties::EAllele_state > TAlleleStateMap
const TAlleleStateMap & s_AlleleStateMap()
Lightweight interface for getting lines of data with minimal memory copying.
const struct ncbi::grid::netcache::search::fields::KEY key
const GenericPointer< typename T::ValueType > T2 value
static SLJIT_INLINE sljit_ins lr(sljit_gpr dst, sljit_gpr src)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4