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

Go to the SVN repository for this file.

1 /* $Id: compartments.cpp 92222 2020-12-23 19:04:59Z 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: Boris Kiryutin, Vyacheslav Chetvernin
27  *
28  * File Description: Get protein compartments from BLAST hits
29  *
30  */
31 
32 #include <ncbi_pch.hpp>
33 
36 #include <objects/seq/seq__.hpp>
37 
40 
43 
45 BEGIN_SCOPE(prosplign)
47 
48 
50 {
51  typedef CHitComparator<THit> THitComparator;
52  THitComparator sorter (THitComparator::eQueryMin);
53  stable_sort(hitrefs.begin(), hitrefs.end(), sorter);
54 
55  int len = 0;
56  TSeqPos stmin = hitrefs.front()->GetQueryMin();
57  TSeqPos enmax = hitrefs.front()->GetQueryMax();
58 
59  ITERATE(THitRefs, it, hitrefs) {
60  if((*it)->GetQueryMin() <= enmax) {//overlaping hits
61  enmax = max((*it)->GetQueryMax(), enmax);
62  } else {//next chain starts
63  len += enmax - stmin + 1;
64  stmin = (*it)->GetQueryMin();
65  enmax = (*it)->GetQueryMax();
66  }
67  }
68  len += enmax - stmin + 1;
69 
70  _ASSERT( len>0 );
71  return len;
72 }
73 
74 
76  const THitRefs& orig_hitrefs,
77  bool is_protein_subject)
78 {
79  NON_CONST_ITERATE (THitRefs, h, hitrefs) {
80 
81  TSeqPos subj_start = (*h)->GetSubjStart();
82  TSeqPos subj_stop = (*h)->GetSubjStop();
83  TSeqPos qry_start = (*h)->GetQueryStart();
84  TSeqPos qry_stop = (*h)->GetQueryStop();
85 
86  if (!is_protein_subject) {
87  qry_start /=3;
88  qry_stop /=3;
89 
90  (*h)->SetQueryStart(qry_start);
91  (*h)->SetQueryStop(qry_stop);
92  }
93 
94  //find hit with same boundaries and max score
95  double score = 0;
96  bool undef_score = true;
97  ITERATE(THitRefs, oh, orig_hitrefs) {
98  if ((*oh)->GetSubjStart() == subj_start &&
99  subj_stop == (*oh)->GetSubjStop() &&
100  (*oh)->GetQueryStart() == qry_start &&
101  qry_stop == (*oh)->GetQueryStop() &&
102  (undef_score || score < (*oh)->GetScore())) {
103  score = (*oh)->GetScore();
104  undef_score = false;
105  **h = **oh;
106  }
107  }
108  }
109 }
110 
111 void RemoveOverlaps(THitRefs& hitrefs)
112 {
113  THitRefs hits_new;
114  CHitFilter<THit>::s_RunGreedy(hitrefs.begin(), hitrefs.end(),
115  &hits_new, 1, 0);
116  hitrefs.erase(remove_if(hitrefs.begin(), hitrefs.end(), CHitFilter<THit>::s_PNullRef),
117  hitrefs.end());
118  copy(hits_new.begin(), hits_new.end(), back_inserter(hitrefs));
119 }
120 
121 double TotalScore(THitRefs& hitrefs)
122 {
123  double result = 0;
124  ITERATE(THitRefs, i, hitrefs) {
125  result += (*i)->GetScore();
126  }
127  return result;
128 }
129 
130 int TotalRawScore(THitRefs& hitrefs)
131 {
132  int result = 0;
133  ITERATE(THitRefs, i, hitrefs) {
134  result += (*i)->GetRawScore();
135  }
136  return result;
137 }
138 
139 CRef<CScore> IntScore(const string& id, int value)
140 {
142  result->SetId().SetStr(id);
143  result->SetValue().SetInt(value);
144  return result;
145 }
146 
147 CRef<CScore> RealScore(const string& id, double value)
148 {
150  result->SetId().SetStr(id);
151  result->SetValue().SetReal(value);
152  return result;
153 }
154 
156 {
157  _ASSERT( !hitrefs.empty() );
158 
159  CRef<CSeq_align> seq_align(new CSeq_align);
160  CSeq_align& compartment = *seq_align;
161 
162  compartment.SetType(CSeq_align::eType_partial);
163  CSeq_align::TSegs::TStd& std_segs = compartment.SetSegs().SetStd();
164 
165  TSeqPos subj_leftmost = hitrefs.front()->GetSubjMin();
166  TSeqPos subj_rightmost = 0;
167 
168  bool strand = true;
169 
170  ITERATE (THitRefs, h, hitrefs) {
171  if (!(*h)->GetSubjStrand()) {
172  strand = false;
173  break;
174  }
175  }
176  ITERATE (THitRefs, h, hitrefs) {
177  TSeqPos subj_min = (*h)->GetSubjMin();
178  TSeqPos subj_max = (*h)->GetSubjMax();
179  TSeqPos qry_min = (*h)->GetQueryMin();
180  TSeqPos qry_max = (*h)->GetQueryMax();
181  double pct_identity =(*h) ->GetIdentity();
182  double bit_score = (*h)->GetScore();
183  int score = (*h)->GetRawScore();
184 
185  subj_leftmost = min(subj_leftmost, subj_min);
186  subj_rightmost = max(subj_rightmost, subj_max);
187 
188  CRef<CStd_seg> std_seg(new CStd_seg);
189 
190  CRef<CSeq_id> qry_id(new CSeq_id);
191  qry_id->Assign(*(*h)->GetQueryId());
192  CRef<CSeq_loc> qry_loc(new CSeq_loc(*qry_id,qry_min,qry_max,eNa_strand_plus));
193  std_seg->SetLoc().push_back(qry_loc);
194 
195  CRef<CSeq_id> subj_id(new CSeq_id);
196  subj_id->Assign(*(*h)->GetSubjId());
197  CRef<CSeq_loc> subj_loc(new CSeq_loc(*subj_id,subj_min,subj_max,strand?eNa_strand_plus:eNa_strand_minus));
198  std_seg->SetLoc().push_back(subj_loc);
199 
200  std_seg->SetScores().push_back(RealScore("pct_identity",pct_identity*100));
201  std_seg->SetScores().push_back(RealScore("bit_score",bit_score));
202  if(score > 0) std_seg->SetScores().push_back(IntScore("score",score));
203 
204  std_segs.push_back(std_seg);
205  }
206 
208  result->SetData().SetAlign().push_back(seq_align);
209 
211  uo->SetType().SetStr("Compart Scores");
212  int TRScore = TotalRawScore(hitrefs);
213  if(TRScore > 0) {
214  uo->AddField("score", TRScore);
215  }
216  uo->AddField("bit_score", TotalScore(hitrefs));
217  uo->AddField("num_covered_aa", CountQueryCoverage(hitrefs));
218  result->AddUserObject( *uo );
219 
220  CRef<CSeq_id> qry_id(new CSeq_id);
221  qry_id->Assign(*hitrefs.front()->GetQueryId());
222  CRef<CAnnotdesc> align(new CAnnotdesc);
224  align->SetAlign().SetIds().push_back( qry_id );
225  result->SetDesc().Set().push_back( align );
226 
227  CRef<CSeq_id> subj_id(new CSeq_id);
228  subj_id->Assign(*hitrefs.front()->GetSubjId());
229  CRef<CSeq_loc> subj_loc(new CSeq_loc(*subj_id, subj_leftmost, subj_rightmost, strand?eNa_strand_plus:eNa_strand_minus));
230  CRef<CAnnotdesc> region(new CAnnotdesc);
231  region->SetRegion(*subj_loc);
232  result->SetDesc().Set().push_back(region);
233 
234  return result;
235 }
236 
237 unique_ptr<CCompartmentAccessor<THit> > CreateCompartmentAccessor(const THitRefs& orig_hitrefs,
238  CCompartOptions compart_options,
239  const vector<pair<THit::TCoord, THit::TCoord> > *gaps)
240 {
241  unique_ptr<CCompartmentAccessor<THit> > comps_ptr;
242  if (orig_hitrefs.empty())
243  return comps_ptr;
244 
245  THitRefs hitrefs;
246 
247  bool is_protein_subject;
248 
249  if (compart_options.m_SubjectMol != CCompartOptions::eGuess) {
250  is_protein_subject = compart_options.m_SubjectMol == CCompartOptions::eAminoAcid;
251  } else {
252  double max_subj_query_ratio = 0;
253  ITERATE(THitRefs, it, orig_hitrefs) {
254  const CBlastTabular& hit = **it;
255  double subj_query_ratio = double(hit.GetSubjSpan())/hit.GetQuerySpan();
256  max_subj_query_ratio = max(max_subj_query_ratio, subj_query_ratio);
257  }
258  is_protein_subject = max_subj_query_ratio < 2;
259  }
260 
261  ITERATE(THitRefs, it, orig_hitrefs) {
262  THitRef hitref(new THit(**it));
263  if (!hitref->GetQueryStrand())
264  NCBI_THROW(CProSplignException, eFormat, "minus strand on protein in BLAST hit");
265  if (!is_protein_subject) {
266  // set max first, otherwise min can be more than max and will throw an error
267  hitref->SetQueryMax(hitref->GetQueryMax()*3+2);
268  hitref->SetQueryMin(hitref->GetQueryMin()*3);
269  }
270  if (compart_options.m_Maximizing == CCompartOptions::eCoverage)
271  hitref->SetIdentity(0.9999f);
272  else if (compart_options.m_Maximizing == CCompartOptions::eScore)
273  hitref->SetIdentity(hitref->GetScore()/hitref->GetLength());
274 
275  hitrefs.push_back(hitref);
276  }
277 
278  //count 'pseudo' length
279  int len = CountQueryCoverage(hitrefs);
280 
281  comps_ptr.reset
282  (new CCompartmentAccessor<THit>( int(compart_options.m_CompartmentPenalty * len),
283  int(compart_options.m_MinCompartmentIdty * len),
284  int(compart_options.m_MinSingleCompartmentIdty * len)));
285 
286  CCompartmentAccessor<THit>& comps = *comps_ptr;
287 
288  comps.SetMaxIntron(compart_options.m_MaxIntron);
289  comps.SetMaxOverlap(compart_options.m_MaxOverlap);
290  comps.Run(hitrefs.begin(), hitrefs.end(), NULL, gaps);
291 
292  THitRefs comphits;
293  if(comps.GetFirst(comphits)) {
294  do {
295  RestoreOriginalHits(comphits, orig_hitrefs, is_protein_subject);
296  RemoveOverlaps(comphits);
297 
298  } while (comps.GetNext(comphits));
299  }
300  return comps_ptr;
301 }
302 
303 TCompartments SelectCompartmentsHits(const THitRefs& orig_hitrefs, CCompartOptions compart_options,
304  const vector<pair<THit::TCoord, THit::TCoord> > *gaps)
305 {
306  unique_ptr<CCompartmentAccessor<THit> > comps_ptr =
307  CreateCompartmentAccessor( orig_hitrefs, compart_options, gaps);
308 
309  TCompartments results = FormatAsAsn(comps_ptr.get(), compart_options, gaps);
310  return results;
311 }
312 
314  const vector<pair<THit::TCoord, THit::TCoord> > *gaps)
315 {
316  TCompartments results;
317  if (comps_ptr == NULL)
318  return results;
319 
320  CCompartmentAccessor<THit>& comps = *comps_ptr;
321 
322  THitRefs comphits;
323  if(comps.GetFirst(comphits)) {
324  CRef<CSeq_loc> prev_compartment_loc;
325  const TSeqPos max_extent = compart_options.m_MaxExtent;
326 
327  size_t i = 0;
328  do {
329  CRef<CSeq_annot> compartment = MakeCompartment(comphits);
330 
331  const TSeqPos* boxPtr = comps.GetBox(i);
332  TSeqPos cur_begin = boxPtr[2];
333  TSeqPos cur_end = boxPtr[3];
334  TSeqPos cur_begin_extended = cur_begin < max_extent ? 0 : cur_begin - max_extent;
335  TSeqPos cur_end_extended = cur_end + max_extent;
336 
337  //prohibit extension to go over over non-bridgeable gaps
338  if(gaps) {
339  vector<pair<THit::TCoord, THit::TCoord> >::const_iterator it;
340  for(it = gaps->begin(); it != gaps->end(); ++it) {
341  TSeqPos gfrom = it->first;
342  TSeqPos gto = it->second;
343  if( gfrom < cur_begin && cur_begin_extended < gto ) {
344  if( gto < cur_begin ) {
345  cur_begin_extended = gto + 1;//start from gap +1
346  } else {
347  cur_begin_extended = cur_begin;//gap covers cur_begin, no extension
348  }
349  }
350  if( cur_end < gto && gfrom < cur_end_extended ) {
351  if( cur_end < gfrom ) {
352  cur_end_extended = gfrom - 1;//end at gap - 1
353  } else {
354  cur_end_extended = cur_end;
355  }
356  }
357  }
358  }
359 
360  CRef<CSeq_loc> cur_compartment_loc(&compartment->SetDesc().Set().back()->SetRegion());
361  cur_compartment_loc->SetInt().SetFrom(cur_begin_extended);
362  cur_compartment_loc->SetInt().SetTo(cur_end_extended);
363 
364  if (prev_compartment_loc.NotEmpty() &&
365  prev_compartment_loc->GetId()->Match(*cur_compartment_loc->GetId()) &&
366  prev_compartment_loc->GetStrand()==cur_compartment_loc->GetStrand()
367  ) {
368  TSeqPos prev_end_extended = prev_compartment_loc->GetStop(eExtreme_Positional);
369  TSeqPos prev_end = prev_end_extended - max_extent;
370  if(prev_end < cur_begin) {
371  if (prev_end_extended >= cur_begin_extended) {
372  prev_end_extended = (prev_end + cur_begin)/2;
373  cur_begin_extended = prev_end_extended+1;
374  _ASSERT(cur_begin_extended <= cur_begin);
375  prev_compartment_loc->SetInt().SetTo(prev_end_extended);
376  cur_compartment_loc->SetInt().SetFrom(cur_begin_extended);
377  }
378  } else {//overlapping compartments, no extension
379  prev_compartment_loc->SetInt().SetTo(prev_end);
380  cur_compartment_loc->SetInt().SetFrom(cur_begin);
381  }
382  }
383  prev_compartment_loc=cur_compartment_loc;
384  results.push_back(compartment);
385  ++i;
386  } while (comps.GetNext(comphits));
387  }
388 
389  return results;
390 }
391 
393 {
394  TCompartmentStructs results;
395 
396  ITERATE(TCompartments, i, compartments) {
397  const CSeq_annot& comp = **i;
398  const CSeq_loc* subj_loc = NULL;
399  int covered_aa = 0;
400  double score = 0;
401  int raw_score = 0;
402  ITERATE (CAnnot_descr::Tdata, desc_it, comp.GetDesc().Get()) {
403  const CAnnotdesc& desc = **desc_it;
404  if (desc.IsRegion()) {
405  subj_loc = &desc.GetRegion();
406  } else if (desc.IsUser() && desc.GetUser().GetType().IsStr() && desc.GetUser().GetType().GetStr()=="Compart Scores") {
407  covered_aa = desc.GetUser().GetField("num_covered_aa").GetData().GetInt();
408  score = desc.GetUser().GetField("bit_score").GetData().GetReal();
409  try {
410  raw_score = desc.GetUser().GetField("score").GetData().GetInt();
411  } catch(...) {// score is not set in ASN
412  raw_score = (int) score;
413  }
414  }
415  }
416  if (subj_loc)
417  results.push_back(SCompartment(subj_loc->GetStart(eExtreme_Positional),
418  subj_loc->GetStop(eExtreme_Positional),
419  subj_loc->GetStrand()!=eNa_strand_minus,
420  covered_aa, score, raw_score));
421  }
422  sort(results.begin(),results.end());
423 
424  return results;
425 }
426 
428 {
429  return MakeCompartments(SelectCompartmentsHits(hitrefs, compart_options), compart_options);
430 }
431 
437 const char* CCompartOptions::s_scoreNames[] = {"coverage", "identity", "score"};
438 
440 {
441  argdescr->AddDefaultKey
442  ("max_extent",
443  "max_extent",
444  "Max genomic extent to look for exons beyond compartment ends.",
447 
448  try {
449  argdescr->AddDefaultKey
450  ("compartment_penalty",
451  "double",
452  "Penalty to open a new compartment "
453  "(compartment identification parameter). "
454  "Multiple compartments will only be identified if "
455  "they have at least this level of coverage.",
458 
459  argdescr->AddDefaultKey
460  ("min_compartment_idty",
461  "double",
462  "Minimal compartment identity for multiple compartments",
465 
466  argdescr->AddDefaultKey
467  ("min_singleton_idty",
468  "double",
469  "Minimal compartment identity for single compartment",
472 
473 
474  argdescr->AddDefaultKey
475  ("max_intron",
476  "integer",
477  "Maximal intron length",
480  } catch (CArgException &) {
481  /// Ignore exception, which owuld happen if an application sets up
482  /// command-line arguments for both splign and prosplign, creating a
483  /// duplicate argument
484  }
485 
486  argdescr->AddDefaultKey
487  ("by_coverage",
488  "flag",
489  "Ignore hit identity. Set all to 99.99%\nDeprecated: use -maximize arg",
491 
492  argdescr->AddDefaultKey
493  ("max_overlap",
494  "integer",
495  "Maximal compartment overlap on subject in bp.",
498 
499  argdescr->AddDefaultKey
500  ("maximize",
501  "param",
502  "parameter to maximize",
505 
506  argdescr->SetConstraint("maximize",
507  &(*new CArgAllow_Strings,
509 
510  argdescr->SetDependency("by_coverage", CArgDescriptions::eExcludes,
511  "maximize");
512 
513  argdescr->AddDefaultKey
514  ("subj-mol",
515  "type",
516  "subject molecule type",
518  "guess");
519 
520  argdescr->SetConstraint("subj-mol", &(*new CArgAllow_Strings, "guess", "na", "aa"));
521 
522 }
523 
525  m_CompartmentPenalty(default_CompartmentPenalty),
526  m_MinCompartmentIdty(default_MinCompartmentIdty),
527  m_MinSingleCompartmentIdty(default_MinSingleCompartmentIdty),
528  m_MaxExtent(default_MaxExtent),
529  m_ByCoverage(default_ByCoverage),
530  m_MaxIntron(default_MaxIntron),
531  m_MaxOverlap(default_MaxOverlap),
532  m_Maximizing(default_Maximizing),
533  m_SubjectMol(default_SubjectMol)
534 {
535 }
536 
538  m_CompartmentPenalty(args["compartment_penalty"].AsDouble()),
539  m_MinCompartmentIdty(args["min_compartment_idty"].AsDouble()),
540 /// In some applications min_singletom_idty will carry over from the splign
541 /// command-line arguments, with no default
542  m_MinSingleCompartmentIdty(args["min_singleton_idty"]
543  ? args["min_singleton_idty"].AsDouble()
544  : default_MinSingleCompartmentIdty),
545  m_MaxExtent(args["max_extent"].AsInteger()),
546  m_MaxIntron(args["max_intron"].AsInteger()),
547  m_MaxOverlap(args["max_overlap"].AsInteger())
548 {
549  if (args["maximize"]) {
551  for (size_t i = 0; i < sizeof(s_scoreNames)/sizeof(s_scoreNames[0]); ++i) {
552  if (args["maximize"].AsString() == s_scoreNames[i]) {
554  break;
555  }
556  }
558  } else {
559  if (args["by_coverage"]) {
560  m_ByCoverage = args["by_coverage"].AsBoolean();
561  } else {
563  }
565  }
566 
568  if (args["subj-mol"].AsString() == "na") {
570  } else if (args["subj-mol"].AsString() == "aa") {
572  }
573 }
574 
575 END_SCOPE(prosplign)
@ eExtreme_Positional
numerical value
Definition: Na_strand.hpp:63
void remove_if(Container &c, Predicate *__pred)
Definition: chainer.hpp:69
TCoord GetQuerySpan(void) const
TCoord GetSubjSpan(void) const
CAnnotdesc –.
Definition: Annotdesc.hpp:66
CArgAllow_Strings –.
Definition: ncbiargs.hpp:1641
CArgDescriptions –.
Definition: ncbiargs.hpp:541
CArgException –.
Definition: ncbiargs.hpp:120
CArgs –.
Definition: ncbiargs.hpp:379
EMaximizing m_Maximizing
static const double default_MinCompartmentIdty
static const int default_MaxIntron
static const EMaximizing default_Maximizing
static const double default_MinSingleCompartmentIdty
static const int default_MaxExtent
static void SetupArgDescriptions(CArgDescriptions *argdescr)
static const double default_CompartmentPenalty
static const int default_MaxOverlap
static const char * s_scoreNames[]
static const bool default_ByCoverage
CCompartOptions()
with deafalt params
double m_CompartmentPenalty
double m_MinCompartmentIdty
ESubjectMol m_SubjectMol
static const ESubjectMol default_SubjectMol
double m_MinSingleCompartmentIdty
void Run(typename THitRefs::iterator start, typename THitRefs::iterator finish, CScope *scope=NULL, const vector< pair< TCoord, TCoord > > *gaps=NULL)
Execute: identify compartments.
void SetMaxIntron(TCoord mi)
Assign the maximum intron length, in base pairs.
bool GetFirst(THitRefs &compartment)
Initialize iteration over the results.
const TCoord * GetBox(size_t i) const
void SetMaxOverlap(TCoord max_overlap)
Assign the maximum length for compartments to overlap on the subject.
bool GetNext(THitRefs &compartment)
Proceed with iteration over the results.
static TCoord s_GetDefaultMaxOverlap(void)
Retrieve the default compartment overlap behaviour (no overlap).
static TCoord s_GetDefaultMaxIntron(void)
Retrieve the default maximum length of an intron.
CRef –.
Definition: ncbiobj.hpp:618
Definition: Score.hpp:57
vector< THitRef > THitRefs
Definition: splign.hpp:295
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
const CUser_field & GetField(const string &str, const string &delim=".", NStr::ECase use_case=NStr::eCase) const
Access a named field in this user object.
Definition: User_object.cpp:71
TCompartments FormatAsAsn(CCompartmentAccessor< THit > *comps_ptr, CCompartOptions compart_options, const vector< pair< THit::TCoord, THit::TCoord > > *gaps)
unique_ptr< CCompartmentAccessor< THit > > CreateCompartmentAccessor(const THitRefs &orig_hitrefs, CCompartOptions compart_options, const vector< pair< THit::TCoord, THit::TCoord > > *gaps)
Selects compartments.
CRef< CScore > IntScore(const string &id, int value)
CRef< CSeq_annot > MakeCompartment(THitRefs &hitrefs)
USING_SCOPE(ncbi::objects)
void RemoveOverlaps(THitRefs &hitrefs)
TCompartments SelectCompartmentsHits(const THitRefs &orig_hitrefs, CCompartOptions compart_options, const vector< pair< THit::TCoord, THit::TCoord > > *gaps)
Composition of first two functions.
CRef< CScore > RealScore(const string &id, double value)
double TotalScore(THitRefs &hitrefs)
void RestoreOriginalHits(THitRefs &hitrefs, const THitRefs &orig_hitrefs, bool is_protein_subject)
int TotalRawScore(THitRefs &hitrefs)
int CountQueryCoverage(THitRefs &hitrefs)
TCompartmentStructs MakeCompartments(const TCompartments &compartments, CCompartOptions compart_options)
CSplign::THit THit
CSplign::THitRefs THitRefs
vector< SCompartment > TCompartmentStructs
list< CRef< CSeq_annot > > TCompartments
static void s_RunGreedy(typename THitRefs::iterator hri_beg, typename THitRefs::iterator hri_end, THitRefs *phits_new, TCoord min_hit_len=100, double min_hit_idty=.9, TCoord margin=1, TCoord retain_overlap=0, EUnique_type unique_type=e_Strict)
Definition: hit_filter.hpp:234
unsigned int TSeqPos
Type for sequence locations and lengths.
Definition: ncbimisc.hpp:875
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:815
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
Definition: ncbimisc.hpp:822
void SetConstraint(const string &name, const CArgAllow *constraint, EConstraintNegate negate=eConstraint)
Set additional user defined constraint on argument value.
Definition: ncbiargs.cpp:2591
void SetDependency(const string &arg1, EDependency dep, const string &arg2)
Define a dependency.
Definition: ncbiargs.cpp:2618
void AddDefaultKey(const string &name, const string &synopsis, const string &comment, EType type, const string &default_value, TFlags flags=0, const string &env_var=kEmptyStr, const char *display_value=nullptr)
Add description for optional key with default value.
Definition: ncbiargs.cpp:2442
@ eExcludes
One argument excludes another.
Definition: ncbiargs.hpp:957
@ eBoolean
{'true', 't', 'false', 'f'}, case-insensitive
Definition: ncbiargs.hpp:590
@ eDouble
Convertible into a floating point number (double)
Definition: ncbiargs.hpp:594
@ eString
An arbitrary string.
Definition: ncbiargs.hpp:589
@ eInteger
Convertible into an integer number (int or Int8)
Definition: ncbiargs.hpp:592
#define NULL
Definition: ncbistd.hpp:225
#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
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Optimized implementation of CSerialObject::Assign, which is not so efficient.
Definition: Seq_id.cpp:318
bool Match(const CSeq_id &sid2) const
Match() - TRUE if SeqIds are equivalent.
Definition: Seq_id.hpp:1065
ENa_strand GetStrand(void) const
Get the location's strand.
Definition: Seq_loc.cpp:882
TSeqPos GetStart(ESeqLocExtremes ext) const
Return start and stop positions of the seq-loc.
Definition: Seq_loc.cpp:915
void SetInt(TInt &v)
Definition: Seq_loc.hpp:983
const CSeq_id * GetId(void) const
Get the id of the location return NULL if has multiple ids or no id at all.
Definition: Seq_loc.hpp:941
TSeqPos GetStop(ESeqLocExtremes ext) const
Definition: Seq_loc.cpp:963
bool NotEmpty(void) const THROWS_NONE
Check if CRef is not empty – pointing to an object and has a non-null value.
Definition: ncbiobj.hpp:726
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:75
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:72
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 TData & GetData(void) const
Get the Data member data.
const TStr & GetStr(void) const
Get the variant data.
Definition: Object_id_.hpp:297
TInt GetInt(void) const
Get the variant data.
TReal GetReal(void) const
Get the variant data.
void SetType(TType &value)
Assign a value to Type data member.
const TType & GetType(void) const
Get the Type member data.
list< CRef< CStd_seg > > TStd
Definition: Seq_align_.hpp:196
void SetSegs(TSegs &value)
Assign a value to Segs data member.
Definition: Seq_align_.cpp:310
void SetType(TType value)
Assign a value to Type data member.
Definition: Seq_align_.hpp:818
@ eType_partial
mapping pieces together
Definition: Seq_align_.hpp:103
@ eNa_strand_plus
Definition: Na_strand_.hpp:66
@ eNa_strand_minus
Definition: Na_strand_.hpp:67
const Tdata & Get(void) const
Get the member data.
TIds & SetIds(void)
Assign a value to Ids data member.
Definition: Align_def_.hpp:273
void SetDesc(TDesc &value)
Assign a value to Desc data member.
Definition: Seq_annot_.cpp:223
void SetAlign_type(TAlign_type value)
Assign a value to Align_type data member.
Definition: Align_def_.hpp:236
const TUser & GetUser(void) const
Get the variant data.
Definition: Annotdesc_.cpp:184
const TDesc & GetDesc(void) const
Get the Desc member data.
Definition: Seq_annot_.hpp:852
bool IsRegion(void) const
Check if variant Region is selected.
Definition: Annotdesc_.hpp:591
TRegion & SetRegion(void)
Select the variant.
Definition: Annotdesc_.cpp:300
TAlign & SetAlign(void)
Select the variant.
Definition: Annotdesc_.cpp:278
const TRegion & GetRegion(void) const
Get the variant data.
Definition: Annotdesc_.cpp:294
bool IsUser(void) const
Check if variant User is selected.
Definition: Annotdesc_.hpp:561
list< CRef< CAnnotdesc > > Tdata
@ eAlign_type_ref
set of alignments to the same sequence
Definition: Align_def_.hpp:90
unsigned int
A callback function used to compare two keys in a database.
Definition: types.hpp:1210
int i
int len
constexpr auto sort(_Init &&init)
Magic spell ;-) needed for some weird compilers... very empiric.
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
T max(T x_, T y_)
T min(T x_, T y_)
void copy(Njn::Matrix< S > *matrix_, const Njn::Matrix< T > &matrix0_)
Definition: njn_matrix.hpp:613
#define _ASSERT
else result
Definition: token2.c:20
Modified on Sat Apr 20 12:22:31 2024 by modify_doxy.py rev. 669887