create_xref_map =
true;
68create_xref_map =
false;
69 return apply_impl(
objects, to_known, adjust_features, old_to_new, create_xref_map);
77 boolcreate_general_only =
false;
83 const CGapEdit* gap_edit =
dynamic_cast<const CGapEdit*
>((*it).object.GetPointer());
92bsh = scope->GetBioseqHandle(feat->
GetLocation());
97 if(bsh_to_inst.
find(bsh) != bsh_to_inst.
end())
114bsh_to_inst[bsh] = make_pair(new_inst,
false);
124 const CGapEdit* gap_edit =
dynamic_cast<const CGapEdit*
>((*it).object.GetPointer());
130 const CSeq_feat* feat =
dynamic_cast<const CSeq_feat*
>((*it).object.GetPointer());
140 for(
const auto& d : diffs[bsh])
150 if(delta_i->Empty())
159 else if(seg.
IsLoc())
176diffs[bsh][start] = diff;
178new_inst->
SetLength(old_length + diff);
182NRawToDeltaSeq::SGap gap;
184gap.length = delta_len;
185gap.is_known =
false;
186gap.is_replace =
true;
187gaps[bsh].push_back(gap);
190bsh_to_inst[bsh].second =
true;
220 if(!bsh_to_inst[bsh].second && new_inst->
IsSetLength())
222diffs[bsh][start] = diff;
224new_inst->
SetLength(old_length + diff);
226NRawToDeltaSeq::SGap gap;
228gap.length = delta_len;
229gap.is_known =
false;
230gap.is_replace =
true;
231gaps[bsh].push_back(gap);
233bsh_to_inst[bsh].second =
true;
261 for(
const auto& it : bsh_to_inst)
265 boolmodified = it.second.second;
285wxTextEntryDialog dlg(
NULL,
_(
"Convert gaps longer or equal to"),
_(
"Convert Known Length Gaps to Unknown"),
_(
"100"));
286dlg.SetTextValidator(wxFILTER_NUMERIC);
287 if(dlg.ShowModal() == wxID_OK)
289wxString
val= dlg.GetValue();
291 if(
val.ToLong(&min_size))
293 CScope&scope = seh.GetScope();
308 boolhas_loc(
false);
311 if( (*iter)->IsLoc() )
326 if(delta_i->Empty())
330 if(sv.
IsInGap(pos) && (
long)delta_len >= min_size &&
343}
catch(
CException) {}
catch(std::exception ) {}
359 boolcreate_xref_map =
true;
361create_xref_map =
false;
369wxTextEntryDialog dlg(
NULL,
_(
"Change length to"),
_(
"Change length of selected gaps"),
_(
"100"));
370dlg.SetTextValidator(wxFILTER_NUMERIC);
371 if(dlg.ShowModal() == wxID_OK)
373wxString
val= dlg.GetValue();
375 if(
val.ToLong(&new_size))
380 boolcreate_general_only =
false;
386 const CGapEdit* gap_edit =
dynamic_cast<const CGapEdit*
>((*it).object.GetPointer());
391 const CSeq_feat* feat =
dynamic_cast<const CSeq_feat*
>((*it).object.GetPointer());
395bsh = scope->GetBioseqHandle(feat->
GetLocation());
400 if(bsh_to_inst.
find(bsh) != bsh_to_inst.
end())
414 boolhas_loc(
false);
417 if( (*iter)->IsLoc() )
428bsh_to_inst[bsh] = make_pair(new_inst,
false);
438 const CGapEdit* gap_edit =
dynamic_cast<const CGapEdit*
>((*it).object.GetPointer());
444 const CSeq_feat* feat =
dynamic_cast<const CSeq_feat*
>((*it).object.GetPointer());
454 for(
const auto& d : diffs[bsh])
464 if(delta_i->Empty())
473 intdiff =
static_cast<int>(new_size);
477diffs[bsh][start] = diff;
479new_inst->
SetLength(old_length + diff);
483NRawToDeltaSeq::SGap gap;
485gap.length =
static_cast<int>(new_size - delta_len);
486gap.is_known =
true;
487gap.is_replace =
false;
488gaps[bsh].push_back(gap);
491bsh_to_inst[bsh].second =
true;
510diff =
static_cast<int>(new_size);
516 if(!bsh_to_inst[bsh].second && new_inst->
IsSetLength())
518diffs[bsh][start] = diff;
520new_inst->
SetLength(old_length + diff);
522NRawToDeltaSeq::SGap gap;
524gap.length =
static_cast<int>(new_size - delta_len);
525gap.is_known =
true;
526gap.is_replace =
false;
527gaps[bsh].push_back(gap);
529bsh_to_inst[bsh].second =
true;
558 for(
const auto& it : bsh_to_inst)
562 boolmodified = it.second.second;
574 if(!diffs.
empty())
577 for(objects::CAlign_CI align_ci(tse); align_ci; ++ align_ci)
579 constobjects::CSeq_align& align = *align_ci;
581 intnum_rows = align.CheckNumRows();
584 if(!align.IsSetSegs() || !align.GetSegs().IsDenseg() ||
585!align.GetSegs().GetDenseg().IsSetStarts() || !align.GetSegs().GetDenseg().IsSetLens())
588vector< TSignedSeqPos > starts(align.GetSegs().GetDenseg().GetStarts());
589 size_tnum_segs = align.GetSegs().GetDenseg().GetLens().size();
590 for(
size_ts = 0; s < num_segs; s++)
591 for(
auto row= 0;
row< num_rows;
row++)
600 for(
const auto& d : diffs[bsh])
605starts[num_rows * s +
row] = from;
609new_align->
Assign(align);
610new_align->
SetSegs().SetDenseg().SetStarts() = starts;
611new_align->
SetSegs().SetDenseg().TrimEndGaps();
612new_align->
SetSegs().SetDenseg().RemovePureGapSegs();
613new_align->
SetSegs().SetDenseg().Compact();
626 boolcreate_xref_map =
true;
627 apply_impl(seh, old_to_new, create_xref_map);
628create_xref_map =
false;
629 return apply_impl(seh, old_to_new, create_xref_map);
635 boolany_modified =
false;
641 boolbsh_modified =
false;
652 boolhas_loc(
false);
655 if( (*iter)->IsLoc() )
668vector<pair<int, bool> > gap_len;
673 if(delta_i->Empty())
680gap_len.push_back(pair<int, bool> (delta_len, unknown));
684gap_len.push_back(pair<int, bool> (0,
false));
691CDelta_ext::Tdata::iterator delta_i = new_inst->
SetExt().SetDelta().Set().begin();
692 while(delta_i != new_inst->
SetExt().SetDelta().Set().end())
694 if(delta_i->Empty())
701 intdelta_len = gap_len[
i].first;
704delta_i = new_inst->
SetExt().SetDelta().Set().erase(delta_i);
712 boolunknown = gap_len[
i].second;
713 boolmodified =
false;
714 for(
size_tj =
i+ 1; j < gap_len.size(); j++)
716 if(gap_len[j].
first<= 0)
718delta_len += gap_len[j].first;
719unknown |= gap_len[j].second;
720gap_len[j].first = -1;
735new_inst->
SetLength(old_length + diff);
738NRawToDeltaSeq::SGap gap;
741gap.is_known =
true;
742gap.is_replace =
false;
743gaps[bsh].push_back(gap);
745bsh_modified =
true;
753}
catch(
CException) {}
catch(std::exception ) {}
759any_modified =
true;
764 autolocal_cmd = composite;
767local_cmd->Unexecute();
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
@ eExtreme_Positional
numerical value
User-defined methods of the data storage class.
User-defined methods of the data storage class.
bool IsGeneralIdProtPresent(objects::CSeq_entry_Handle tse)
void AddCommand(IEditCommand &command)
virtual void Unexecute()
Undo (opposite to Execute())
virtual void Execute()
Do the editing action.
static CRef< CCmdComposite > apply(objects::CSeq_entry_Handle seh)
static CRef< CCmdComposite > apply_impl(objects::CSeq_entry_Handle seh, map< objects::CObject_id::TId, objects::CObject_id::TId > &old_to_new, bool create_xref_map)
static CRef< CCmdComposite > apply(objects::CSeq_entry_Handle seh)
static CRef< CCmdComposite > apply_impl(const TConstScopedObjects &objects, bool to_known, bool adjust_features, map< objects::CObject_id::TId, objects::CObject_id::TId > &old_to_new, bool create_xref_map)
static CRef< CCmdComposite > apply(const TConstScopedObjects &objects, bool to_known, bool adjust_features=false)
static CRef< CCmdComposite > apply(const TConstScopedObjects &objects)
static CRef< CCmdComposite > apply_impl(const TConstScopedObjects &objects, map< objects::CObject_id::TId, objects::CObject_id::TId > &old_to_new, bool create_xref_map)
static TId s_FindHighestFeatureId(const objects::CSeq_entry_Handle &entry)
TSeqPos GetFrom(void) const
CBioseq_Handle GetBioseq_Handle() const
namespace ncbi::objects::
void AddOrReplaceQualifier(const string &qual_name, const string &qual_val)
Add a qualifier to this feature, or replace the value for the first one if it already exists.
const_iterator begin() const
const_iterator end() const
const_iterator find(const key_type &key) const
void AdjustFeatureLocations(const map< objects::CBioseq_Handle, vector< SGap >> &map_gaps, CRef< CCmdComposite > composite, bool split_gene_locations, bool break_features, bool keep_gap_length, bool create_general_only, objects::CObject_id::TId &max_feat_id, map< objects::CObject_id::TId, objects::CObject_id::TId > &old_to_new, bool create_xref_map)
USING_SCOPE(ncbi::objects)
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
unsigned int TSeqPos
Type for sequence locations and lengths.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
int TSignedSeqPos
Type for signed sequence position.
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
vector< SConstScopedObject > TConstScopedObjects
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
TRange GetTotalRange(void) const
TSeqPos GetStart(ESeqLocExtremes ext) const
Return start and stop positions of the seq-loc.
TSeqPos GetLength(const CSeq_id &id, CScope *scope)
Get sequence length if scope not null, else return max possible TSeqPos.
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
CScope & GetScope(void) const
Get scope this handle belongs to.
TSeqPos GetBioseqLength(void) const
bool IsSetInst(void) const
CSeq_entry_Handle GetTopLevelEntry(void) const
Get top level Seq-entry handle.
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)
bool IsInGap(TSeqPos pos) const
true if sequence at 0-based position 'pos' has gap Note: this method is not MT-safe,...
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
void Reset(void)
Reset reference object.
position_type GetLength(void) const
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static string LongToString(long value, TNumToStringFlags flags=0, int base=10)
Convert Int to string.
static string UIntToString(unsigned int value, TNumToStringFlags flags=0, int base=10)
Convert UInt to string.
bool IsLim(void) const
Check if variant Lim is selected.
TLim GetLim(void) const
Get the variant data.
void SetSegs(TSegs &value)
Assign a value to Segs data member.
const TKey & GetKey(void) const
Get the Key member data.
bool IsSetData(void) const
the specific data Check if a value has been assigned to Data data member.
void SetLocation(TLocation &value)
Assign a value to Location data member.
bool IsImp(void) const
Check if variant Imp is selected.
bool IsSetKey(void) const
Check if a value has been assigned to Key data member.
const TLocation & GetLocation(void) const
Get the Location member data.
const TData & GetData(void) const
Get the Data member data.
const TImp & GetImp(void) const
Get the variant data.
bool IsSetLocation(void) const
feature made from Check if a value has been assigned to Location data member.
TFrom GetFrom(void) const
Get the From member data.
TTo GetTo(void) const
Get the To member data.
bool IsInt(void) const
Check if variant Int is selected.
const TInt & GetInt(void) const
Get the variant data.
TLiteral & SetLiteral(void)
Select the variant.
void SetLength(TLength value)
Assign a value to Length data member.
void SetExt(TExt &value)
Assign a value to Ext data member.
const TLiteral & GetLiteral(void) const
Get the variant data.
bool IsLoc(void) const
Check if variant Loc is selected.
bool IsSetExt(void) const
extensions for special types Check if a value has been assigned to Ext data member.
TLength GetLength(void) const
Get the Length member data.
TLength GetLength(void) const
Get the Length member data.
const TFuzz & GetFuzz(void) const
Get the Fuzz member data.
bool IsSetFuzz(void) const
could be unsure Check if a value has been assigned to Fuzz data member.
bool IsDelta(void) const
Check if variant Delta is selected.
void SetFuzz(TFuzz &value)
Assign a value to Fuzz data member.
bool IsSetLength(void) const
length of sequence in residues Check if a value has been assigned to Length data member.
const TExt & GetExt(void) const
Get the Ext member data.
const TDelta & GetDelta(void) const
Get the variant data.
const TLoc & GetLoc(void) const
Get the variant data.
const Tdata & Get(void) const
Get the member data.
bool IsLiteral(void) const
Check if variant Literal is selected.
void SetLength(TLength value)
Assign a value to Length data member.
list< CRef< CDelta_seq > > Tdata
void ResetFuzz(void)
Reset Fuzz data member.
@ eMol_na
just a nucleic acid
where boath are integers</td > n< td ></td > n</tr > n< tr > n< td > tse</td > n< td > optional</td > n< td > String</td > n< td class=\"description\"> TSE option controls what blob is orig
#define row(bind, expected)
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