list< CRef<CSeq_align> > singleton_list;
65singleton_list.push_back(alignment);
74 "sequence contains unsupported type of CSeq_loc");
77 result->SetLoc().Assign(loc);
99 if(gap_size > tail) {
131 "Scaffold does not have delta representation");
136CDelta_ext::Tdata::const_iterator delta_it =
138 for(; current_pos < loc_start+patch_boundary; ++delta_it) {
139current_pos += (*delta_it)->IsLiteral()
140? (*delta_it)->GetLiteral().GetLength()
141: (*delta_it)->GetLoc().GetTotalRange().GetLength();
147 if(!is_right_tail || current_pos > loc_start+patch_boundary) {
150 if((*delta_it)->IsLiteral()
151&& (*delta_it)->GetLiteral().GetSeq_data().IsGap())
153 if(current_pos == loc_start+patch_boundary) {
155inserted_gap = *delta_it;
157inserted_gap->GetLiteral().GetLength();
159patch_boundary += previous_gap_size;
161patch_boundary -= previous_gap_size;
164length_change -= previous_gap_size
165- inserted_gap->GetLiteral().GetLength();
169 "patch alignment boundary in the middle of intra-scaffold gap");
178 "non-NOVEL patch has unaligned tail of length "+
184 if(current_pos > loc_start+patch_boundary) {
186length_change -= current_pos - loc_start - patch_boundary;
188current_pos -= (*delta_it)->GetLoc().GetTotalRange().GetLength();
189length_change -= loc_start + patch_boundary - current_pos;
191patch_boundary = current_pos-loc_start;
196inserted_gap->SetLiteral().SetLength(50000);
197inserted_gap->SetLiteral().SetSeq_data().SetGap()
199inserted_gap->SetLiteral().SetSeq_data().SetGap()
201length_change += 50000;
216 "PatchTargetSequence() implemented only for sequences " 217 "with delta representation");
229 "Alignment does not have two rows");
233 "Alignments in list are patching different sequences");
237 if(!old_alignment) {
238old_alignment = alignment;
244<<
" covers "<< (*it2)->GetSeqStart(1)
245<<
" - "<< (*it2)->GetSeqStop(1));
249total_covered += covered_range;
254 "Several patches on same range; need gis to choose newest");
261old_alignment = alignment;
264TCoverMap::const_iterator next_patch = cover_map.begin();
270 TSeqPoscurrent_pos = 0, next_pos = 0;
274 if((*it)->IsLiteral()) {
275next_pos += (*it)->GetLiteral().GetLength() + next_gap_change;
278 if(next_pos > next_patch->first.GetFrom()) {
281+ next_patch->second->GetSeq_id(0).AsFastaString()
284 " which is in sequence gap");
289target_loc.
Assign((*it)->GetLoc());
290current_pos = next_pos;
294 for(; next_patch != cover_map.end() &&
295next_pos > next_patch->first.GetFrom(); ++next_patch)
300 if(!patch_sequence) {
305 TSeqRangealigned_patch_range = next_patch->second->GetSeqRange(0);
309 "Expect all patch alignments to align to target's " 314 if(aligned_patch_range.
GetLength() < patch_length)
317 "Disc-seg patch alignments require that the " 318 "patch sequence by fully aligned");
325 "Expect all patch alignments to align to " 326 "target's plus strand");
328 if((*seg_it)->GetSeqStrand(1) != patch_strand) {
335pair<TSeqPos,TSeqPos> patch_tail(
336aligned_patch_range.
GetFrom(),
337patch_length - aligned_patch_range.
GetToOpen());
340 TSeqPostemp = patch_tail.first;
341patch_tail.first = patch_tail.second;
342patch_tail.second = temp;
346 TSeqPosunaligned_left_length =
347next_patch->first.GetFrom() - current_pos;
348 if(unaligned_left_length) {
350 if(patch_tail.first) {
353 "Scaffold locations expected to always " 354 "be on plus strand");
360unaligned_left_length,
361patch_tail.first, inserted_gap,
362length_change,
false);
365patched_contents.insert(it,
368patched_contents.insert(it, inserted_gap);
370}
else if(patch_tail.first) {
371 if(it == patched_contents.begin() ||
372!(*--it)->IsLiteral() ||
373!(*it)->GetLiteral().GetSeq_data().IsGap())
376 "unaligned tail of length " 378+
" not abutting a gap");
381(*it)->GetLiteral().GetLength();
383length_change -= previous_gap_size
384- (*it)->GetLiteral().GetLength();
387 while(next_pos < next_patch->
first.GetToOpen()) {
388it = patched_contents.erase(it);
389current_pos = next_pos;
390next_pos += (*it)->IsLiteral()
391? (*it)->GetLiteral().GetLength()
392: (*it)->GetLoc().GetTotalRange().GetLength();
394 if(!(*it)->IsLoc()) {
396 "Patch on location "+
398 " which is in sequence gap");
400target_loc.
Assign((*it)->GetLoc());
401it = patched_contents.erase(it);
402length_change -= next_patch->first.GetLength();
408 new CSeq_loc(*patch_id, 0, patch_length-1, patch_strand));
410inserted_patch->SetLoc(*patch_loc);
411patched_contents.insert(it, inserted_patch);
412length_change += patch_length;
415next_patch->first.GetToOpen() - current_pos;
416 if(current_pos + length_to_replace < next_pos) {
418 if(patch_tail.second) {
423 "Scaffold locations expected to always " 424 "be on plus strand");
429patch_tail.second, inserted_gap,
430length_change,
true);
432patched_contents.insert(it, inserted_gap);
439target_loc.
Assign(scaffold_remainder->GetLoc());
440patched_contents.insert(it, scaffold_remainder);
441}
else if(patch_tail.second) {
442 if(it == patched_contents.end() ||
443!(*it)->IsLiteral() ||
444!(*it)->GetLiteral().GetSeq_data().IsGap())
447 "unaligned tail of length " 449+
" not abutting a gap");
452(*it)->GetLiteral().GetLength();
454length_change -= next_gap_change =
455previous_gap_size - (*it)->GetLiteral().GetLength();
457current_pos += length_to_replace;
459}
catch(exception &e) {
465<<
": "<< e.what() <<
"; skipping");
467list< CRef<CSeq_align> > new_alignments;
469 if(*align_it != next_patch->second) {
470new_alignments.push_back(*align_it);
472 if(new_alignments.empty()) {
480 if(next_patch == cover_map.end()) {
486 if(patched_seq->
IsSetLength() && length_change) {
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.
User-defined methods of the data storage class.
bool IntersectingWith(const TRange &r) const
CRange< TSeqPos > GetSeqRange(TDim row) const
GetSeqRange NB: On a Spliced-seg, in case the product-type is protein, these only return the amin par...
TDim CheckNumRows(void) const
Validatiors.
const CSeq_id & GetSeq_id(TDim row) const
Get seq-id (the first one if segments have different ids).
ENa_strand GetSeqStrand(TDim row) const
Get strand (the first one if segments have different strands).
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.
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
void Error(CExceptionArgs_Base &args)
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
void Info(CExceptionArgs_Base &args)
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Optimized implementation of CSerialObject::Assign, which is not so efficient.
string AsString(void) const
ENa_strand GetStrand(void) const
Get the location's strand.
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Override Assign() to incorporate cache invalidation.
TRange GetTotalRange(void) const
TSeqPos GetStart(ESeqLocExtremes ext) const
Return start and stop positions of the seq-loc.
const CSeq_id * GetId(void) const
Get the id of the location return NULL if has multiple ids or no id at all.
const CSeq_id & GetId(const CSeq_loc &loc, CScope *scope)
If all CSeq_ids embedded in CSeq_loc refer to the same CBioseq, returns the first CSeq_id found,...
@ eGetId_Best
return the "best" gi (uses FindBestScore(), with CSeq_id::CalculateScore() as the score function
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
bool CanGetInst_Repr(void) const
TSeqPos GetBioseqLength(void) const
const CSeq_id_Handle & GetSeq_id_Handle(void) const
Get handle of id used to obtain this bioseq handle.
TInst_Repr GetInst_Repr(void) const
const TInst & GetInst(void) const
void Reset(void)
Reset reference object.
position_type GetLength(void) const
position_type GetToOpen(void) const
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static string UIntToString(unsigned int value, TNumToStringFlags flags=0, int base=10)
Convert UInt to string.
TFrom GetFrom(void) const
Get the From member data.
bool IsDisc(void) const
Check if variant Disc is selected.
list< CRef< CSeq_align > > Tdata
const TDisc & GetDisc(void) const
Get the variant data.
const Tdata & Get(void) const
Get the member data.
const TSegs & GetSegs(void) const
Get the Segs member data.
void SetTo(TTo value)
Assign a value to To data member.
ENa_strand
strand of nucleic acid
TFrom GetFrom(void) const
Get the From member data.
void SetFrom(TFrom value)
Assign a value to From data member.
TGi GetGi(void) const
Get the variant data.
bool IsGi(void) const
Check if variant Gi is selected.
bool IsInt(void) const
Check if variant Int is selected.
void SetLength(TLength value)
Assign a value to Length data member.
const TGap & GetGap(void) const
Get the variant data.
void SetExt(TExt &value)
Assign a value to Ext data member.
TType GetType(void) const
Get the Type member data.
TLength GetLength(void) const
Get the Length member data.
TLength GetLength(void) const
Get the Length member data.
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 Tdata & Get(void) const
Get the member data.
void SetLength(TLength value)
Assign a value to Length data member.
list< CRef< CDelta_seq > > Tdata
const TSeq_data & GetSeq_data(void) const
Get the Seq_data member data.
@ eRepr_delta
sequence made by changes (delta) to others
@ eType_clone
Deprecated. Used only for AGP 1.1.
static set< CSeq_id_Handle > s_NovelPatches
static void s_ProcessIntraScaffoldTail(CBioseq_Handle patch_sequence, CBioseq_Handle scaffold, TSeqPos loc_start, TSeqPos &patch_boundary, TSeqPos tail_length, CRef< CDelta_seq > &inserted_gap, TSignedSeqPos &length_change, bool is_right_tail)
void AddNovelPatch(const CSeq_id_Handle &idh)
static CRef< CDelta_seq > s_SubLocDeltaSeq(const CSeq_loc &loc, TSeqPos start, TSeqPos length=0)
static void s_SubtractTail(CSeq_literal &gap, TSeqPos tail)
CRef< CSeq_inst > PatchTargetSequence(CRef< CSeq_align > alignment, CScope &scope)
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