132 double qry_bias = 0.5)
134 double d_aln_len =
static_cast<double>(aln_len);
135 return (qry_len == 0 ? 0.0 : d_aln_len/(qry_len) * qry_bias)
136 + (tgt_len == 0 ? 0.0 : d_aln_len/(tgt_len) * (1.0 - qry_bias));
143 int best_ending_pos = ranges.size() - 1;
146 pos = ranges.size() - 1;
147 int best_beginning_pos = 0;
152 ITERATE(list<CGappedRange>, it, ranges) {
153 if(pos >= best_beginning_pos && pos <= best_ending_pos) {
159 if(identity_out !=
NULL) {
160 unsigned aligned_len =
r.m_range.GetLength() -
r.m_gaps;
161 unsigned d = (query_len +
r.m_range.GetLength() - aligned_len);
162 *identity_out = d == 0 ? 0 :
static_cast<double>(aligned_len) / d;
177 bool is_spliced =
false,
179 bool strip_versions =
false)
187 if(from_id && !from_id->IsLocal()) {
205 TSeqPos collapsed_len_total(0);
210 query_len_total += query_len;
214 if(mapped_interval->
IsNull() || mapped_interval->
IsEmpty()) {
231 mapped_loc->
Add(*mapped_interval_merged);
237 list<CGappedRange> mapped_ranges_list;
238 for(
CSeq_loc_CI it2(*mapped_interval_merged); it2; ++it2) {
239 mapped_ranges_list.push_back(
CGappedRange(it2.GetRange()));
248 TSeqPos collapsed_len =
r.m_range.GetLength();
249 TSeqPos aligned_len = collapsed_len -
r.m_gaps;
252 aligned_len_total += aligned_len;
253 collapsed_len_total += collapsed_len;
255 if(aligned_len > query_len) {
267 <<
"\nremapped segment\n"
269 <<
"\naligned len: " << aligned_len
270 <<
"\ncollapsed len: " << collapsed_len
275 mapped_interval_collapsed->
SetInt().SetFrom(
r.m_range.GetFrom());
276 mapped_interval_collapsed->
SetInt().SetTo(
r.m_range.GetTo());
281 mapped_interval_collapsed->
SetInt().SetId(*
id);
283 mapped_loc->
Add(*mapped_interval_collapsed);
287 if(mapped_identity !=
NULL) {
289 *mapped_identity = 1;
291 TSeqPos d = query_len_total + collapsed_len_total - aligned_len_total;
292 *mapped_identity = d == 0 ? 0 :
static_cast<double>(aligned_len_total) / d;
330 int k = handles.size();
369 for(
CFeat_CI ci(scope, *loc, sa); ci; ++ci) {
413 string long_label =
"";
441 return long_label +
out;
449 string title =
"Sentinel")
458 annot->
SetData().SetFtable().push_back(feat);
471 feat->
SetData().SetRna(*rna_ref);
515 string title = sequence::CDeflineGenerator().GenerateDefline(h);
517 bool add_gene =
false;
518 bool add_rna =
false;
519 bool is_gene =
false;
551 if(is_gene || biomol_rna) {
554 for(
CFeat_CI ci(scope, loc, sel); ci; ++ci) {
555 add_gene =
false;
break;
563 "[Sentinel feat]" + title);
571 for(
CFeat_CI ci2(scope, loc, sel); ci2; ++ci2) {
572 add_rna =
false;
break;
580 "[Sentinel feat]" + title);
588 unique_ptr<CObjectIStream> obj_istr;
614 if(file_or_dir->IsDir()) {
615 CDir dir(*file_or_dir);
618 dir_entries.push_back(file_or_dir);
625 string path = ent->GetPath();
628 if(!ent->IsFile())
continue;
630 _TRACE(
"loading " + path);
632 unique_ptr<CObjectIStream> obj_istr =
GetIStream(path, serial_format);
633 if (!obj_istr->InGoodState()) {
637 _TRACE(
"Trying as Seq-entry");
639 while(!obj_istr->EndOfData()) {
641 *obj_istr >> *seq_entry;
642 _TRACE(
"adding TSE from " + path);
645 _TRACE(
"Loaded as Seq-entry");
651 unique_ptr<CObjectIStream> obj_istr =
GetIStream(path, serial_format);
652 if (!obj_istr->InGoodState()) {
656 _TRACE(
"Trying as Seq-annot");
658 while(!obj_istr->EndOfData()) {
660 *obj_istr >> *seq_annot;
661 _TRACE(
"adding Seq-annot from " + path);
664 _TRACE(
"Loaded as Seq-annot");
670 unique_ptr<CObjectIStream> obj_istr =
GetIStream(path, serial_format);
671 if (!obj_istr->InGoodState()) {
676 _TRACE(
"Trying as genbank bioseqset");
680 _TRACE(
"Loaded as genbank bioseqset");
699 virtual void Init(
void);
700 virtual int Run (
void);
705 TSeqPos enclosing_alignment_length);
745 arg_desc->AddOptionalKey(
"q",
749 arg_desc->AddDefaultKey(
"q_serial",
754 arg_desc->SetConstraint(
"q_serial",
759 arg_desc->AddOptionalKey(
"t",
763 arg_desc->AddDefaultKey(
"t_serial",
768 arg_desc->SetConstraint(
"t_serial",
774 arg_desc->AddKey(
"i",
776 "File containing one of the following: "
777 "\n - list of paths to asn files of alignments"
778 "\n - pairs of seq-ids (assuming identity alignment) from query and target scopes"
779 "\n - 6-column input of seq-id1\\start1\\stop1\\seq-id2\\start2\\stop2 - compare via mapping ranges"
780 "\n - 3-column input of: seq-id\\tstart\\tstop - compare components to level-0 annots",
784 arg_desc->AddDefaultKey(
"i_container",
786 "Top-level ASN.1 container type",
789 arg_desc->SetConstraint(
"i_container",
791 ->Allow(
"Seq-align-set")
793 ->Allow(
"Seq-align"));
795 arg_desc->AddDefaultKey(
"i_serial",
800 arg_desc->SetConstraint(
"i_serial",
806 arg_desc->AddOptionalKey(
"id_map",
808 "Convert seq-ids in alignments. (Format: aln_row\\tfrom_id\\tto_id\\n)",
812 arg_desc->AddDefaultKey(
"depth",
814 "SAnnotSelector resolve depth",
818 arg_desc->AddFlag(
"sentinel_seqs",
819 "If the query seq in the alignment is not in query scope (e.g. local id),"
820 " this will create a Seq-entry with spanning RNA feature and add it to scope "
821 " such that the sequence placement can be compared to the annotation");
822 arg_desc->AddFlag(
"sentinel_feats",
823 "If bioseq title has 'mRNA' in it, add spanning gene and mrna feats if missing;"
824 "if the title contains 'gene', add spanning gene feat if missing");
825 arg_desc->AddFlag(
"spliced",
826 "If using spliced alignments, this option must be specified such that"
827 "a spliced query location is not collapsed to single range as it would by default");
828 arg_desc->AddFlag(
"adaptive_depth",
829 "Use adaptive depth in SAnnotSelector (e.g. when dealing with chromosome locations)"
830 "Default is false, because normally we don't want to dig down to find features");
832 arg_desc->AddFlag(
"allow_ID",
833 "Use ID when explicitly provided scope is lacking necessary info"
834 " (e.g. when remapping contig annots from file with chromosome alignments"
835 " we would need to get chromosome seq-map from gb to iterate feats in chrom coords)");
838 arg_desc->AddOptionalKey(
"add_qual",
840 "Add additional named qualifier columns q_qualkey and t_qualkey",
844 arg_desc->AddOptionalKey(
"add_dbxref",
846 "Add additional named dbxref columns q_dbxrefkey and t_dbxrefkey",
853 arg_desc->AddFlag(
"range_overlap",
"Use overlap by ranges to allow comparison between features that overlap by ranges but not by intervals.");
854 arg_desc->AddFlag(
"reverse",
"Swap q and t in inputs");
856 arg_desc->AddFlag(
"trace",
"Turn on tracing");
857 arg_desc->AddFlag(
"strict_type",
"Match features of the same type only");
859 arg_desc->SetUsageContext(
861 "Cross-compare annots on seqs",
false);
905 _TRACE(
"Mapping range q: " + s);
910 _TRACE(
"Mapping range t:" + s);
927 bool self_comparison =
1005 if(t_start > t_stop) {
1015 qloc->
SetInt().SetId(*q_seq_id);
1016 qloc->
SetInt().SetFrom(q_start);
1017 qloc->
SetInt().SetTo(q_stop);
1021 tloc->
SetInt().SetId(*t_seq_id);
1022 tloc->
SetInt().SetFrom(t_start);
1023 tloc->
SetInt().SetTo(t_stop);
1024 tloc->
SetInt().SetStrand(t_strand);
1050 typedef list<CRef<CSeq_align> > TSeqAlignList;
1058 TSeqAlignList aligns_list;
1061 _TRACE(
"Processing " + filename);
1066 typedef list<CRef<CSeq_align> > TSeqAlignList;
1067 if(
m_args[
"i_container"].AsString() ==
"Seq-align-set") {
1069 *istr >> *aligns_set;
1070 }
else if(
m_args[
"i_container"].AsString() ==
"Seq-annot") {
1072 *istr >> *aligns_annot;
1073 }
else if (
m_args[
"i_container"].AsString() ==
"Seq-align") {
1076 aligns_list.clear();
1077 aligns_list.push_back(aln);
1095 aligns_set ? aligns_set->
Set() :
1096 aligns_annot ? aligns_annot->
SetData().SetAlign() :
1103 CRef<CSeq_id>& seq_id = (*it)->SetSegs().SetDenseg().SetIds()[
i];
1104 if(seq_id.
IsNull())
continue;
1106 string str_seq_id =
"";
1117 (*it)->SwapRows(0, 1);
1122 const CSeq_id& id_q = (*it)->GetSeq_id(0);
1127 string str_id_q =
"";
1130 string str_id_t =
"";
1131 id_t.GetLabel(&str_id_t);
1133 string str_aln =
"aln:" + str_id_q +
"->" + str_id_t;
1141 _TRACE(str_aln +
" : query seq not in scope_q");
1144 _TRACE(str_aln +
" : target seq not in scope_t");
1148 if(alnMixes[str_aln].IsNull()) alnMixes[str_aln].Reset(
new CAlnMix());
1154 ITERATE(TAlnMixes, it2, alnMixes) {
1155 string str_id = it2->first;
1212 loc->
SetInt().SetId(*
id);
1265 if(
m_args[
"sentinel_feats"]) {
1325 TSeqPos enclosing_alignment_length)
1327 static unsigned groupNumber = 1;
1329 string loc_label =
"";
1331 LOG_POST(
"Processing location " << loc_label);
1334 vector<CRef<CCompareFeats> > v;
1337 int comparisonNumber = 1;
1339 _TRACE(
"Next comparison group");
1344 if(cf->GetMappedIdentity() <= 0) {
continue;}
1349 NcbiCout << groupNumber <<
"\t" << comparisonNumber <<
"\t";
1351 if(!cf->GetFeatQ().
IsNull()) {
1371 NcbiCout <<
"\t\t\t\t\t\t\t\t\t\t\t";
1375 if(!cf->GetFeatT().
IsNull()) {
1399 string sResult =
"";
1400 cf->GetComparison()->GetResult(&sResult);
1401 NcbiCout << cf->GetComparison()->GetEvidenceString() <<
"\t";
1402 cf->GetComparison()->GetResult(&sResult);
1404 NcbiCout << cf->GetMappedIdentity() <<
"\t";
1405 NcbiCout << cf->GetComparison()->GetRelativeOverlap() <<
"\t";
1406 NcbiCout << cf->GetComparison()->GetSymmetricalOverlap() <<
"\t";
1409 float shared_sites_score(0.0f);
1410 int loc1_intervals(0);
1411 int loc2_intervals(0);
1412 cf->GetComparison()->GetSplicingSimilarity(shared_sites_score, &loc1_intervals, &loc2_intervals);
1413 NcbiCout << loc1_intervals <<
"\t";
1414 NcbiCout << loc2_intervals <<
"\t";
1415 NcbiCout << shared_sites_score <<
"\t";
1423 int loc1_intervals(0);
1424 if(!cf->GetFeatQ().
IsNull()) {
1425 for (
CSeq_loc_CI ci(*cf->GetSelfLocQ()); ci; ++ci) {
1431 int loc2_intervals(0);
1432 if(!cf->GetFeatT().
IsNull()) {
1433 for (
CSeq_loc_CI ci(*cf->GetSelfLocT()); ci; ++ci) {
1439 << cf->GetMappedIdentity() <<
"\t"
1453 << enclosing_alignment_length <<
"\t"
1462 int ir = cf->GetIrrelevance();
1463 NcbiCout << (ir == 0 ?
"B" : ir == 1 ?
"F" : ir == 2 ?
"R" :
"O");
1470 NcbiCout <<
"\t" << (cf->GetFeatQ().
IsNull() ?
"" : cf->GetFeatQ()->GetNamedQual(*it2));
1471 NcbiCout <<
"\t" << (cf->GetFeatT().
IsNull() ?
"" : cf->GetFeatT()->GetNamedQual(*it2));
1475 if(
m_args[
"add_dbxref"]) {
1477 string str_tag = *it2;
1478 for(
int j = 0; j < 2; j++) {
1488 }
else if(str_tag ==
"@gene_feat_id") {
1533 string args_str =
"";
1547 if(
m_args[
"adaptive_depth"]) {
1560 if(
m_args[
"range_overlap"]) {
1581 bool use_scopeless_mapper =
false;
1592 use_scopeless_mapper =
true;
1621 LOG_POST(
"Loading id conversion map");
1624 while(getline(istr, line).good()) {
1625 if(line.size() == 0 || line.compare(0, 1,
"#") == 0)
continue;
1626 vector<string> tokens;
1628 if(tokens.size() != 3) {
1629 ERR_POST(
Fatal <<
"Unexpected input it id_map. Execting 3 columns" << line);
1640 if(use_scopeless_mapper) {
1670 <<
"Qry_mapped_id\t"
1671 <<
"Qry_mapped_start\t"
1672 <<
"Qry_mapped_stop\t"
1673 <<
"Qry_mapped_strand\t"
1683 <<
"Mapped_identity\t"
1684 <<
"Relative_overlap\t"
1685 <<
"Symmetric_overlap\t"
1688 <<
"Splicing_similarity\t"
1705 if(
m_args[
"add_dbxref"]) {
1722 while (getline(istr, line).good()) {
1723 if(line.size() == 0 || line.compare(0, 1,
"#") == 0)
continue;
1724 vector<string> tokens;
1727 if(
m_args[
"i"].AsString().find(
".asn") != string::npos && tokens[0].find(
":=") != string::npos)
1735 }
else if(tokens.size() == 1) {
1741 }
else if(tokens.size() == 6 || tokens.size() == 2) {
1747 string q_id = tokens[0];
1748 string t_id = tokens.size() == 2 ? tokens[1] : tokens[3];
1754 if(tokens.size() == 6) {
1781 }
else if(tokens.size() == 3) {
1785 if(tokens[1] ==
"" || tokens[2] ==
"") {
1788 loc->
SetInt().SetId(*
id);
1833 id_q->
Assign(*ci.GetRefSeqid().GetSeqId());
1834 loc_q->
SetInt().SetId(*id_q);
1835 loc_q->
SetInt().SetFrom(ci.GetRefPosition());
1836 loc_q->
SetInt().SetTo(ci.GetEndPosition());
1861 ERR_POST(
Fatal <<
"Unexpected number of columns, " << tokens.size() << line);
1885 int main(
int argc,
const char* argv[])
User-defined methods of the data storage class.
User-defined methods of the data storage class.
const TConstAlns & GetInputSeqAligns(void) const
void Merge(TMergeFlags flags=0)
const CSeq_align & GetSeqAlign(void) const
Compare multiple feature annotations on the specified seq_locs.
static int s_GetGeneId(const CSeq_feat &feat)
const CSeq_loc & GetQueryLoc() const
bool NextComparisonGroup(vector< CRef< CCompareFeats > > &v)
Return the next group of comparisons on the region (return true iff found any) A group is a set of fe...
TComparisonOptions GetOptions() const
void GetLabel(string *label) const
static string GetLoaderNameFromArgs(CReader *reader=0)
static TRegisterLoaderInfo RegisterInObjectManager(CObjectManager &om, CReader *reader=0, CObjectManager::EIsDefault is_default=CObjectManager::eDefault, CObjectManager::TPriority priority=CObjectManager::kPriority_NotSet)
Interface for handling Seq-entry objects.
CGBReleaseFile is a utility class to ease the processing of Genbank release files one Seq-entry at a ...
void RegisterHandler(ISeqEntryHandler *handler)
Register handler.
void Read(void)
Read the release file.
virtual ~CGbScopeLoader()
bool HandleSeqEntry(CRef< CSeq_entry > &entry)
user code for handling a Seq-entry goes here.
CGbScopeLoader(CScope &scope)
double GetIdentity() const
CGappedRange(const CGappedRange &r1, const CGappedRange &r2)
CGappedRange(TRange range=TRange(), unsigned gaps=0)
CRef< CSeq_loc > Map(const CSeq_loc &loc, double *mapped_identity=NULL)
CRef< CSeq_id > m_from_id
CLocMapper_Default(CSeq_loc_Mapper &mapper, CScope &scope, bool is_spliced=false, const CSeq_id *from_id=NULL, bool strip_versions=false)
string m_from_id__accession
CGappedRange CollapseRanges(list< CGappedRange > &ranges, TSeqPos query_len, double *identity_out=NULL)
CSeq_loc_Mapper & m_mapper
static double GetBiasedSymmetricIdentity(TSeqPos qry_len, TSeqPos tgt_len, TSeqPos aln_len, double qry_bias=0.5)
Storage for multiple mapping ranges.
@RNA_ref.hpp User-defined methods of the data storage class.
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...
TSeqPos GetSeqStop(TDim row) const
const CSeq_id & GetSeq_id(TDim row) const
Get seq-id (the first one if segments have different ids).
TSeqPos GetSeqStart(TDim row) const
namespace ncbi::objects::
CConstRef< CDbtag > GetNamedDbxref(const CTempString &db) const
Return a specified DB xref.
Seq-loc iterator class – iterates all intervals from a seq-loc in the correct order.
CRef< CScope > m_scope_for_mapper
map< int, map< string, string > > m_id_map
void x_ProcessMappingRanges()
CRef< CScope > m_scope_id
CSeq_id_Handle m_q_id_prev
virtual void Init(void)
Initialize the application.
void x_ProcessSeqAlignSetFromFile(string filename)
CRef< CMappingRanges > m_mapping_ranges
void x_ProcessMappingRange(string q_id, TSeqPos q_start, TSeqPos q_stop, string t_id, TSeqPos t_start, TSeqPos t_stop)
void x_ProcessComparison(CCompareSeqRegions &comparator, TSeqPos enclosing_alignment_length)
virtual int Run(void)
Run the application.
CSeq_id_Handle m_t_id_prev
CZipStreamDecompressor – zlib based decompression stream processor.
Include a standard set of the NCBI C++ Toolkit most basic headers.
API (CDeflineGenerator) for computing sequences' titles ("definitions").
std::ofstream out("events_result.xml")
main entry point for tests
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
static const char * str(char *buf, int n)
void reset(element_type *p=0, EOwnership ownership=eTakeOwnership)
Reset will delete the old pointer (if owned), set content to the new value, and assume the ownership ...
unsigned int TSeqPos
Type for sequence locations and lengths.
virtual const CArgs & GetArgs(void) const
Get parsed command line arguments.
int AppMain(int argc, const char *const *argv, const char *const *envp=0, EAppDiagStream diag=eDS_Default, const char *conf=NcbiEmptyCStr, const string &name=NcbiEmptyString)
Main function (entry point) for the NCBI application.
virtual void SetupArgDescriptions(CArgDescriptions *arg_desc)
Setup the command line argument descriptions.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
const CNcbiArguments & GetArguments(void) const
Get the application's cached unprocessed command-line arguments.
void swap(NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair1, NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair2)
@ eTakeOwnership
An object can take ownership of another.
string & Print(string &str) const
Print (append) all arguments to the string "str" and return "str".
CArgs & Assign(const CArgs &other)
Copy contents of another object into this one.
vector< string > TStringArray
Some values types can contain several value lists.
@ fAllowMultiple
Repeated key arguments are legal (use with AddKey)
@ eInputFile
Name of file (must exist and be readable)
@ eString
An arbitrary string.
@ eInteger
Convertible into an integer number (int or Int8)
@ fCheckFileHeader
Check (and skip) gzip file header on decompression stage.
void SetDiagPostFlag(EDiagPostFlag flag)
Set the specified flag (globally).
EDiagSev SetDiagPostLevel(EDiagSev post_sev=eDiag_Error)
Set the threshold severity for posting the messages.
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
void SetDiagTrace(EDiagTrace how, EDiagTrace dflt=eDT_Default)
Set the diagnostic trace settings.
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
@ eDPF_All
All flags (except for the "unusual" ones!)
@ eDS_Default
Try standard log file (app.name + ".log") in /log/, use stderr on failure.
@ eDT_Enable
Enable messages of severity "eDiag_Trace".
@ eDiag_Info
Informational message.
@ eDiag_Warning
Warning message.
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 Warning(CExceptionArgs_Base &args)
void Fatal(CExceptionArgs_Base &args)
#define NCBI_REPORT_EXCEPTION(title, ex)
Generate a report on the exception.
void Info(CExceptionArgs_Base &args)
TEntries GetEntries(const string &mask=kEmptyStr, TGetEntriesFlags flags=0) const
Get directory entries based on the specified "mask".
ESerialDataFormat
Data file format.
@ eSerial_AsnText
ASN.1 text.
@ eSerial_AsnBinary
ASN.1 binary.
const string AsFastaString(void) const
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Optimized implementation of CSerialObject::Assign, which is not so efficient.
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
CSeq_id & Set(const CTempString &the_id, TParseFlags flags=fParse_AnyRaw)
Reassign based on flat specifications; arguments interpreted as with constructors.
string GetLabel(const CSeq_id &id)
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Override Assign() to incorporate cache invalidation.
void SetId(CSeq_id &id)
set the 'id' field in all parts of this location
int Compare(const CSeq_loc &loc) const
void Add(const CSeq_loc &other)
Simple adding of seq-locs.
void GetLabel(string *label) const
Appends a label suitable for display (e.g., error messages) label must point to an existing string ob...
void SetNull(void)
Override all setters to incorporate cache invalidation.
virtual bool EndOfData(void)
Check if there is still some meaningful data that can be read; in text streams this function will ski...
static CObjectIStream * Open(ESerialDataFormat format, CNcbiIstream &inStream, bool deleteInStream)
Create serial object reader and attach it to an input stream.
@ fFGL_Content
Include its content if there is any.
@ fFGL_Type
Always include the feature's type.
TSeqPos GetStop(const CSeq_loc &loc, CScope *scope, ESeqLocExtremes ext=eExtreme_Positional)
If only one CBioseq is represented by CSeq_loc, returns the position at the stop of the location.
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...
TSeqPos GetStart(const CSeq_loc &loc, CScope *scope, ESeqLocExtremes ext=eExtreme_Positional)
If only one CBioseq is represented by CSeq_loc, returns the position at the start of the location.
CRef< CSeq_loc > Seq_loc_Merge(const CSeq_loc &loc, CSeq_loc::TOpFlags flags, CScope *scope)
Merge ranges in the seq-loc.
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.
string GetAccessionForId(const objects::CSeq_id &id, CScope &scope, EAccessionVersion use_version=eWithAccessionVersion, EGetIdType flags=0)
Retrieve the accession string for a Seq-id.
const CMolInfo * GetMolInfo(const CBioseq &bioseq)
Retrieve the MolInfo object for a given bioseq handle.
@ eWithoutAccessionVersion
accession only, even if version is available
@ eGetId_ForceAcc
return only an accession based seq-id
CRef< CSeq_loc > Map(const CSeq_loc &src_loc)
Map seq-loc.
void ResetHistory(EActionIfLocked action=eKeepIfLocked)
Clean all unused TSEs from the scope's cache and release the memory.
void AddDataLoader(const string &loader_name, TPriority pri=kPriority_Default)
Add data loader by name.
static CRef< CObjectManager > GetInstance(void)
Return the existing object manager or create one.
CSeq_entry_Handle AddTopLevelSeqEntry(CSeq_entry &top_entry, TPriority pri=kPriority_Default, EExist action=eExist_Default)
Add seq_entry, default priority is higher than for defaults or loaders Add object to the score with p...
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
void GetAllTSEs(TTSE_Handles &tses, enum ETSEKind kind=eManualTSEs)
CSeq_annot_Handle AddSeq_annot(CSeq_annot &annot, TPriority pri=kPriority_Default, EExist action=eExist_Throw)
Add Seq-annot, return its CSeq_annot_Handle.
void UpdateAnnotIndex(void)
void AddScope(CScope &scope, TPriority pri=kPriority_Default)
Add the scope's datasources as a single group with the given priority All data sources (data loaders ...
vector< CSeq_entry_Handle > TTSE_Handles
@ eSeqMap_Up
map from segments to the top level bioseq
SAnnotSelector & IncludeFeatSubtype(TFeatSubtype subtype)
Include feature subtype in the search.
SAnnotSelector & SetFeatType(TFeatType type)
Set feature type (also set annotation type to feat)
SAnnotSelector & SetExactDepth(bool value=true)
SetExactDepth() specifies that annotations will be searched on the segment level specified by SetReso...
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 & SetResolveDepth(int depth)
SetResolveDepth sets the limit of subsegment resolution in searching annotations.
SAnnotSelector & SetSearchUnresolved(void)
SAnnotSelector & IncludeFeatType(TFeatType type)
Include feature type in the search.
SAnnotSelector & SetMaxSize(TMaxSize max_size)
Set maximum number of annotations to find.
SAnnotSelector & SetOverlapIntervals(void)
Check overlapping of individual intervals.
SAnnotSelector & SetSortOrder(ESortOrder sort_order)
Set sort order of annotations.
@ eSortOrder_None
do not sort annotations for faster retrieval
@ eSeqRef
reference to Bioseq
bool IsNull(void) const THROWS_NONE
Check if pointer is null – same effect as Empty().
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
void Reset(void)
Reset reference object.
void Reset(void)
Reset reference object.
bool IsNull(void) const THROWS_NONE
Check if pointer is null – same effect as Empty().
static void EnableGlobally(bool enable=true)
Enable (or disable, if called with enable = false) loading plugins from DLLs in general.
position_type GetLength(void) const
TThisType CombinationWith(const TThisType &r) const
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
static string DoubleToString(double value, int precision=-1, TNumToStringFlags flags=0)
Convert double to string.
static int StringToInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to int.
static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Split a string using specified delimiters.
static bool EndsWith(const CTempString str, const CTempString end, ECase use_case=eCase)
Check if a string ends with a specified suffix value.
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
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.
static unsigned int StringToUInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to unsigned int.
static string UInt8ToString(Uint8 value, TNumToStringFlags flags=0, int base=10)
Convert UInt8 to string.
@ eNocase
Case insensitive compare.
string AsString(const CTimeFormat &format=kEmptyStr, TSeconds out_tz=eCurrentTimeZone) const
Transform time to string.
CTime & SetCurrent(void)
Make the time current in the presently active time zone.
TTo GetTo(void) const
Get the To member data.
TFrom GetFrom(void) const
Get the From member data.
TId GetId(void) const
Get the variant data.
void SetType(TType value)
Assign a value to Type data member.
Tdata & Set(void)
Assign a value to data member.
TDim GetDim(void) const
Get the Dim member data.
const TData & GetData(void) const
Get the Data member data.
void SetLocation(TLocation &value)
Assign a value to Location data member.
const TId & GetId(void) const
Get the Id member data.
const TLocal & GetLocal(void) const
Get the variant data.
bool IsLocal(void) const
Check if variant Local is selected.
const TId & GetId(void) const
Get the Id member data.
void SetTitle(const TTitle &value)
Assign a value to Title data member.
bool IsGene(void) const
Check if variant Gene is selected.
bool CanGetId(void) const
Check if it is safe to call GetId method.
const TData & GetData(void) const
Get the Data member data.
bool IsSetData(void) const
the specific data Check if a value has been assigned to Data data member.
bool CanGetId(void) const
Check if it is safe to call GetId method.
void SetData(TData &value)
Assign a value to Data data member.
const TProduct & GetProduct(void) const
Get the Product member data.
const TXref & GetXref(void) const
Get the Xref member data.
vector< CRef< CSeqFeatXref > > TXref
bool CanGetProduct(void) const
Check if it is safe to call GetProduct method.
bool IsEmpty(void) const
Check if variant Empty is selected.
ENa_strand
strand of nucleic acid
bool IsGi(void) const
Check if variant Gi is selected.
bool IsWhole(void) const
Check if variant Whole is selected.
bool IsNull(void) const
Check if variant Null is selected.
@ eNa_strand_both
in forward orientation
TSeq & SetSeq(void)
Select the variant.
void SetData(TData &value)
Assign a value to Data data member.
TId & SetId(void)
Assign a value to Id data member.
void SetInst(TInst &value)
Assign a value to Inst data member.
TBiomol GetBiomol(void) const
Get the Biomol member data.
@ eRepr_virtual
no seq data
@ eBiomol_other_genetic
other genetic material
range(_Ty, _Ty) -> range< _Ty >
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
Defines command line argument related classes.
Defines unified interface to application:
Defines NCBI C++ exception handling.
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
std::istream & in(std::istream &in_, double &x_)
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
Plugin manager (using class factory paradigm).
static bool GetSeqId(const T &d, set< string > &labels, const string name="", bool detect=false, bool found=false)
#define row(bind, expected)
Selector used in CSeqMap methods returning iterators.
bool IsInScope(CScope &scope, const CSeq_id &id)
string GetIdStartStopStrandStr(const CSeq_loc &loc, CScope &scope, bool use_long_label)
bool IsManualScope(CScope &scope)
TLoadScopeMethod LoadScope(string arg_path, CScope &scope, ESerialDataFormat serial_format)
void AddSpanningSentinelFeat(CScope &scope, const CSeq_id &id, CSeqFeatData::E_Choice type, string title="Sentinel")
void AddDefaultSentinelFeats(CScope &scope, const CSeq_loc &loc)
ESerialDataFormat StringToSerialFormat(string str)
int main(int argc, const char *argv[])
void AddSentinelRNASeq(CScope &scope, const CSeq_id &id)
unique_ptr< CObjectIStream > GetIStream(string path, ESerialDataFormat serial_format)
string GetProductLabel(const CSeq_feat &feat, CScope &scope)