90 feature::CFeatTree& feat_tree,
const CMappedFeat& root_feat);
92 feature::CFeatTree& feat_tree,
const CMappedFeat& root_feat);
141 bool in_gap =
false)
const;
148 bool& utr3_tail)
const;
160 feature::CFeatTree& feat_tree,
const CMappedFeat& root_feat)
161 : m_cdr_length(0), m_cds_offset_set(
false)
169 feature::CFeatTree& feat_tree,
const CMappedFeat& root_feat)
170 : m_cdr_length(0), m_cds_offset_set(
false)
215 vector<CMappedFeat> cc = feat_tree.GetChildren(feat);
216 ITERATE (vector<CMappedFeat>, iter, cc) {
228 for (
CFeat_CI feat_iter(product_bsh, sel); feat_iter; ++feat_iter)
234 vector<CMappedFeat> cc = feat_tree.GetChildren(feat);
236 ITERATE (vector<CMappedFeat>, iter, cc) {
237 const CSeq_feat& seq_feat = iter->GetMappedFeature();
306 for ( ; rg_it; ++rg_it) {
314 if (signed_pos <
f) {
315 adj_for_intron = signed_pos -
f;
316 }
else if (signed_pos >
t) {
317 adj_for_intron = signed_pos -
t;
322 adj = adj_for_intron;
354 }
else if (part.
IsDiag()) {
362 if (l > exon_pos)
return in_gap;
388 ref->SetTitle(title);
389 ref->SetObject_id(
"");
390 ref->SetMarker_pos(pos);
391 ref->SetSequence(
"");
392 ref->SetHgvs_position(
"");
416 if (adjustment > 0) {
417 second_pos = pos + 1;
427 pos >= 0 ? pos + 1 : pos;
428 if (adjustment == 0 || !utr3_tail) {
431 if (adjustment != 0) {
434 }
else if (adjustment > 0) {
449 fake_loc->
SetPnt().SetPoint(pos);
468 bool& utr3_tail)
const
481 utr3_adjusted_pos += adjustment;
488 feature_pos += adjustment;
489 seq_pos += adjustment;
493 feature_pos += adjustment;
494 seq_pos += adjustment;
514 ref->SetPos_mapped(mapped_pos);
524 coords.
Set().push_back(ref);
545 bool utr3_tail =
false;
553 mapped_pos = seq_pos -
offset;
573 mapped_pos = seq_pos;
582 x_SetHgvs(*ref,
"c.", mapped_pos, adjustment, utr3_tail, in_gap);
585 ref->SetPos_mapped(mapped_pos);
587 if (mapped) coords.
Set().push_back(ref);
608 ref->SetPos_mapped(mapped_pos);
611 coords.
Set().push_back(ref);
665 for (; loc_iter; ++loc_iter) {
759 for (
CFeat_CI feat_iter(product_bsh, sel);
760 feat_iter; ++feat_iter)
831 "failed to retrieve sequence: " +
id.AsFastaString());
861 ref->SetTitle(title);
864 ref->SetMarker_pos(pos);
865 ref->SetPos_mapped(pos);
867 coords.
Set().push_back(ref);
897 TSeqPos min_pos = pos >= window ? pos - window : pos;
898 TSeqPos max_pos = pos + window;
899 TSeqRange search_range(min_pos, max_pos);
913 (*iter)->GetCoordinates(
927 bool is_ref_seq_gene =
false;
933 if (it->GetObject().IsGenbank()) {
937 if (*it1 ==
"RefSeqGene") {
938 is_ref_seq_gene =
true;
944 if (is_ref_seq_gene)
break;
947 return is_ref_seq_gene;
965 CFeat_CI feat_iter(bsh, search_range, sel);
966 feature::CFeatTree feat_tree;
967 feat_tree.AddFeatures(feat_iter);
985 vector<CMappedFeat> feat_roots =
988 ITERATE (vector<CMappedFeat>, iter, feat_roots) {
989 const CSeq_feat& seq_feat = iter->GetMappedFeature();
993 vector<CMappedFeat> cc = feat_tree.GetChildren(*iter);
994 ITERATE (vector<CMappedFeat>, iter1, cc) {
1001 if (entry->IsValid())
entries.push_back(entry);
1009 if (entry->IsValid())
entries.push_back(entry);
1030 for (
CAlign_CI align_it(bsh, search_range, sel); align_it; ++align_it) {
1037 string entry_label; product_id->
GetLabel(&entry_label);
1044 (*it)->SetAlignment(scope, al);
1056 new_entries.push_back(entry);
1062 entries.insert(
entries.end(), new_entries.begin(), new_entries.end());
1069 string seq_before, seq_pos, seq_after;
1075 if (adjustment >=0) {
1076 TSeqPos before_from = pos <= max_seq_frame ?
1077 0 :
max(0, pos - max_seq_frame);
1083 if (pos < max_seq_frame) {
1085 int max_filler_len =
min(2*max_seq_frame+1, max_seq_frame - pos);
1086 for (
int i = 0;
i < max_filler_len;
i++) filler +=
" ";
1087 seq_before = filler + seq_before;
1089 if (adjustment != 0) {
1090 int fill_len =
min(
int(adjustment-1),
int(seq_before.size()));
1091 seq_before.replace(seq_before.size()-fill_len, fill_len, fill_len,
'-');
1094 for (
int i = 0;
i < max_seq_frame;
i++) seq_before +=
"-";
1096 if (adjustment == 0) {
1101 if (adjustment <= 0) {
1106 max(0,
min(seq_len, pos+max_seq_frame+1)), seq_after);
1107 if (adjustment != 0) {
1108 int fill_len =
min(
int(-adjustment-1),
int(seq_after.size()));
1109 seq_after.replace(0, fill_len, fill_len,
'-');
1112 for (
int i = 0;
i < max_seq_frame;
i++) seq_after +=
"-";
1125 seq_before +
"<span class='xsv-seq_pos_highlight'>" +
1126 seq_pos +
"</span>" + seq_after;
1131 #ifdef __GUI_SEQ_UTILS_DEFINED__
1160 // Service functions
1163 TSignedSeqPos x_GetAdjustment(const CSeq_feat& feat, TSeqPos pos)
1165 // Calculate minimal distance to the exon boundary
1168 sequence::GetStrand(feat.GetLocation()) != eNa_strand_minus;
1169 TSignedSeqPos signed_pos = static_cast<TSignedSeqPos>(pos);
1170 CSeq_loc_CI loc_iter(feat.GetLocation());
1171 for ( ; loc_iter; ++loc_iter) {
1172 const TSeqRange& curr = loc_iter.GetRange();
1173 TSignedSeqPos f = curr.GetFrom();
1174 TSignedSeqPos t = curr.GetTo();
1177 if (signed_pos < f) {
1178 adj_for_intron = signed_pos - f;
1179 } else if (signed_pos > t) {
1180 adj_for_intron = signed_pos - t;
1182 return 0; // no adjustment needed
1184 if (adj == 0 || std::abs(adj_for_intron) < std::abs(adj)) {
1185 adj = adj_for_intron;
1188 return plus_strand ? adj : -adj;
static CRef< CScope > m_Scope
User-defined methods of the data storage class.
User-defined methods of the data storage class.
@ eExtreme_Biological
5' and 3'
User-defined methods of the data storage class.
User-defined methods of the data storage class.
Checksum and hash calculation classes.
CMappingRange - describes a single interval to interval mapping.
Storage for multiple mapping ranges.
CObjectCoords(objects::CScope &scope)
CRef< objects::CScope > m_Scope
CRef< CHGVS_Coordinate_Set > GetCoordinates(const CSeq_id &id, TSeqPos pos, TSeqPos window=kSearchWindow)
bool x_MapPos(const CSeq_loc_Mapper &mapper, const CSeq_id &id, TSeqPos pos, TSeqPos &mapped_pos) const
void x_SetId(CScope &scope, const CSeq_id &seq_id)
void x_SetHgvs(CHGVS_Coordinate &ref, const char *prefix, TSignedSeqPos pos, TSignedSeqPos adjustment=0, bool utr3_tail=false, bool in_gap=false) const
void SetGene(CScope &scope, const CSeq_feat &feat)
void x_SetRnaCds(CScope &scope, const CSeq_feat &cds)
TSeqPos m_cdr_length
CDS feature on transcript, where main is genomic.
void SetAlignment(CScope &scope, const CSeq_align &align)
void x_GetCCoordinate(CScope &scope, TSeqPos pos, TSignedSeqPos adj, CHGVS_Coordinate_Set &coords) const
CConstRef< CSeq_id > m_main_id
CRef< CSeq_loc_Mapper > x_GetCdsMapper(CScope &scope, const CSeq_feat &cds) const
CRef< CHGVS_Coordinate > x_NewCoordinate(CScope &scope, const CSeq_id *id, TSeqPos pos) const
void x_SetFeature(CScope &scope, feature::CFeatTree &feat_tree, const CMappedFeat &feat)
void SetCds(CScope &scope, const CSeq_feat &feat)
CConstRef< CSeq_id > m_prot_id
bool x_CheckExonGap(TSeqPos pos) const
CConstRef< CSeq_feat > m_mrna
CConstRef< CSeq_align > m_mrna_align
CRef< CSeq_loc_Mapper > m_mrna_mapper
void x_GetRCoordinate(CScope &scope, TSeqPos pos, CHGVS_Coordinate_Set &coords) const
CConstRef< CSeq_id > m_transcript_id
TSignedSeqPos x_GetAdjustment(TSeqPos pos) const
void x_SetMrnaMapper(CScope &scope, const CSeq_feat &feat)
CConstRef< CSeq_feat > m_cds
mRNA feature on main sequence (genomic or transcript)
void x_GetPCoordinate(CScope &scope, TSeqPos pos, CHGVS_Coordinate_Set &coords) const
CConstRef< CSeq_id > GetTranscriptId()
void SetMrna(CScope &scope, const CSeq_feat &feat)
void x_SetSequence(CHGVS_Coordinate &ref, CScope &scope, const CSeq_id *id, TSignedSeqPos pos, TSignedSeqPos adjustment=0, bool plus_strand=true) const
CConstRef< CSeq_feat > m_rna_cds
CDS feature on main sequence.
CConstRef< CSeq_id > m_genomic_id
void GetCoordinates(CScope &scope, Uint4 type_flags, TSeqPos pos, CHGVS_Coordinate_Set &coords) const
TSeqPos x_GetCDSOffset() const
void x_CalculateUTRAdjustments(TSignedSeqPos &feature_pos, TSignedSeqPos &seq_pos, TSignedSeqPos &adjustment, bool &utr3_tail) const
ESubtype GetSubtype(void) const
TDim CheckNumRows(void) const
Validatiors.
const CSeq_id & GetSeq_id(TDim row) const
Get seq-id (the first one if segments have different ids).
@Seq_descr.hpp User-defined methods of the data storage class.
namespace ncbi::objects::
Seq-loc iterator class – iterates all intervals from a seq-loc in the correct order.
TSeqPos GetSeqStop(TDim row) const
TSeqPos GetSeqStart(TDim row) const
CRange< Position > Map(const CRange< Position > &target, const CRange< Position > &range)
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 NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
void Warning(CExceptionArgs_Base &args)
static objects::SAnnotSelector GetAnnotSelector(TAnnotFlags flags=0)
request an annotation selector for a given type
void GetLabel(string *label, ELabelType type=eDefault, TLabelFlags flags=fLabel_Default) const
Append a label for this Seq-id to the supplied string.
CConstRef< CSeq_id > GetSeqId(void) const
static CSeq_id_Handle GetHandle(const CSeq_id &id)
Normal way of getting a handle, works for any seq-id.
@ eContent
Untagged human-readable accession or the like.
ENa_strand GetStrand(void) const
Get the location's strand.
void SetId(CSeq_id &id)
set the 'id' field in all parts of this location
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.
TRange GetRange(void) const
Get the range.
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,...
TSeqPos GetLength(const CSeq_id &id, CScope *scope)
Get sequence length if scope not null, else return max possible TSeqPos.
ENa_strand GetStrand(const CSeq_loc &loc, CScope *scope=0)
Returns eNa_strand_unknown if multiple Bioseqs in loc Returns eNa_strand_other if multiple strands in...
bool IsSameBioseq(const CSeq_id &id1, const CSeq_id &id2, CScope *scope, CScope::EGetBioseqFlag get_flag=CScope::eGetBioseq_All)
Determines if two CSeq_ids represent the same CBioseq.
@ eGetId_Best
return the "best" gi (uses FindBestScore(), with CSeq_id::CalculateScore() as the score function
TSeqPos GetLength(void) const
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
const CMappingRanges & GetMappingRanges(void) const
Get mapping ranges.
TSeqPos GetSrc_from(void) const
TRangeIterator BeginMappingRanges(CSeq_id_Handle id, TSeqPos from, TSeqPos to) const
Get mapping ranges iterator for the given seq-id and range.
@ eLocationToProduct
Map from the feature's location to product.
const TDescr & GetDescr(void) const
CSeq_entry_Handle GetParentEntry(void) const
Get parent Seq-entry handle.
bool IsSetProduct(void) const
CConstRef< CSeq_id > GetSeqId(void) const
Get id which can be used to access this bioseq handle Throws an exception if none is available.
bool IsSetDescr(void) const
CSeqVector GetSeqVector(EVectorCoding coding, ENa_strand strand=eNa_strand_plus) const
Get sequence: Iupacna or Iupacaa if use_iupac_coding is true.
@ eCoding_Iupac
Set coding to printable coding (Iupacna or Iupacaa)
SAnnotSelector & IncludeFeatSubtype(TFeatSubtype subtype)
Include feature subtype in the search.
SAnnotSelector & SetResolveAll(void)
SetResolveAll() is equivalent to SetResolveMethod(eResolve_All).
SAnnotSelector & SetOverlapTotalRange(void)
Check overlapping only of total ranges.
SAnnotSelector & SetAdaptiveDepth(bool value=true)
SetAdaptiveDepth() requests to restrict subsegment resolution depending on annotations found on lower...
SAnnotSelector & SetExcludeExternal(bool exclude=true)
External annotations for the Object Manger are annotations located in top level Seq-entry different f...
const CSeq_feat & GetMappedFeature(void) const
Feature mapped to the master sequence.
SAnnotSelector & IncludeFeatType(TFeatType type)
Include feature type in the search.
const CSeq_loc & GetProduct(void) const
SAnnotSelector & ExcludeNamedAnnots(const CAnnotName &name)
Add named annot to set of annots names to exclude.
void GetSeqData(TSeqPos start, TSeqPos stop, string &buffer) const
Fill the buffer string with the sequence data for the interval [start, stop).
void Reset(void)
Reset reference object.
void Reset(void)
Reset reference object.
TObjectType & GetObject(void)
Get object.
uint32_t Uint4
4-byte (32-bit) unsigned integer
position_type GetLength(void) const
bool IntersectingWith(const TThisType &r) const
static TThisType GetWhole(void)
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
static const char label[]
const TKeywords & GetKeywords(void) const
Get the Keywords member data.
bool IsSetKeywords(void) const
Check if a value has been assigned to Keywords data member.
TTo GetTo(void) const
Get the To member data.
TFrom GetFrom(void) const
Get the From member data.
bool IsSetLocus_tag(void) const
systematic gene name (e.g., MI0001, ORF0069) Check if a value has been assigned to Locus_tag data mem...
bool IsSetLocus(void) const
Official gene symbol Check if a value has been assigned to Locus data member.
const TLocus_tag & GetLocus_tag(void) const
Get the Locus_tag member data.
const TLocus & GetLocus(void) const
Get the Locus member data.
void SetHgvs_position(const THgvs_position &value)
Assign a value to Hgvs_position data member.
Tdata & Set(void)
Assign a value to data member.
void SetSequence(const TSequence &value)
Assign a value to Sequence data member.
bool IsSetGenomic_end(void) const
Check if a value has been assigned to Genomic_end data member.
E_Choice Which(void) const
Which variant is currently selected.
bool IsSetParts(void) const
basic seqments always are in biologic order Check if a value has been assigned to Parts data member.
TMatch GetMatch(void) const
Get the variant data.
TGenomic_start GetGenomic_start(void) const
Get the Genomic_start member data.
bool IsSetPartial(void) const
flag: is this exon complete or partial? Check if a value has been assigned to Partial data member.
bool IsMismatch(void) const
Check if variant Mismatch is selected.
TDiag GetDiag(void) const
Get the variant data.
TMismatch GetMismatch(void) const
Get the variant data.
TGenomic_strand GetGenomic_strand(void) const
Get the Genomic_strand member data.
const TParts & GetParts(void) const
Get the Parts member data.
const TSpliced & GetSpliced(void) const
Get the variant data.
bool IsSetGenomic_start(void) const
genomic-end >= genomic-start Check if a value has been assigned to Genomic_start data member.
bool IsGenomic_ins(void) const
Check if variant Genomic_ins is selected.
bool IsMatch(void) const
Check if variant Match is selected.
TGenomic_ins GetGenomic_ins(void) const
Get the variant data.
bool IsSetGenomic_strand(void) const
Check if a value has been assigned to Genomic_strand data member.
list< CRef< CSpliced_exon > > TExons
const TExons & GetExons(void) const
Get the Exons member data.
TPartial GetPartial(void) const
Get the Partial member data.
bool IsDiag(void) const
Check if variant Diag is selected.
list< CRef< CSpliced_exon_chunk > > TParts
TGenomic_end GetGenomic_end(void) const
Get the Genomic_end member data.
bool IsProduct_ins(void) const
Check if variant Product_ins is selected.
const TSegs & GetSegs(void) const
Get the Segs member data.
bool IsSetPartial(void) const
incomplete in some way? Check if a value has been assigned to Partial data member.
const TLocation & GetLocation(void) const
Get the Location member data.
TFrame GetFrame(void) const
Get the Frame member data.
const TData & GetData(void) const
Get the Data member data.
const TCdregion & GetCdregion(void) const
Get the variant data.
const TProduct & GetProduct(void) const
Get the Product member data.
const TGene & GetGene(void) const
Get the variant data.
TPartial GetPartial(void) const
Get the Partial member data.
bool IsSetProduct(void) const
product of process Check if a value has been assigned to Product data member.
bool IsSetFrame(void) const
Check if a value has been assigned to Frame data member.
ENa_strand
strand of nucleic acid
const TPnt & GetPnt(void) const
Get the variant data.
TPoint GetPoint(void) const
Get the Point member data.
E_Choice Which(void) const
Which variant is currently selected.
bool IsPnt(void) const
Check if variant Pnt is selected.
list< CRef< CSeqdesc > > Tdata
const Tdata & Get(void) const
Get the member data.
Magic spell ;-) needed for some weird compilers... very empiric.
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
double f(double x_, const double &y_)
vector< CRef< CReportEntry > > TReportEntryList
static void s_ExtendEntriesFromAlignments(CScope &scope, const CBioseq_Handle &bsh, TSeqRange search_range, TReportEntryList &entries)
static TReportEntryList s_GetFeaturesForRange(CScope &scope, const CBioseq_Handle &bsh, TSeqRange search_range)
static const TSeqPos kSeqFrame
static bool s_IsRefSeqGene(const CBioseq_Handle &bsh)
static SAnnotSelector x_GetAnnotSelector()
static string x_GetSequence(CSeqVector &seq_vec, TSignedSeqPos pos, TSignedSeqPos adjustment=0)
static const char * prefix[]
Uint4 GetSequenceType(const CBioseq_Handle &bsh)
Return a (corrected) set of flags identifying the sequence type.
static wxAcceleratorEntry entries[3]