NCBI C++ ToolKit
gff3_alignment_data.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: gff3_alignment_data.cpp 93574 2021-04-30 16:19:19Z stakhovv $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Author: Frank Ludwig
27  *
28  * File Description:
29  * GFF file reader
30  *
31  */
32 
33 #include <ncbi_pch.hpp>
34 #include <corelib/ncbistd.hpp>
43 
46 #include <objmgr/util/sequence.hpp>
47 
49 
50 BEGIN_objects_SCOPE // namespace ncbi::objects::
51 
53 
54 // ----------------------------------------------------------------------------
56 // ----------------------------------------------------------------------------
57 {
58  string str = mIdAttribute;
59  if ( !m_strOtherScores.empty() ) {
60  str += ";";
62  }
63  if ( !m_bIsTrivial ) {
64  str += ";Gap=";
66  }
67  return str;
68 };
69 
70 // ----------------------------------------------------------------------------
72  const CScore& score )
73 // ----------------------------------------------------------------------------
74 {
75  if ( !score.IsSetId() || !score.GetId().IsStr() || !score.IsSetValue() ) {
76  return;
77  }
78  string key = score.GetId().GetStr();
79  string value;
80  if ( score.GetValue().IsInt() ) {
82  }
83  else {
85  }
86  if ( key == "score" ) {
87  mScore = value;
88  }
89  else {
90  if ( ! m_strOtherScores.empty() ) {
91  m_strOtherScores += ";";
92  }
94  m_strOtherScores += "=";
96  }
97 }
98 
99 // ----------------------------------------------------------------------------
101  const CSeq_id& source,
102  const CSeq_id& target)
103 // ----------------------------------------------------------------------------
104 {
105  const char* strProtMatch = "protein_match";
106  const char* strEstMatch = "EST_match";
107  const char* strTransNucMatch = "translated_nucleotide_match";
108  const char* strCdnaMatch = "cDNA_match";
109 
110  CSeq_id::EAccessionInfo source_info = source.IdentifyAccession();
111  CSeq_id::EAccessionInfo target_info = target.IdentifyAccession();
112 
113  if (target_info & CSeq_id::fAcc_prot) {
114  mType = strProtMatch;
115  return;
116  }
117  if ((target_info & CSeq_id::eAcc_division_mask) == CSeq_id::eAcc_est) {
118  mType = strEstMatch;
119  return;
120  }
121  if ((target_info & CSeq_id::eAcc_division_mask) == CSeq_id::eAcc_mrna) {
122  mType = strCdnaMatch;
123  return;
124  }
125  if ((target_info & CSeq_id::eAcc_division_mask) == CSeq_id::eAcc_tsa) {
126  mType = strCdnaMatch;
127  return;
128  }
129  if (source_info & CSeq_id::fAcc_prot) {
130  mType = strTransNucMatch;
131  return;
132  }
133  //m_strType = "match";
134 }
135 
136 END_objects_SCOPE
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.
void SetScore(const CScore &)
virtual void SetMatchType(const CSeq_id &, const CSeq_id &)
static CGffFeatureContext sDummyContext
string StrAttributes() const
Definition: Score.hpp:57
Include a standard set of the NCBI C++ Toolkit most basic headers.
static const char * str(char *buf, int n)
Definition: stats.c:84
static EAccessionInfo IdentifyAccession(const CTempString &accession, TParseFlags flags=fParse_AnyRaw)
Deduces information from a bare accession a la WHICH_db_accession; may report false negatives on prop...
Definition: Seq_id.cpp:1634
EAccessionInfo
For IdentifyAccession (below)
Definition: Seq_id.hpp:220
@ fAcc_prot
Definition: Seq_id.hpp:252
@ eAcc_mrna
Definition: Seq_id.hpp:268
@ eAcc_tsa
Definition: Seq_id.hpp:273
@ eAcc_est
Definition: Seq_id.hpp:265
@ eAcc_division_mask
Definition: Seq_id.hpp:299
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
static string DoubleToString(double value, int precision=-1, TNumToStringFlags flags=0)
Convert double to string.
Definition: ncbistr.hpp:5187
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
Definition: ncbistr.hpp:5084
bool IsStr(void) const
Check if variant Str is selected.
Definition: Object_id_.hpp:291
const TStr & GetStr(void) const
Get the variant data.
Definition: Object_id_.hpp:297
bool IsSetId(void) const
Check if a value has been assigned to Id data member.
Definition: Score_.hpp:432
TInt GetInt(void) const
Get the variant data.
Definition: Score_.hpp:411
bool IsInt(void) const
Check if variant Int is selected.
Definition: Score_.hpp:405
const TValue & GetValue(void) const
Get the Value member data.
Definition: Score_.hpp:465
bool IsSetValue(void) const
Check if a value has been assigned to Value data member.
Definition: Score_.hpp:453
TReal GetReal(void) const
Get the variant data.
Definition: Score_.hpp:384
const TId & GetId(void) const
Get the Id member data.
Definition: Score_.hpp:444
const struct ncbi::grid::netcache::search::fields::KEY key
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
const CharType(& source)[N]
Definition: pointer.h:1149
#define const
Definition: zconf.h:232
Modified on Thu Apr 11 15:14:01 2024 by modify_doxy.py rev. 669887