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

Go to the SVN repository for this file.

1 /* $Id: report_trim.cpp 41710 2018-09-12 14:35:34Z filippov $
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  * Authors: Igor Filippov
27  */
28 
29 
30 #include <ncbi_pch.hpp>
33 #include <objmgr/seq_vector.hpp>
39 #include <objmgr/align_ci.hpp>
40 #include <objmgr/graph_ci.hpp>
41 
43 
45 using namespace objects;
46 
47 
48 void CReportTrim::AdjustAndTranslate(CBioseq_Handle bsh, int orig_length, int orig_from, int orig_to, CRef<CCmdComposite> command, CScope &scope,
49  map<objects::CBioseq_Handle, set<objects::CSeq_feat_Handle> > &product_to_cds)
50 {
52 
54  if (bssh && bssh.IsSetClass() && bssh.GetClass() == CBioseq_set::eClass_nuc_prot)
55  seh = bssh.GetParentEntry();
56 
58  for (; feat_ci; ++feat_ci)
59  {
60  int from = orig_from;
61  int to = orig_to;
62  int length = orig_length;
63 
64  if (x_IsProtLocation(feat_ci->GetLocation(), bsh, scope))
65  {
66  continue;
67  }
68  if (feat_ci->IsSetProduct() && feat_ci->GetData().IsCdregion() &&
69  feat_ci->GetOriginalFeature().IsSetExcept_text() && NStr::Find(feat_ci->GetOriginalFeature().GetExcept_text(), "RNA editing") != string::npos)
70  {
71  continue;
72  }
73  CRef<CSeq_feat> new_feat(new CSeq_feat());
74  new_feat->Assign(feat_ci->GetOriginalFeature());
75 
76  int diff = 0;
77  if ( x_AdjustLocation(new_feat->SetLocation(),length,from,to,diff) )
78  {
79  CRef<CCmdComposite> cmd = GetDeleteFeatureCommand(*feat_ci, true, product_to_cds);
80  command->AddCommand(*cmd);
81  continue;
82  }
83 
84  if (feat_ci->IsSetData() && feat_ci->GetData().IsCdregion())
85  {
86  x_AdjustCdregionFrame(new_feat, diff);
87  //new_feat->SetData().SetCdregion().SetFrame(objects::CSeqTranslator::FindBestFrame(*new_feat,scope));
88 
89  EDIT_EACH_CODEBREAK_ON_CDREGION(codebreak, new_feat->SetData().SetCdregion())
90  {
91  if ((*codebreak)->IsSetLoc())
92  {
93  if ( x_AdjustLocation((*codebreak)->SetLoc(),length,from,to))
94  {
95  ERASE_CODEBREAK_ON_CDREGION(codebreak, new_feat->SetData().SetCdregion());
96  }
97  }
98  }
99  if (new_feat->GetData().GetCdregion().IsSetCode_break() && new_feat->GetData().GetCdregion().GetCode_break().empty())
100  new_feat->SetData().SetCdregion().ResetCode_break();
101  }
102 
103  if (new_feat->IsSetData() && new_feat->GetData().IsRna() && new_feat->GetData().GetRna().IsSetExt() &&
104  new_feat->GetData().GetRna().GetExt().IsTRNA() && new_feat->GetData().GetRna().GetExt().GetTRNA().IsSetAnticodon())
105  {
106  if ( x_AdjustLocation(new_feat->SetData().SetRna().SetExt().SetTRNA().SetAnticodon(), length,from,to))
107  {
108  new_feat->SetData().SetRna().SetExt().SetTRNA().ResetAnticodon();
109  }
110  }
111 
112  if (new_feat->IsSetData() && new_feat->GetData().IsClone() && new_feat->GetData().GetClone().IsSetClone_seq())
113  {
114  CClone_seq_set &clone_set = new_feat->SetData().SetClone().SetClone_seq();
115  if (clone_set.IsSet())
116  {
117  for (CClone_seq_set::Tdata::iterator clone_it = clone_set.Set().begin(); clone_it != clone_set.Set().end(); ++clone_it)
118  {
119  if ((*clone_it)->IsSetLocation())
120  {
121  if ( x_AdjustLocation((*clone_it)->SetLocation(), length,from,to))
122  {
123  (*clone_it)->ResetLocation();
124  }
125  }
126  if ((*clone_it)->IsSetSeq())
127  {
128  if ( x_AdjustLocation((*clone_it)->SetSeq(),length,from,to))
129  {
130  (*clone_it)->ResetSeq();
131  }
132  }
133  }
134  }
135  }
136 
137  if (new_feat->IsSetData() && new_feat->GetData().IsVariation() )
138  {
139  CVariation_ref &var = new_feat->SetData().SetVariation();
140  x_UpdateVariation(var, length,from,to);
141  }
142 
143 
144  command->AddCommand(*CRef<CCmdChangeSeq_feat>(new CCmdChangeSeq_feat(*feat_ci, *new_feat)));
145 
146  if (feat_ci->IsSetProduct() && feat_ci->GetData().IsCdregion())
147  {
148  x_RetranslateCDS(scope, command, new_feat, feat_ci->GetOriginalFeature());
149  }
150 
151  }
152 }
153 
154 void CReportTrim::x_UpdateVariation(CVariation_ref &var, int length, int from, int to)
155 {
156  if (var.IsSetData() && var.GetData().IsInstance() && var.GetData().GetInstance().IsSetDelta())
157  {
158  CVariation_inst::TDelta::iterator delta_it = var.SetData().SetInstance().SetDelta().begin();
159  while ( delta_it != var.SetData().SetInstance().SetDelta().end())
160  {
161  bool to_delete = false;
162  if ((*delta_it)->IsSetSeq() && (*delta_it)->GetSeq().IsLoc() && x_AdjustLocation((*delta_it)->SetSeq().SetLoc(), length,from,to))
163  {
164  delta_it = var.SetData().SetInstance().SetDelta().erase(delta_it);
165  continue;
166  }
167  ++delta_it;
168  }
169  if (var.GetData().GetInstance().GetDelta().empty())
170  var.SetData().SetInstance().ResetDelta();
171  }
172  if (var.IsSetData() && var.GetData().IsSet() && var.GetData().GetSet().IsSetVariations())
173  {
174  for ( CVariation_ref::C_Data::C_Set::TVariations::iterator var_it = var.SetData().SetSet().SetVariations().begin(); var_it != var.SetData().SetSet().SetVariations().end(); ++var_it)
175  {
176  x_UpdateVariation(**var_it, length,from,to);
177  }
178  }
179  if (var.IsSetConsequence())
180  {
181  for (CVariation_ref::TConsequence::iterator con_it = var.SetConsequence().begin(); con_it != var.SetConsequence().end(); ++con_it)
182  {
183  if ((*con_it)->IsVariation())
184  {
185  x_UpdateVariation((*con_it)->SetVariation(), length,from,to);
186  }
187  }
188  }
189 }
190 
191 bool CReportTrim::x_IsProtLocation(const CSeq_loc& loc, CBioseq_Handle bsh, CScope &scope)
192 {
193  CBioseq_Handle prot_bsh = scope.GetBioseqHandle(loc);
194  if (prot_bsh == bsh)
195  return false;
196  return prot_bsh.IsAa();
197 }
198 
199 
200 void CReportTrim::x_AdjustInt(int &begin, int &end, int from, int to, int length, int &diff, ENa_strand strand)
201 {
202  if (begin > from)
203  {
204  begin -= from;
205  }
206  else
207  {
208  if ( strand != eNa_strand_minus )
209  diff += from - begin;
210  begin = 0;
211  }
212 
213  if (end > to)
214  end = to;
215 
216  end -= from;
217 
218  if (end > length - 1)
219  {
220  if ( strand == eNa_strand_minus )
221  diff += end - (length - 1);
222  end = length - 1;
223  }
224 }
225 
226 bool CReportTrim::x_AdjustLocation(CSeq_loc & loc, int length, int from, int to)
227 {
228  int diff = 0;
229  return x_AdjustLocation(loc, length, from, to, diff);
230 }
231 
232 bool CReportTrim::x_AdjustLocation(CSeq_loc & loc, int length, int from, int to, int &diff)
233 {
234  ENa_strand strand = loc.GetStrand();
235 
236  switch (loc.Which())
237  {
238 
239  case CSeq_loc::e_Int :
240  {
241  CSeq_interval &interval = loc.SetInt();
242  int begin = interval.GetFrom();
243  int end = interval.GetTo();
244  if (end < from || begin > to)
245  return true;
246 
247  x_AdjustInt(begin, end, from, to, length, diff, strand);
248  interval.SetFrom(begin);
249  interval.SetTo(end);
250  }
251  break;
252  case CSeq_loc::e_Pnt :
253  {
254  CSeq_point &pnt = loc.SetPnt();
255  int point = pnt.GetPoint();
256  if (point < from || point > to)
257  return true;
258 
259  pnt.SetPoint(point - from);
260  }
261  break;
263  {
264  if (loc.SetPacked_int().IsSet())
265  {
266  vector<CPacked_seqint::Tdata::iterator> del;
267  for (CPacked_seqint::Tdata::iterator p = loc.SetPacked_int().Set().begin(); p != loc.SetPacked_int().Set().end(); ++p)
268  {
269  CSeq_interval &interval = **p;
270  int begin = interval.GetFrom();
271  int end = interval.GetTo();
272  if (end < from || begin > to)
273  {
274  if ( strand == eNa_strand_minus && begin > to)
275  diff += end-begin;
276  else if (strand != eNa_strand_minus && end < from)
277  diff += end-begin;
278  del.push_back(p);
279  continue;
280  }
281  x_AdjustInt(begin, end, from, to, length, diff, strand);
282  interval.SetFrom(begin);
283  interval.SetTo(end);
284  }
285  for (unsigned int i=0; i<del.size(); i++)
286  {
287  CPacked_seqint::Tdata::iterator p = del[i];
288  loc.SetPacked_int().Set().erase(p);
289  }
290  if (loc.SetPacked_int().Set().empty())
291  return true;
292  }
293  }
294  break;
296  {
297  if (loc.SetPacked_pnt().IsSetPoints())
298  {
299  vector<CPacked_seqpnt::TPoints::iterator> del;
300  for (CPacked_seqpnt::TPoints::iterator p = loc.SetPacked_pnt().SetPoints().begin(); p != loc.SetPacked_pnt().SetPoints().end(); ++p)
301  {
302  int point = *p;
303  if (point < from || point > to)
304  {
305  if ( strand == eNa_strand_minus && point > to)
306  diff++;
307  else if (strand != eNa_strand_minus && point < from)
308  diff++;
309  del.push_back(p);
310  continue;
311  }
312  *p = point - from;
313  }
314  for (unsigned int i=0; i<del.size(); i++)
315  {
316  CPacked_seqpnt::TPoints::iterator p = del[i];
317  loc.SetPacked_pnt().SetPoints().erase(p);
318  }
319  if (loc.SetPacked_pnt().SetPoints().empty())
320  return true;
321  }
322  }
323  break;
324  case CSeq_loc::e_Mix :
325  {
326  if (loc.SetMix().IsSet())
327  {
328  vector<CSeq_loc_mix::Tdata::iterator> del;
329  for (CSeq_loc_mix::Tdata::iterator p = loc.SetMix().Set().begin(); p != loc.SetMix().Set().end(); ++p)
330  {
331  CSeq_loc &loc2 = **p;
332  if (x_AdjustLocation(loc2, length, from,to,diff))
333  del.push_back(p);
334  }
335  for (unsigned int i=0; i<del.size(); i++)
336  {
337  CSeq_loc_mix::Tdata::iterator p = del[i];
338  loc.SetMix().Set().erase(p);
339  }
340  if (loc.SetMix().Set().empty())
341  return true;
342  }
343  }
344  break;
345  case CSeq_loc::e_Equiv :
346  {
347  if (loc.SetEquiv().IsSet())
348  {
349  vector<CSeq_loc_equiv::Tdata::iterator> del;
350  for (CSeq_loc_equiv::Tdata::iterator p = loc.SetEquiv().Set().begin(); p != loc.SetEquiv().Set().end(); ++p)
351  {
352  CSeq_loc &loc2 = **p;
353  int orig_diff = diff;
354  if (x_AdjustLocation(loc2, length, from,to,orig_diff))
355  del.push_back(p);
356  if (p == loc.SetEquiv().Set().begin())
357  diff = orig_diff;
358  }
359  for (unsigned int i=0; i<del.size(); i++)
360  {
361  CSeq_loc_equiv::Tdata::iterator p = del[i];
362  loc.SetEquiv().Set().erase(p);
363  }
364  if (loc.SetEquiv().Set().empty())
365  return true;
366  }
367  }
368  break;
369  default : break;
370  }
371 
372  return false;
373 }
374 
376 {
377  // adjust frame to maintain consistency
378  if (feat->GetData().IsCdregion()) {
379  int orig_frame = 0;
380  if (feat->GetData().GetCdregion().IsSetFrame()) {
381  if (feat->GetData().GetCdregion().GetFrame() == CCdregion::eFrame_two) {
382  orig_frame = 1;
383  } else if (feat->GetData().GetCdregion().GetFrame() == CCdregion::eFrame_three) {
384  orig_frame = 2;
385  }
386  }
387  int new_offset = (orig_frame - diff) % 3;
388  if (orig_frame < diff && new_offset != 0)
389  {
390  new_offset = 3 - ((diff - orig_frame) % 3);
391  }
392 
394  switch (new_offset) {
395  case 0:
396  new_frame = CCdregion::eFrame_one;
397  break;
398  case 1:
399  new_frame = CCdregion::eFrame_two;
400  break;
401  case 2:
402  new_frame = CCdregion::eFrame_three;
403  break;
404  default:
405  new_frame = CCdregion::eFrame_not_set;
406  break;
407  }
408  feat->SetData().SetCdregion().SetFrame(new_frame);
409  }
410 }
411 
413 {
414  // Assumption: cds has been verified to be Cdregion with Product
415 
416  // Use Cdregion.Product to get handle to protein bioseq
417  CBioseq_Handle prot_bsh = scope.GetBioseqHandle(cds->GetProduct());
418 
419  // Should be a protein!
420  if (!prot_bsh.IsProtein())
421  {
422  return;
423  }
424 
425  string prot;
426  try
427  {
428  CSeqTranslator::Translate(*cds, scope, prot);
429  }
430  catch(CSeqMapException&) {}
431  if (!prot.empty())
432  {
433  if (NStr::EndsWith(prot, "*"))
434  {
435  prot = prot.substr(0, prot.length() - 1);
436  }
437  // Make a copy of existing CSeq_inst
438  CRef<objects::CSeq_inst> new_inst(new objects::CSeq_inst());
439  new_inst->Assign(prot_bsh.GetInst());
440  new_inst->ResetExt();
441  new_inst->SetRepr(objects::CSeq_inst::eRepr_raw);
442  new_inst->SetSeq_data().SetNcbieaa().Set(prot);
443  new_inst->SetLength(TSeqPos(prot.length()));
444  new_inst->SetMol(CSeq_inst::eMol_aa);
445  // Update protein sequence data and length
446  CRef<CCmdChangeBioseqInst> chgInst (new CCmdChangeBioseqInst(prot_bsh, *new_inst));
447  command->AddCommand(*chgInst);
448 
449  CSeq_loc_Mapper map_to_nuc(old_cds, CSeq_loc_Mapper::eProductToLocation, &scope);
450  map_to_nuc.SetMergeAbutting();
451  CSeq_loc_Mapper map_to_prot(*cds, CSeq_loc_Mapper::eLocationToProduct, &scope);
452  map_to_prot.SetMergeAbutting();
453 
454  CFeat_CI prot_feat_ci(prot_bsh);
455  for ( ; prot_feat_ci; ++prot_feat_ci )
456  {
457  CRef<CSeq_feat> new_feat(new CSeq_feat());
458  new_feat->Assign(prot_feat_ci->GetOriginalFeature());
459  if (prot_feat_ci->GetFeatSubtype() == CSeqFeatData::eSubtype_prot)
460  {
461  new_feat->SetLocation().SetInt().SetFrom(0);
462  new_feat->SetLocation().SetInt().SetTo(new_inst->GetLength() - 1);
463  CIRef<IEditCommand> chgFeat(new CCmdChangeSeq_feat(*prot_feat_ci, *new_feat));
464  command->AddCommand(*chgFeat);
465  }
466  else
467  {
468  CSeq_feat_Handle fh = prot_feat_ci->GetSeq_feat_Handle();
469  const CSeq_loc &loc = prot_feat_ci->GetLocation();
470  CRef<CSeq_loc> nuc_loc = map_to_nuc.Map(loc);
471  CRef<CSeq_loc> prot_loc = map_to_prot.Map(*nuc_loc);
472 
473  if (prot_loc->IsNull())
474  {
475  CIRef<IEditCommand> delFeat(new CCmdDelSeq_feat(fh));
476  command->AddCommand(*delFeat);
477  }
478  else
479  {
480  prot_loc->SetPartialStart(loc.IsPartialStart(eExtreme_Biological), eExtreme_Biological);
481  prot_loc->SetPartialStop(loc.IsPartialStop(eExtreme_Biological), eExtreme_Biological);
482  new_feat->SetLocation().Assign(*prot_loc);
484 
485  CIRef<IEditCommand> chgFeat(new CCmdChangeSeq_feat(fh, *new_feat));
486  command->AddCommand(*chgFeat);
487  }
488  }
489  }
490  }
491 }
492 
494 {
495  // Adjust alignments
497  CAlign_CI align_ci(bsh, align_sel);
498  for (; align_ci; ++align_ci)
499  {
500  // So far, handle DENSEG type only
501  const CSeq_align& align = *align_ci;
502  if ( align.CanGetSegs() &&
504  {
505  // Make sure mandatory fields are present in the denseg
506  const CDense_seg& denseg = align.GetSegs().GetDenseg();
507  if (! (denseg.CanGetDim() && denseg.CanGetNumseg() &&
508  denseg.CanGetIds() && denseg.CanGetStarts() &&
509  denseg.CanGetLens()) )
510  {
511  continue;
512  }
513 
514  // Make a copy of the alignment
515  CRef<CSeq_align> new_align(new CSeq_align());
516  new_align->Assign(align_ci.GetOriginalSeq_align());
517 
518  // Make edits to the copy
519 
520  // On which "row" does the seqid lie?
521  const CDense_seg::TIds& ids = denseg.GetIds();
522  CDense_seg::TDim row = -1;
523  for (CBioseq::TId::const_iterator seqid = seqids.begin(); seqid != seqids.end(); ++seqid)
524  for (unsigned int ii = 0; ii < ids.size(); ++ii) {
525  if ( ids[ii]->Match(**seqid) ) {
526  row = ii;
527  break;
528  }
529  }
530  if ( row < 0 || !denseg.CanGetDim() || row >= denseg.GetDim() ) {
531  continue;
532  }
533 
534  x_AdjustDensegAlignment(new_align, row, from, to);
535 
536 
537  // Swap edited copy with the original alignment
538  CIRef<IEditCommand> chgAlign( new CCmdChangeAlign( align_ci.GetSeq_align_Handle(), *new_align ));
539  command->AddCommand(*chgAlign);
540 
541  }
542  else {
543  // For other alignment types, delete them. This is what
544  // C Toolkit does (see AdjustAlignmentsInAnnot)
545  CIRef<IEditCommand> delAlign(
546  new CCmdDelSeq_align( align_ci.GetSeq_align_Handle() ));
547  command->AddCommand(*delAlign);
548  }
549  }
550 }
551 
554  TSeqPos cut_from,
555  TSeqPos cut_to)
556 {
557  TSeqPos cut_len = cut_to - cut_from + 1;
558  if (cut_to < cut_from) {
559  cut_len = cut_from - cut_to + 1;
560  cut_from = cut_to;
561  }
562 
563  // Note: row is 0-based
564 
565  // May need to cut the segment at both start and stop positions
566  // if they do not fall on segment boundaries
567  x_CutDensegSegment(align, row, cut_from);
568  x_CutDensegSegment(align, row, cut_from + cut_len);
569 
570  // Update segment start values for the trimmed sequence row
571  const CDense_seg& denseg = align->GetSegs().GetDenseg();
572  for (CDense_seg::TNumseg curseg = 0; curseg < denseg.GetNumseg(); ++curseg) {
573  TSeqPos index = curseg * denseg.GetDim() + row;
574  TSeqPos seg_start = denseg.GetStarts()[index];
575  if (seg_start < 0) {
576  // This indicates a gap, no change needed
577  }
578  else if (seg_start < cut_from) {
579  // This is before the cut, no change needed
580  }
581  else if (seg_start >= cut_from &&
582  seg_start + denseg.GetLens()[curseg] <= cut_from + cut_len) {
583  // This is in the gap, indicate it with a -1
584  align->SetSegs().SetDenseg().SetStarts()[index] = -1;
585  }
586  else {
587  // This is after the cut - subtract the cut_len
588  align->SetSegs().SetDenseg().SetStarts()[index] -= cut_len;
589  }
590  }
591 
592 }
593 
596  TSeqPos pos)
597 {
598  // Find the segment where pos occurs for the sequence (identified by
599  // row).
600  // If pos is not the start of the segment, cut the segment in two, with
601  // one of the segments using pos as the new start.
602 
603 
604  // Find the segment where pos lies
605  const CDense_seg& denseg = align->GetSegs().GetDenseg();
606  CDense_seg::TNumseg foundseg;
607  TSeqPos seg_start;
608  if ( !x_FindSegment(denseg, row, pos, foundseg, seg_start) ) {
609  return;
610  }
611 
612  // Found our segment seg
613  // If pos falls on segment boundary, do nothing
614  if (pos == seg_start) {
615  return;
616  }
617 
618 
619  // Cut the segment :
620  // 1) Allocate a new denseg with numseg size = original size + 1
621  // 2) Copy elements before the cut
622  // 3) Split segment at pos
623  // 4) Copy elements after the cut
624  // 5) Replace old denseg with new denseg
625 
626  // Allocate a new denseg with numseg size = original size + 1
627  CRef<CDense_seg> new_denseg(new CDense_seg);
628  new_denseg->SetDim( denseg.GetDim() );
629  new_denseg->SetNumseg( denseg.GetNumseg() + 1 );
630  ITERATE( CDense_seg::TIds, idI, denseg.GetIds() ) {
631  CSeq_id *si = new CSeq_id;
632  si->Assign(**idI);
633  new_denseg->SetIds().push_back( CRef<CSeq_id>(si) );
634  }
635 
636  // Copy elements (starts, lens, strands) before the cut (up to and including
637  // foundseg-1 in original denseg)
638  for (CDense_seg::TNumseg curseg = 0; curseg < foundseg; ++curseg) {
639  // Copy starts
640  for (CDense_seg::TDim curdim = 0; curdim < denseg.GetDim(); ++curdim) {
641  TSeqPos index = curseg * denseg.GetDim() + curdim;
642  new_denseg->SetStarts().push_back( denseg.GetStarts()[index] );
643  }
644 
645  // Copy lens
646  new_denseg->SetLens().push_back( denseg.GetLens()[curseg] );
647 
648  // Copy strands
649  if ( denseg.IsSetStrands() ) {
650  for (CDense_seg::TDim curdim = 0; curdim < denseg.GetDim();
651  ++curdim)
652  {
653  TSeqPos index = curseg * denseg.GetDim() + curdim;
654  new_denseg->SetStrands().push_back(denseg.GetStrands()[index]);
655  }
656  }
657  }
658 
659  // Split segment at pos
660  // First find the lengths of the split segments, first_len and second_len
661  TSeqPos first_len, second_len;
662  TSeqPos index = foundseg * denseg.GetDim() + row;
663  if ( !denseg.IsSetStrands() || denseg.GetStrands()[index] != eNa_strand_minus )
664  {
665  first_len = pos - seg_start;
666  second_len = denseg.GetLens()[foundseg] - first_len;
667  }
668  else {
669  second_len = pos - seg_start;
670  first_len = denseg.GetLens()[foundseg] - second_len;
671  }
672 
673  // Set starts, strands, and lens for the split segments (foundseg and foundseg+1)
674  // Populate foundseg in new denseg
675  for (CDense_seg::TDim curdim = 0; curdim < denseg.GetDim(); ++curdim) {
676  TSeqPos index = foundseg * denseg.GetDim() + curdim;
677  if (denseg.GetStarts()[index] == -1) {
678  new_denseg->SetStarts().push_back(-1);
679  }
680  else if (!denseg.IsSetStrands() || denseg.GetStrands()[index] != eNa_strand_minus) {
681  new_denseg->SetStarts().push_back(denseg.GetStarts()[index]);
682  }
683  else {
684  new_denseg->SetStarts().push_back(denseg.GetStarts()[index] + second_len);
685  }
686 
687  if (denseg.IsSetStrands()) {
688  new_denseg->SetStrands().push_back(denseg.GetStrands()[index]);
689  }
690  }
691  new_denseg->SetLens().push_back(first_len);
692  // Populate foundseg+1 in new denseg
693  for (CDense_seg::TDim curdim = 0; curdim < denseg.GetDim(); ++curdim) {
694  TSeqPos index = foundseg * denseg.GetDim() + curdim;
695  if (denseg.GetStarts()[index] == -1) {
696  new_denseg->SetStarts().push_back(-1);
697  }
698  else if (!denseg.IsSetStrands() || denseg.GetStrands()[index] != eNa_strand_minus) {
699  new_denseg->SetStarts().push_back(denseg.GetStarts()[index] + first_len);
700  }
701  else {
702  new_denseg->SetStarts().push_back(denseg.GetStarts()[index]);
703  }
704 
705  if (denseg.IsSetStrands()) {
706  new_denseg->SetStrands().push_back(denseg.GetStrands()[index]);
707  }
708  }
709  new_denseg->SetLens().push_back(second_len);
710 
711  // Copy elements (starts, lens, strands) after the cut (starting from foundseg+1 in
712  // original denseg)
713  for (CDense_seg::TNumseg curseg = foundseg+1; curseg < denseg.GetNumseg(); ++curseg) {
714  // Copy starts
715  for (CDense_seg::TDim curdim = 0; curdim < denseg.GetDim(); ++curdim) {
716  TSeqPos index = curseg * denseg.GetDim() + curdim;
717  new_denseg->SetStarts().push_back( denseg.GetStarts()[index] );
718  }
719 
720  // Copy lens
721  new_denseg->SetLens().push_back( denseg.GetLens()[curseg] );
722 
723  // Copy strands
724  if ( denseg.IsSetStrands() ) {
725  for (CDense_seg::TDim curdim = 0; curdim < denseg.GetDim();
726  ++curdim)
727  {
728  TSeqPos index = curseg * denseg.GetDim() + curdim;
729  new_denseg->SetStrands().push_back(denseg.GetStrands()[index]);
730  }
731  }
732  }
733 
734  // Update
735  align->SetSegs().SetDenseg(*new_denseg);
736 }
737 
740  TSeqPos pos,
741  CDense_seg::TNumseg& seg,
742  TSeqPos& seg_start) const
743 {
744  for (seg = 0; seg < denseg.GetNumseg(); ++seg) {
745  TSignedSeqPos start = denseg.GetStarts()[seg * denseg.GetDim() + row];
746  TSignedSeqPos len = denseg.GetLens()[seg];
747  if (start != -1) {
748  if (pos >= start && pos < start + len) {
749  seg_start = start;
750  return true;
751  }
752  }
753  }
754  return false;
755 }
756 
757 
759  TSeqPos from, TSeqPos to,
760  int length,
761  const CRef<CSeq_id> seqid)
762 {
763  bool result = false;
764  if (new_graph->CanGetLoc())
765  {
767  new_loc->Assign(new_graph->GetLoc());
768  result = x_AdjustLocation(*new_loc,length,from,to);
769  new_graph->SetLoc(*new_loc);
770  }
771  return result;
772 }
773 
775  const CMappedGraph& orig_graph,
776  TSeqPos trim_start, TSeqPos trim_stop,
777  int length,
778  const CRef<CSeq_id> seqid)
779 {
780  // Get range that original seqgraph data covers
781  TSeqPos graph_start = new_graph->GetLoc().GetStart(eExtreme_Positional);
782  TSeqPos graph_stop = new_graph->GetLoc().GetStop(eExtreme_Positional);
783 
784  // Determine range over which to copy seqgraph data from old to new
785  TSeqPos copy_start = graph_start;
786  if (trim_start > graph_start) {
787  copy_start = trim_start;
788  }
789  TSeqPos copy_stop = graph_stop;
790  if (trim_stop < graph_stop) {
791  copy_stop = trim_stop;
792  }
793 
794  // Copy over seqgraph data values. Handle BYTE type only (see
795  // C Toolkit's GetGraphsProc function in api/sqnutil2.c)
796  CSeq_graph::TGraph& dst_data = new_graph->SetGraph();
797  dst_data.Reset();
798  const CSeq_graph::TGraph& src_data = orig_graph.GetGraph();
799  switch ( src_data.Which() ) {
801  // Keep original min, max, axis
802  dst_data.SetByte().SetMin(src_data.GetByte().GetMin());
803  dst_data.SetByte().SetMax(src_data.GetByte().GetMax());
804  dst_data.SetByte().SetAxis(src_data.GetByte().GetAxis());
805 
806  // Copy start/stop values are relative to bioseq coordinate system.
807  // Change them so that they are relative to graph location.
808  copy_start -= graph_start;
809  copy_stop -= graph_start;
810 
811  // Update data values
812  dst_data.SetByte().SetValues();
813  dst_data.SetByte().SetValues().insert(
814  dst_data.SetByte().SetValues().end(),
815  src_data.GetByte().GetValues().begin() + copy_start,
816  src_data.GetByte().GetValues().begin() + copy_stop + 1);
817 
818  // Update numvals
819  new_graph->SetNumval(copy_stop - copy_start + 1);
820 
821  // Update seqloc
822  return x_UpdateSeqGraphLoc(new_graph, trim_start, trim_stop, length, seqid);
823  break;
824  default: break;
825  }
826  return false;
827 }
828 
829 
831 {
833  CGraph_CI graph_ci(bsh, graph_sel);
834  for (; graph_ci; ++graph_ci)
835  {
836  // Only certain types of graphs are supported.
837  // See C Toolkit function GetGraphsProc in api/sqnutil2.c
838  const CMappedGraph& graph = *graph_ci;
839  if ( graph.IsSetTitle() &&
840  (NStr::CompareNocase( graph.GetTitle(), "Phrap Quality" ) == 0 ||
841  NStr::CompareNocase( graph.GetTitle(), "Phred Quality" ) == 0 ||
842  NStr::CompareNocase( graph.GetTitle(), "Gap4" ) == 0) )
843  {
844  // Make a copy of the graph
845  CRef<CSeq_graph> new_graph(new CSeq_graph());
846  new_graph->Assign(graph.GetOriginalGraph());
847 
848  // Make edits to the copy
849  for (CBioseq::TId::const_iterator seqid = seqids.begin(); seqid != seqids.end(); ++seqid)
850  {
851  // Find matching seqid referred to by the graph
852  if ( graph.GetLoc().GetId()->Match(**seqid) ) {
853  if (x_TrimSeqGraphData(new_graph, graph, from, to, length, *seqid))
854  {
855  CIRef<IEditCommand> delGraph(new CCmdDelSeq_graph( graph.GetSeq_graph_Handle() ));
856  command->AddCommand(*delGraph);
857  }
858  else
859  {
860  // Swap edited copy with the original graph
861  CIRef<IEditCommand> chgGraph( new CCmdChangeGraph( graph.GetSeq_graph_Handle(), *new_graph ));
862  command->AddCommand(*chgGraph);
863  }
864  break;
865  }
866  }
867  }
868  }
869 }
870 
872 {
873  _ASSERT( bioseq_handle );
874 
875  const CSeqVector seqvec( bioseq_handle, CBioseq_Handle::eCoding_Iupac );
876 
877  // there's already no sequence, so nothing to trim
878  const TSignedSeqPos bioseq_len = bioseq_handle.GetBioseqLength();
879  if( bioseq_len < 1 ) {
880  return eResult_NoTrimNeeded;
881  }
882 
883  TSignedSeqPos leftmost_good_base = 0;
884  TSignedSeqPos rightmost_good_base = bioseq_len - 1;
885  if( ! x_TestFlag(fFlags_DoNotTrimBeginning) ) {
886  leftmost_good_base = x_FindWhereToTrim(
887  seqvec, leftmost_good_base, rightmost_good_base,
888  1 ); // 1 means "towards the right"
889  }
890 
891  if( leftmost_good_base > rightmost_good_base) {
892  if (x_IsThereGapNotAtTheEnd(bioseq_handle, 0, bioseq_len -1, bioseq_len))
893  return eResult_NoTrimNeeded;
894  // trimming leaves nothing left
895  return x_TrimToNothing( bioseq_handle );
896  }
897 
898  if (x_IsThereGapNotAtTheEnd(bioseq_handle, leftmost_good_base, bioseq_len -1, bioseq_len))
899  {
900  leftmost_good_base = 0;
901  }
902 
903  if( ! x_TestFlag(fFlags_DoNotTrimEnd) ) {
904  rightmost_good_base =
905  x_FindWhereToTrim(
906  seqvec, rightmost_good_base, leftmost_good_base,
907  -1 ); // -1 means "towards the left"
908  }
909 
910  if( leftmost_good_base > rightmost_good_base) {
911  if (x_IsThereGapNotAtTheEnd(bioseq_handle, 0, bioseq_len -1, bioseq_len))
912  return eResult_NoTrimNeeded;
913  // trimming leaves nothing left
914  return x_TrimToNothing( bioseq_handle );
915  }
916 
917  if (x_IsThereGapNotAtTheEnd(bioseq_handle, 0, rightmost_good_base, bioseq_len))
918  {
919  rightmost_good_base = bioseq_len -1;
920  }
921 
922  // check if nothing to do
923  if( (leftmost_good_base == 0) &&
924  (rightmost_good_base == (bioseq_len - 1)) )
925  {
926  return eResult_NoTrimNeeded;
927  }
928 
929 
930  // do the actually slicing of the bioseq
931  x_SliceBioseq(
932  leftmost_good_base, rightmost_good_base,
933  bioseq_handle );
934 
935  left = leftmost_good_base;
936  right = rightmost_good_base;
937  return eResult_SuccessfullyTrimmed;
938 }
939 
941 {
943  if (from == 0 && to == length - 1)
944  {
945  bool gap_inside = false;
946  if (!sv.IsInGap(0) && !sv.IsInGap(length - 1))
947  for (TSeqPos pos = 1; pos < length - 1; pos++)
948  if (sv.IsInGap (pos))
949  gap_inside = true;
950  return gap_inside;
951  }
952 
953  bool gap_left = false;
954  if (!sv.IsInGap(0))
955  {
956  for (TSeqPos pos = 1; pos < from; pos++)
957  if (sv.IsInGap (pos))
958  gap_left = true;
959  }
960  bool gap_right = false;
961  if (!sv.IsInGap(length - 1))
962  {
963  for (TSeqPos pos = to + 1; pos < length - 1; pos++)
964  if (sv.IsInGap (pos))
965  gap_right = true;
966  }
967  return gap_left || gap_right;
968 }
969 
@ eExtreme_Positional
numerical value
Definition: Na_strand.hpp:63
@ eExtreme_Biological
5' and 3'
Definition: Na_strand.hpp:62
CAlign_CI –.
Definition: align_ci.hpp:63
CBioseq_Handle –.
CBioseq_set_Handle –.
CClone_seq_set –.
CFeat_CI –.
Definition: feat_ci.hpp:64
CGraph_CI –.
Definition: graph_ci.hpp:234
CMappedGraph –.
Definition: graph_ci.hpp:61
virtual EResult Trim(objects::CBioseq_Handle &bioseq_handle, TSignedSeqPos &left, TSignedSeqPos &right)
void x_UpdateVariation(objects::CVariation_ref &var, int length, int from, int to)
bool x_TrimSeqGraphData(CRef< objects::CSeq_graph > new_graph, const objects::CMappedGraph &orig_graph, TSeqPos trim_start, TSeqPos trim_stop, int length, const CRef< objects::CSeq_id > seqid)
bool x_IsThereGapNotAtTheEnd(objects::CBioseq_Handle bsh, TSignedSeqPos from, TSignedSeqPos to, int length)
void TrimAlignments(CRef< CCmdComposite > command, objects::CBioseq_Handle bsh, const objects::CBioseq::TId &seqids, TSeqPos from, TSeqPos to)
void AdjustAndTranslate(objects::CBioseq_Handle bsh, int length, int from, int to, CRef< CCmdComposite > command, objects::CScope &scope, map< objects::CBioseq_Handle, set< objects::CSeq_feat_Handle > > &product_to_cds)
Definition: report_trim.cpp:48
bool x_UpdateSeqGraphLoc(CRef< objects::CSeq_graph > new_graph, TSeqPos from, TSeqPos to, int length, const CRef< objects::CSeq_id > seqid)
bool x_FindSegment(const objects::CDense_seg &denseg, objects::CDense_seg::TDim row, TSeqPos pos, objects::CDense_seg::TNumseg &seg, TSeqPos &seg_start) const
void x_AdjustCdregionFrame(CRef< objects::CSeq_feat > feat, int diff)
bool x_AdjustLocation(objects::CSeq_loc &loc, int length, int from, int to, int &diff)
void TrimSeqGraphs(CRef< CCmdComposite > command, objects::CBioseq_Handle bsh, const objects::CBioseq::TId &seqids, TSeqPos from, TSeqPos to, int length)
void x_RetranslateCDS(objects::CScope &scope, CRef< CCmdComposite > command, CRef< objects::CSeq_feat > cds, const objects::CSeq_feat &old_cds)
void x_AdjustInt(int &begin, int &end, int from, int to, int length, int &diff, objects::ENa_strand strand)
void x_CutDensegSegment(CRef< objects::CSeq_align > align, objects::CDense_seg::TDim row, TSeqPos pos)
void x_AdjustDensegAlignment(CRef< objects::CSeq_align > align, objects::CDense_seg::TDim row, TSeqPos cut_from, TSeqPos cut_to)
bool x_IsProtLocation(const objects::CSeq_loc &loc, objects::CBioseq_Handle bsh, objects::CScope &scope)
CScope –.
Definition: scope.hpp:92
SeqMap related exceptions.
CSeqVector –.
Definition: seq_vector.hpp:65
CSeq_entry_Handle –.
CSeq_feat_Handle –.
namespace ncbi::objects::
Definition: Seq_feat.hpp:58
CSeq_loc_Mapper –.
Definition: map.hpp:338
Definition: set.hpp:45
constexpr auto begin(const ct_const_array< T, N > &in) noexcept
constexpr auto end(const ct_const_array< T, N > &in) noexcept
static const char si[8][64]
Definition: des.c:146
static CS_COMMAND * cmd
Definition: ct_dynamic.c:26
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
int TSignedSeqPos
Type for signed sequence position.
Definition: ncbimisc.hpp:887
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
bool IsPartialStart(ESeqLocExtremes ext) const
check start or stop of location for e_Lim fuzz
Definition: Seq_loc.cpp:3222
TSeqPos GetStart(ESeqLocExtremes ext) const
Return start and stop positions of the seq-loc.
Definition: Seq_loc.cpp:915
void SetPartialStart(bool val, ESeqLocExtremes ext)
set / remove e_Lim fuzz on start or stop (lt/gt - indicating partial interval)
Definition: Seq_loc.cpp:3280
void SetPartialStop(bool val, ESeqLocExtremes ext)
Definition: Seq_loc.cpp:3313
bool IsPartialStop(ESeqLocExtremes ext) const
Definition: Seq_loc.cpp:3251
TSeqPos GetStop(ESeqLocExtremes ext) const
Definition: Seq_loc.cpp:963
EResult
This indicates what happened with the trim.
Definition: sequence.hpp:1352
static void Translate(const string &seq, string &prot, const CGenetic_code *code, bool include_stop=true, bool remove_trailing_X=false, bool *alt_start=NULL, bool is_5prime_complete=true, bool is_3prime_complete=true)
Translate a string using a specified genetic code.
Definition: sequence.cpp:4095
CRef< CSeq_loc > Map(const CSeq_loc &src_loc)
Map seq-loc.
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
Definition: scope.cpp:95
CSeq_loc_Mapper_Base & SetMergeAbutting(void)
Merge only abutting intervals, keep overlapping.
@ eProductToLocation
Map from the feature's product to location.
@ eLocationToProduct
Map from the feature's location to product.
TClass GetClass(void) const
CBioseq_set_Handle GetParentBioseq_set(void) const
Return a handle for the parent Bioseq-set, or null handle.
CSeq_entry_Handle GetParentEntry(void) const
Get parent Seq-entry handle.
const CSeqFeatData & GetData(void) const
TSeqPos GetBioseqLength(void) const
bool IsAa(void) const
bool IsSetProduct(void) const
bool IsProtein(void) const
CSeq_entry_Handle GetParentEntry(void) const
Return a handle for the parent seq-entry of the bioseq.
bool IsSetClass(void) const
CSeqFeatData::ESubtype GetFeatSubtype(void) const
bool IsSetData(void) const
CSeqVector GetSeqVector(EVectorCoding coding, ENa_strand strand=eNa_strand_plus) const
Get sequence: Iupacna or Iupacaa if use_iupac_coding is true.
const TInst & GetInst(void) const
@ eCoding_Iupac
Set coding to printable coding (Iupacna or Iupacaa)
const string & GetTitle(void) const
Definition: graph_ci.hpp:112
bool IsSetTitle(void) const
Definition: graph_ci.hpp:108
const CSeq_align & GetOriginalSeq_align(void) const
Get original alignment.
Definition: align_ci.cpp:225
const CSeq_loc & GetLocation(void) const
const CSeq_feat & GetOriginalFeature(void) const
Get original feature with unmapped location/product.
const CSeq_feat_Handle & GetSeq_feat_Handle(void) const
Get original feature handle.
Definition: mapped_feat.hpp:71
const CSeq_graph & GetOriginalGraph(void) const
Get original graph with unmapped location/product.
Definition: graph_ci.hpp:70
const CSeq_loc & GetLoc(void) const
Definition: graph_ci.hpp:126
CSeq_align_Handle GetSeq_align_Handle(void) const
Get original alignment handle.
Definition: align_ci.cpp:233
const CSeq_graph::C_Graph & GetGraph(void) const
Definition: graph_ci.cpp:192
CSeq_graph_Handle GetSeq_graph_Handle(void) const
Get original graph handle.
Definition: graph_ci.cpp:93
bool IsInGap(TSeqPos pos) const
true if sequence at 0-based position 'pos' has gap Note: this method is not MT-safe,...
Definition: seq_vector.hpp:277
#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 int CompareNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive compare of a substring with another string.
Definition: ncbistr.cpp:219
static bool EndsWith(const CTempString str, const CTempString end, ECase use_case=eCase)
Check if a string ends with a specified suffix value.
Definition: ncbistr.hpp:5430
static SIZE_TYPE Find(const CTempString str, const CTempString pattern, ECase use_case=eCase, EDirection direction=eForwardSearch, SIZE_TYPE occurrence=0)
Find the pattern in the string.
Definition: ncbistr.cpp:2891
bool IsTRNA(void) const
Check if variant TRNA is selected.
Definition: RNA_ref_.hpp:498
bool IsSetAnticodon(void) const
location of anticodon Check if a value has been assigned to Anticodon data member.
Definition: Trna_ext_.hpp:637
bool IsSetExt(void) const
generic fields for ncRNA, tmRNA, miscRNA Check if a value has been assigned to Ext data member.
Definition: RNA_ref_.hpp:604
const TExt & GetExt(void) const
Get the Ext member data.
Definition: RNA_ref_.hpp:616
const TTRNA & GetTRNA(void) const
Get the variant data.
Definition: RNA_ref_.cpp:134
bool CanGetDim(void) const
Check if it is safe to call GetDim method.
Definition: Dense_seg_.hpp:402
const TDenseg & GetDenseg(void) const
Get the variant data.
Definition: Seq_align_.cpp:153
TLens & SetLens(void)
Assign a value to Lens data member.
Definition: Dense_seg_.hpp:561
E_Choice Which(void) const
Which variant is currently selected.
Definition: Seq_align_.hpp:691
bool IsSetStrands(void) const
Check if a value has been assigned to Strands data member.
Definition: Dense_seg_.hpp:568
const TStarts & GetStarts(void) const
Get the Starts member data.
Definition: Dense_seg_.hpp:530
void SetSegs(TSegs &value)
Assign a value to Segs data member.
Definition: Seq_align_.cpp:310
const TLens & GetLens(void) const
Get the Lens member data.
Definition: Dense_seg_.hpp:555
bool CanGetNumseg(void) const
Check if it is safe to call GetNumseg method.
Definition: Dense_seg_.hpp:452
void SetDim(TDim value)
Assign a value to Dim data member.
Definition: Dense_seg_.hpp:427
bool CanGetIds(void) const
Check if it is safe to call GetIds method.
Definition: Dense_seg_.hpp:499
vector< CRef< CSeq_id > > TIds
Definition: Dense_seg_.hpp:106
bool CanGetSegs(void) const
Check if it is safe to call GetSegs method.
Definition: Seq_align_.hpp:915
TDim GetDim(void) const
Get the Dim member data.
Definition: Dense_seg_.hpp:421
TStarts & SetStarts(void)
Assign a value to Starts data member.
Definition: Dense_seg_.hpp:536
TStrands & SetStrands(void)
Assign a value to Strands data member.
Definition: Dense_seg_.hpp:586
void SetNumseg(TNumseg value)
Assign a value to Numseg data member.
Definition: Dense_seg_.hpp:474
const TIds & GetIds(void) const
Get the Ids member data.
Definition: Dense_seg_.hpp:505
bool CanGetStarts(void) const
Check if it is safe to call GetStarts method.
Definition: Dense_seg_.hpp:524
TNumseg GetNumseg(void) const
Get the Numseg member data.
Definition: Dense_seg_.hpp:465
TIds & SetIds(void)
Assign a value to Ids data member.
Definition: Dense_seg_.hpp:511
const TStrands & GetStrands(void) const
Get the Strands member data.
Definition: Dense_seg_.hpp:580
const TSegs & GetSegs(void) const
Get the Segs member data.
Definition: Seq_align_.hpp:921
bool CanGetLens(void) const
Check if it is safe to call GetLens method.
Definition: Dense_seg_.hpp:549
const TClone & GetClone(void) const
Get the variant data.
bool IsSetData(void) const
the specific data Check if a value has been assigned to Data data member.
Definition: Seq_feat_.hpp:913
void SetLocation(TLocation &value)
Assign a value to Location data member.
Definition: Seq_feat_.cpp:131
bool IsCdregion(void) const
Check if variant Cdregion is selected.
Tdata & Set(void)
Assign a value to data member.
void SetPartial(TPartial value)
Assign a value to Partial data member.
Definition: Seq_feat_.hpp:971
const TLocation & GetLocation(void) const
Get the Location member data.
Definition: Seq_feat_.hpp:1117
TFrame GetFrame(void) const
Get the Frame member data.
Definition: Cdregion_.hpp:534
const TData & GetData(void) const
Get the Data member data.
Definition: Seq_feat_.hpp:925
const TExcept_text & GetExcept_text(void) const
Get the Except_text member data.
Definition: Seq_feat_.hpp:1405
bool IsSetExcept_text(void) const
explain if except=TRUE Check if a value has been assigned to Except_text data member.
Definition: Seq_feat_.hpp:1393
void SetData(TData &value)
Assign a value to Data data member.
Definition: Seq_feat_.cpp:94
const TCdregion & GetCdregion(void) const
Get the variant data.
const TProduct & GetProduct(void) const
Get the Product member data.
Definition: Seq_feat_.hpp:1096
bool IsClone(void) const
Check if variant Clone is selected.
bool IsVariation(void) const
Check if variant Variation is selected.
bool IsSet(void) const
Check if a value has been assigned to data member.
const TRna & GetRna(void) const
Get the variant data.
const TCode_break & GetCode_break(void) const
Get the Code_break member data.
Definition: Cdregion_.hpp:733
bool IsRna(void) const
Check if variant Rna is selected.
bool IsSetCode_break(void) const
individual exceptions Check if a value has been assigned to Code_break data member.
Definition: Cdregion_.hpp:721
bool IsSetClone_seq(void) const
Check if a value has been assigned to Clone_seq data member.
Definition: Clone_ref_.hpp:634
bool IsSetFrame(void) const
Check if a value has been assigned to Frame data member.
Definition: Cdregion_.hpp:509
@ eFrame_not_set
not set, code uses one
Definition: Cdregion_.hpp:95
@ eFrame_three
reading frame
Definition: Cdregion_.hpp:98
void SetTo(TTo value)
Assign a value to To data member.
void SetPoint(TPoint value)
Assign a value to Point data member.
Definition: Seq_point_.hpp:312
ENa_strand
strand of nucleic acid
Definition: Na_strand_.hpp:64
TPoint GetPoint(void) const
Get the Point member data.
Definition: Seq_point_.hpp:303
TFrom GetFrom(void) const
Get the From member data.
void SetFrom(TFrom value)
Assign a value to From data member.
TTo GetTo(void) const
Get the To member data.
bool IsNull(void) const
Check if variant Null is selected.
Definition: Seq_loc_.hpp:504
@ eNa_strand_minus
Definition: Na_strand_.hpp:67
@ e_Equiv
equivalent sets of locations
Definition: Seq_loc_.hpp:106
@ e_Int
from to
Definition: Seq_loc_.hpp:101
void SetMin(TMin value)
Assign a value to Min data member.
TByte & SetByte(void)
Select the variant.
Definition: Seq_graph_.cpp:159
void SetNumval(TNumval value)
Assign a value to Numval data member.
TAxis GetAxis(void) const
Get the Axis member data.
TValues & SetValues(void)
Assign a value to Values data member.
TMax GetMax(void) const
Get the Max member data.
const TByte & GetByte(void) const
Get the variant data.
Definition: Seq_graph_.cpp:153
void SetGraph(TGraph &value)
Assign a value to Graph data member.
Definition: Seq_graph_.cpp:250
bool CanGetLoc(void) const
Check if it is safe to call GetLoc method.
Definition: Seq_graph_.hpp:863
void SetMax(TMax value)
Assign a value to Max data member.
TMin GetMin(void) const
Get the Min member data.
const TValues & GetValues(void) const
Get the Values member data.
E_Choice Which(void) const
Which variant is currently selected.
Definition: Seq_graph_.hpp:716
void SetLoc(TLoc &value)
Assign a value to Loc data member.
Definition: Seq_graph_.cpp:224
const TLoc & GetLoc(void) const
Get the Loc member data.
Definition: Seq_graph_.hpp:869
void SetAxis(TAxis value)
Assign a value to Axis data member.
void Reset(void)
Reset the whole object.
Definition: Seq_graph_.cpp:54
@ eClass_nuc_prot
nuc acid and coded proteins
Definition: Bioseq_set_.hpp:99
list< CRef< CSeq_id > > TId
Definition: Bioseq_.hpp:94
const TInstance & GetInstance(void) const
Get the variant data.
const TSet & GetSet(void) const
Get the variant data.
bool IsSetDelta(void) const
Sequence that replaces the location, in biological order.
TConsequence & SetConsequence(void)
Assign a value to Consequence data member.
const TDelta & GetDelta(void) const
Get the Delta member data.
void SetData(TData &value)
Assign a value to Data data member.
bool IsSetConsequence(void) const
Check if a value has been assigned to Consequence data member.
const TData & GetData(void) const
Get the Data member data.
bool IsInstance(void) const
Check if variant Instance is selected.
bool IsSet(void) const
Check if variant Set is selected.
bool IsSetVariations(void) const
Check if a value has been assigned to Variations data member.
bool IsSetData(void) const
Check if a value has been assigned to Data data member.
int i
int len
const char * command
#define EDIT_EACH_CODEBREAK_ON_CDREGION(Itr, Var)
#define ERASE_CODEBREAK_ON_CDREGION(Itr, Var)
ERASE_CODEBREAK_ON_CDREGION.
#define row(bind, expected)
Definition: string_bind.c:73
SAnnotSelector –.
#define _ASSERT
else result
Definition: token2.c:20
CRef< CCmdComposite > GetDeleteFeatureCommand(const objects::CSeq_feat_Handle &fh, bool remove_proteins=true)
Modified on Thu May 23 12:26:07 2024 by modify_doxy.py rev. 669887