CBioseq_set::TSeq_set::iterator q, qe = bss.SetSeq_set().end();
82 for(q=bss.SetSeq_set().begin(); q!=qe; ++q) {
83 if(q->GetObject().IsSeq()) {
94 FATALMSG(
"Can't create Sequence object, aborting...");
95seqlist.push_back(sequence);
105 if(seqEntry.
IsSeq()) {
108 FATALMSG(
"Can't create Sequence object, aborting...");
109seqlist.push_back(sequence);
118SeqEntryList::iterator s, se = seqEntries.end();
119 for(s=seqEntries.begin(); s!=se; ++s)
126SequenceList::const_iterator s, se =
sequences.end();
127 for(s=
sequences.begin(); s!=se; ++s) {
128CBioseq::TId::const_iterator
i, ie = ids.end();
129 for(
i=ids.begin();
i!=ie; ++
i)
130 if((*s)->identifier->MatchesSeqId(**
i))
136 #define FIRSTOF2(byte) (((byte) & 0xF0) >> 4) 137 #define SECONDOF2(byte) ((byte) & 0x0F) 142 str->resize(vec.size() * 2);
144 str->resize(vec.size() * 2 - 1);
148 for(
i=0;
i<vec.size(); ++
i) {
154 for(
i=0;
i<
str->size(); ++
i) {
155 switch(
str->at(
i)) {
156 case1:
str->at(
i) =
'A';
break;
157 case2:
str->at(
i) =
'C';
break;
158 case4:
str->at(
i) =
'G';
break;
159 case8: isDNA ?
str->at(
i) =
'T':
str->at(
i) =
'U';
break;
161 str->at(
i) =
'X';
166 #define FIRSTOF4(byte) (((byte) & 0xC0) >> 6) 167 #define SECONDOF4(byte) (((byte) & 0x30) >> 4) 168 #define THIRDOF4(byte) (((byte) & 0x0C) >> 2) 169 #define FOURTHOF4(byte) ((byte) & 0x03) 173 str->resize(vec.size() * 4);
177 for(
i=0;
i<vec.size(); ++
i) {
185 for(
i=0;
i<
str->size(); ++
i) {
186 switch(
str->at(
i)) {
187 case0:
str->at(
i) =
'A';
break;
188 case1:
str->at(
i) =
'C';
break;
189 case2:
str->at(
i) =
'G';
break;
190 case3: isDNA ?
str->at(
i) =
'T':
str->at(
i) =
'U';
break;
197 str->resize(vec.size());
198 for(
unsigned int i=0;
i<vec.size(); ++
i)
205 if(bioseq.IsSetDescr()) {
206 stringdefline, taxid;
207CSeq_descr::Tdata::const_iterator d, de = bioseq.GetDescr().Get().end();
208 for(d=bioseq.GetDescr().Get().begin(); d!=de; ++d) {
211 if((*d)->IsTitle()) {
212defline = (*d)->GetTitle();
213}
else if(defline.size() == 0 && (*d)->IsPdb() && (*d)->GetPdb().GetCompound().size() > 0) {
214defline = (*d)->GetPdb().GetCompound().front();
218 if((*d)->IsSource()) {
219 if((*d)->GetSource().GetOrg().IsSetTaxname())
220taxid = (*d)->GetSource().GetOrg().GetTaxname();
221 else if((*d)->GetSource().GetOrg().IsSetCommon())
222taxid = (*d)->GetSource().GetOrg().GetCommon();
225 if(taxid.size() > 0)
227 if(defline.size() > 0) {
239 if(bioseq.IsSetAnnot()) {
240CBioseq::TAnnot::const_iterator
a, ae = bioseq.GetAnnot().end();
241 for(
a=bioseq.GetAnnot().begin();
a!=ae; ++
a) {
242 if(
a->GetObject().GetData().IsIds()) {
243CSeq_annot::C_Data::TIds::const_iterator
i, ie =
a->GetObject().GetData().GetIds().end();
244 for(
i=
a->GetObject().GetData().GetIds().begin();
i!=ie; ++
i) {
245 if(
i->GetObject().IsGeneral() &&
246 i->GetObject().GetGeneral().GetDb() ==
"mmdb"&&
247 i->GetObject().GetGeneral().GetTag().IsId()) {
248mmdbID =
i->GetObject().GetGeneral().GetTag().GetId();
252 if(
i!= ie)
break;
261 if(bioseq.GetInst().GetSeq_data().IsNcbieaa()) {
262 sequenceString= bioseq.GetInst().GetSeq_data().GetNcbieaa().Get();
264}
else if(bioseq.GetInst().GetSeq_data().IsIupacaa()) {
265 sequenceString= bioseq.GetInst().GetSeq_data().GetIupacaa().Get();
267}
else if(bioseq.GetInst().GetSeq_data().IsNcbistdaa()) {
273 else if(bioseq.GetInst().GetSeq_data().IsIupacna()) {
274 sequenceString= bioseq.GetInst().GetSeq_data().GetIupacna().Get();
282}
else if(bioseq.GetInst().GetSeq_data().IsNcbi4na()) {
285}
else if(bioseq.GetInst().GetSeq_data().IsNcbi8na()) {
288}
else if(bioseq.GetInst().GetSeq_data().IsNcbi2na()) {
291 if(bioseq.GetInst().IsSetLength() && bioseq.GetInst().GetLength() <
sequenceString.length())
296 ERRORMSG(
"Sequence::Sequence() - sequence "<< bioseq.GetId().front()->GetSeqIdString()
297<<
": confused by sequence string format");
302 if(bioseq.GetInst().IsSetLength() && bioseq.GetInst().GetLength() !=
sequenceString.length()) {
303 ERRORMSG(
"Sequence::Sequence() - sequence string length mismatch");
312 ERRORMSG(
"Sequence::Sequence() - sequence "<< bioseq.GetId().front()->GetSeqIdString() <<
": confused by sequence representation");
325 if(
title.size() > 0) {
326 if(descr.size() > 0)
332 if(object->
graph->
name.size() > 0) {
333 if(descr.size() > 0)
344CBioseq::TAnnot::const_iterator
a, ae =
bioseqASN->GetAnnot().end();
345CSeq_annot::C_Data::TIds::const_iterator
i, ie;
347 for(
a=
bioseqASN->GetAnnot().begin();
a!=ae; ++
a) {
348 if((*a)->GetData().IsIds()) {
349 for(
i=(*a)->GetData().GetIds().begin(), ie=(*a)->GetData().GetIds().end();
i!=ie; ++
i) {
350 if((*i)->IsGeneral() && (*i)->GetGeneral().GetDb() ==
"mmdb"&&
351(*i)->GetGeneral().GetTag().IsId())
355 if((*i)->GetGeneral().GetTag().GetId() != mmdbID ||
358 ERRORMSG(
"Sequence::AddMMDBAnnotTag() - mmdbID mismatch");
370annot->
SetData().SetIds().push_back(seqid);
371(
const_cast<Sequence*
>(
this))->bioseqASN->SetAnnot().push_back(annot);
385CBioseq::TId::const_iterator
i, ie =
bioseqASN->GetId().end();
428 ERRORMSG(
"Sequence::GetOrSetMMDBLink() - mismatched MMDB ID: identifier says " 439oss <<
"https://www.ncbi.nlm.nih.gov/"<< (
isProtein?
"protein":
"nuccore") <<
"/";
449 if(
label==
"query"||
label==
"consensus")
462 staticunique_ptr < CRegexp > regexp;
463 static stringpreviousPrositePattern;
465 if(!regexp.get() || prositePattern != previousPrositePattern) {
469 if(!
Prosite2Regex(prositePattern, ®exPattern, &nGroups))
470 throw "error converting ProSite to regex syntax";
473 TRACEMSG(
"creating CRegexp with pattern '"<< regexPattern <<
"'");
476previousPrositePattern = prositePattern;
481 while(start < (
int)
Length()) {
485 if(regexp->NumFound() <= 0)
493 booladdMatch =
true;
494 if(restrictTo.size() > 0) {
495MoleculeHighlightMap::const_iterator
r= restrictTo.find(
identifier);
496 if(
r!= restrictTo.end()) {
497 for(
i=1;
i<regexp->NumFound(); ++
i) {
498 for(
intj=regexp->GetResults(
i)[0]; j<=regexp->GetResults(
i)[1]-1; ++j) {
499 if(!
r->second[j]) {
513 for(
i=1;
i<regexp->NumFound(); ++
i)
517start = regexp->GetResults(regexp->NumFound() - 1)[1];
520}
catch(
const char*err) {
521 ERRORMSG(
"Sequence::HighlightPattern() - "<< err);
523}
catch(exception& e) {
524 ERRORMSG(
"Sequence::HighlightPattern() - caught exception: "<< e.what());
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
static void StringFromStdaa(const vector< char > &vec, string *str)
static void UnpackSeqSet(CBioseq_set &bss, SequenceSet *parent, SequenceSet::SequenceList &seqlist)
static void StringFrom4na(const vector< char > &vec, string *str, bool isDNA)
static void UnpackSeqEntry(CSeq_entry &seqEntry, SequenceSet *parent, SequenceSet::SequenceList &seqlist)
static void StringFrom2na(const vector< char > &vec, string *str, bool isDNA)
CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:
void AddHighlights(const Sequence *sequence, unsigned int seqIndexFrom, unsigned int seqIndexTo)
std::string GetLabel(void) const
static const int VALUE_NOT_SET
std::string ToString(void) const
static const MoleculeIdentifier * GetIdentifier(const Molecule *molecule, const SeqIdList &ids)
static const TGi GI_NOT_SET
std::list< ncbi::CRef< ncbi::objects::CSeq_entry > > SeqEntryList
std::list< ncbi::CRef< Sequence > > SequenceList
const Sequence * FindMatchingSequence(const ncbi::objects::CBioseq::TId &ids) const
SequenceSet(SeqEntryList &seqEntries)
void UnpackSeqEntry(const objects::CSeq_entry &seqEntry)
void FillOutSeqId(ncbi::objects::CSeq_id *sid) const
const Molecule * molecule
std::string GetDescription(void) const
const MoleculeIdentifier * identifier
unsigned int Length(void) const
void AddMMDBAnnotTag(int mmdbID) const
void LaunchWebBrowserWithInfo(void) const
bool HighlightPattern(const std::string &pattern, const MoleculeHighlightMap &restrictTo) const
Sequence(ncbi::objects::CBioseq &bioseq)
int GetOrSetMMDBLink(void) const
std::map< const MoleculeIdentifier *, std::vector< bool > > MoleculeHighlightMap
ncbi::objects::CSeq_id * CreateSeqId(void) const
CConstRef< objects::CBioseq > bioseqASN
bool GetParentOfType(const T **ptr, bool warnIfNotFound=true) const
const ChemicalGraph * graph
Include a standard set of the NCBI C++ Toolkit most basic headers.
bool Prosite2Regex(const std::string &prosite, std::string *regex, std::string *errString)
static const char * str(char *buf, int n)
TObjectType & GetObject(void) const
Get object.
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_SCOPE(ns)
Define a new scope.
static bool EndsWith(const CTempString str, const CTempString end, ECase use_case=eCase)
Check if a string ends with a specified suffix value.
@ eNocase
Case insensitive compare.
static const char label[]
void SetTag(TTag &value)
Assign a value to Tag data member.
void SetDb(const TDb &value)
Assign a value to Db data member.
TGeneral & SetGeneral(void)
Select the variant.
TSet & SetSet(void)
Select the variant.
bool IsSeq(void) const
Check if variant Seq is selected.
TSeq & SetSeq(void)
Select the variant.
void SetData(TData &value)
Assign a value to Data data member.
@ eRepr_raw
continuous sequence
@ eMol_na
just a nucleic acid
Messenger * GlobalMessenger(void)
The NCBI C++/STL use hints.
NCBI C++ stream class wrappers for triggering between "new" and "old" C++ stream libraries.
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
char LookupCharacterFromNCBIStdaaNumber(unsigned char n)
C++ wrappers for the Perl-compatible regular expression (PCRE) library.
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