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

Go to the SVN repository for this file.

1 /* $Id: Dense_diag.cpp 51417 2011-09-29 17:50:39Z grichenk $
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: .......
27  *
28  * File Description:
29  * .......
30  *
31  * Remark:
32  * This code was originally generated by application DATATOOL
33  * using the following specifications:
34  * 'seqalign.asn'.
35  */
36 
37 // standard includes
38 #include <ncbi_pch.hpp>
39 
40 // generated includes
42 
45 
46 // generated classes
47 
49 
50 BEGIN_objects_SCOPE // namespace ncbi::objects::
51 
52 // destructor
54 {
55 }
56 
57 
59 {
60  const size_t& numrows = CheckNumRows();
61 
62  const CDense_diag::TStrands& strands = GetStrands();
63 
64  if ( !strands.empty() &&
65  strands.size() != numrows) {
66  NCBI_THROW(CSeqalignException, eInvalidAlignment,
67  "strands.size inconsistent with dim");
68  }
69 }
70 
71 
74 {
75  if (offset == 0) return;
76 
77  CheckNumRows();
78  if (row >= GetDim()) {
79  NCBI_THROW(CSeqalignException, eInvalidRowNumber,
80  "row > dim");
81  }
82  if (offset < 0) {
84  if ((TSignedSeqPos)GetStarts()[row] < -offset) {
85  NCBI_THROW(CSeqalignException, eOutOfRange,
86  "Negative offset greater than seq position");
87  }
88  }
89  SetStarts()[row] += offset;
90 }
91 
92 
94 {
95  if (row < 0 || row >= GetDim()) {
96  NCBI_THROW(CSeqalignException, eInvalidRowNumber,
97  "CDense_diag::GetSeqStrand():"
98  " Invalid row number");
99  }
100 
101  if (!CanGetStrands() || (int)GetStrands().size() <= row) {
102  NCBI_THROW(CSeqalignException, eInvalidInputData,
103  "CDense_diag::GetSeqStrand():"
104  " Strand doesn't exist for this row.");
105  }
106 
107  return GetStrands()[row];
108 }
109 
110 
112 {
113  if (GetDim() <= row) {
114  NCBI_THROW(CSeqalignException, eInvalidRowNumber,
115  "Invalid row number in CreateRowSeq_interval(): " +
117  }
119  ret->SetId().Assign(*GetIds()[row]);
120  ret->SetFrom(GetStarts()[row]);
121  ret->SetTo(GetStarts()[row] + GetLen());
122  if ( IsSetStrands() ) {
123  ret->SetStrand(GetStrands()[row]);
124  }
125  return ret;
126 }
127 
128 
129 END_objects_SCOPE // namespace ncbi::objects::
130 
132 
133 /* Original file checksum: lines: 65, chars: 1896, CRC32: 7bba37e0 */
User-defined methods of the data storage class.
void OffsetRow(TDim row, TSignedSeqPos offset)
Offset row's coords.
Definition: Dense_diag.cpp:72
ENa_strand GetSeqStrand(TDim row) const
Definition: Dense_diag.cpp:93
TDim CheckNumRows(void) const
Validators.
Definition: Dense_diag.hpp:125
CRef< CSeq_interval > CreateRowSeq_interval(TDim row) const
Definition: Dense_diag.cpp:111
void Validate() const
Definition: Dense_diag.cpp:58
~CDense_diag(void)
Definition: Dense_diag.cpp:53
int offset
Definition: replacements.h:160
int TSignedSeqPos
Type for signed sequence position.
Definition: ncbimisc.hpp:887
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
Definition: ncbiexpt.hpp:704
#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 IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
Definition: ncbistr.hpp:5084
TLen GetLen(void) const
Get the Len member data.
TDim GetDim(void) const
Get the Dim member data.
const TIds & GetIds(void) const
Get the Ids member data.
TStarts & SetStarts(void)
Assign a value to Starts data member.
bool IsSetStrands(void) const
Check if a value has been assigned to Strands data member.
vector< ENa_strand > TStrands
Definition: Dense_diag_.hpp:96
const TStrands & GetStrands(void) const
Get the Strands member data.
const TStarts & GetStarts(void) const
Get the Starts member data.
bool CanGetStrands(void) const
Check if it is safe to call GetStrands method.
void SetTo(TTo value)
Assign a value to To data member.
ENa_strand
strand of nucleic acid
Definition: Na_strand_.hpp:64
void SetId(TId &value)
Assign a value to Id data member.
void SetFrom(TFrom value)
Assign a value to From data member.
void SetStrand(TStrand value)
Assign a value to Strand data member.
const struct ncbi::grid::netcache::search::fields::SIZE size
#define row(bind, expected)
Definition: string_bind.c:73
#define _ASSERT
Modified on Tue Apr 23 07:38:32 2024 by modify_doxy.py rev. 669887