* asciiMimeFirstWord =
"Ncbi-mime-asn1";
75 static const char* asciiCDDFirstWord =
"Cdd";
76 boolisMime =
false,
isBinary =
true;
79asnIstream >> firstWord;
80 if(firstWord == asciiMimeFirstWord) {
83}
else if(firstWord == asciiCDDFirstWord) {
89unique_ptr<SeqEntryList> newSequences(
new SeqEntryList());
90unique_ptr<SeqAnnotList> newAlignments(
new SeqAnnotList());
103newSequences->resize(1);
104newSequences->front().Reset(&(cdd->SetSequences()));
105*newAlignments = cdd->GetSeqannot();
119 if(mime->IsStrucseqs()) {
120*newSequences = mime->GetStrucseqs().GetSequences();
121*newAlignments = mime->GetStrucseqs().GetSeqalign();
122}
else if(mime->IsAlignstruc()) {
123*newSequences = mime->GetAlignstruc().GetSequences();
124*newAlignments = mime->GetAlignstruc().GetSeqalign();
125}
else if(mime->IsAlignseq()) {
126*newSequences = mime->GetAlignseq().GetSequences();
127*newAlignments = mime->GetAlignseq().GetSeqalign();
128}
else if(mime->IsGeneral()) {
129 if(mime->GetGeneral().GetSeq_align_data().IsBundle()) {
130*newSequences = mime->GetGeneral().GetSeq_align_data().GetBundle().GetSequences();
131*newAlignments = mime->GetGeneral().GetSeq_align_data().GetBundle().GetSeqaligns();
132}
else if(mime->GetGeneral().GetSeq_align_data().IsCdd()) {
133newSequences->resize(1);
134newSequences->front().
Reset(&(mime->SetGeneral().SetSeq_align_data().SetCdd().SetSequences()));
135*newAlignments = mime->GetGeneral().GetSeq_align_data().GetCdd().GetSeqannot();
142 ERR_POST_X(3,
Error<<
"Input is not a recognized data type (Ncbi-mime-asn1 or Cdd) : "<< err);
145 if(newSequences->size() == 0 || newAlignments->size() == 0) {
146 ERR_POST_X(4,
Error<<
"Cannot find sequences and alignments in the input data!");
150*sequences = newSequences.release();
151*alignments = newAlignments.release();
160 intalnLoc, masterLoc, slaveLoc, currentMasterLoc, currentSlaveLoc;
161 charmasterChar, slaveChar;
164 for(
unsigned int i=0;
i<alignmentSet->
alignments.size(); ++
i) {
165masterLoc = slaveLoc = -1;
168 for(alnLoc=0; alnLoc<(
int)display->
GetWidth(); ++alnLoc) {
171masterChar = display->
GetCharAt(alnLoc, 0);
172 if(masterChar ==
'?') {
173 ERR_POST_X(5,
Error<<
"bad alignment coordinate: loc "<< (alnLoc+1) <<
" row 1 (master)");
176slaveChar = display->
GetCharAt(alnLoc, 1 +
i);
177 if(slaveChar ==
'?') {
178 ERR_POST_X(6,
Error<<
"bad alignment coordinate: loc "<< (alnLoc+1) <<
" row "<< (
i+2));
183 if(!
IsGap(masterChar)) {
187 ERR_POST_X(7,
Error<<
"master sequence too long at alnLoc "<< (alnLoc+1)
188<<
" row "<< (
i+2) <<
" masterLoc "<< (masterLoc+1));
190}
else if(
toupper((
unsigned char) masterChar) !=
192 ERR_POST_X(8,
Error<<
"master sequence mismatch at alnLoc "<< (alnLoc+1)
193<<
" row "<< (
i+2) <<
" masterLoc "<< (masterLoc+1));
198 if(!
IsGap(slaveChar)) {
201 ERR_POST_X(9,
Error<<
"slave sequence too long at alnLoc "<< (alnLoc+1)
202<<
" row "<< (
i+2) <<
" slaveLoc "<< (slaveLoc+1));
204}
else if(
toupper((
unsigned char) slaveChar) !=
206 ERR_POST_X(10,
Error<<
"slave sequence mismatch at alnLoc "<< (alnLoc+1)
207<<
" row "<< (
i+2) <<
" slaveLoc "<< (slaveLoc+1));
211currentMasterLoc =
IsGap(masterChar) ? -1 : masterLoc;
212currentSlaveLoc =
IsGap(slaveChar) ? -1 : slaveLoc;
216 if(currentMasterLoc >= 0 && alignment->
masterToSlave[currentMasterLoc] != -1) {
217 ERR_POST_X(11,
Error<<
"slave should be marked aligned at alnLoc "<< (alnLoc+1)
218<<
" row "<< (
i+2));
224 ERR_POST_X(12,
Error<<
" slave marked aligned but master unaligned at alnLoc "<< (alnLoc+1)
225<<
" row "<< (
i+2));
229 ERR_POST_X(13,
Error<<
"slave incorrectly marked aligned at alnLoc "<< (alnLoc+1)
230<<
" row "<< (
i+2));
233 if(alignment->
masterToSlave[currentMasterLoc] != currentSlaveLoc) {
234 ERR_POST_X(14,
Error<<
"wrong slave residue aligned at alnLoc "<< (alnLoc+1)
235<<
" row "<< (
i+2));
241 if(!
IsGap(masterChar)) {
244 ERR_POST_X(15,
Error<<
"slave should be unaligned at alnLoc "<< (alnLoc+1)
245<<
" row "<< (
i+2));
250 ERR_POST_X(16,
Error<<
"slave should be aligned at alnLoc "<< (alnLoc+1)
251<<
" row "<< (
i+2));
254 if(currentSlaveLoc != alignment->
masterToSlave[currentMasterLoc]) {
255 ERR_POST_X(17,
Error<<
"wrong slave residue aligned to master at alnLoc "<< (alnLoc+1)
256<<
" row "<< (
i+2));
283 unsigned intoptions,
284 unsigned intparagraphWidth,
285 doubleconservationThreshhold,
293IOS_BASE::sync_with_stdio(
true);
298outStream = outputStream;
305 if(diagnosticStream)
317 ERR_POST_X(19,
Error<<
"Cannot do condensed display except with text/HTML output");
321 ERR_POST_X(20,
Error<<
"Cannot do fasta_lc option except with FASTA output");
325 ERR_POST_X(21,
Error<<
"Cannot do HTML header without HTML output");
330unique_ptr<SequenceSet> sequenceSet(
new SequenceSet(sequences));
331 if(!sequenceSet.get() || sequenceSet->Status() !=
CAV_SUCCESS) {
333 returnsequenceSet->Status();
336 if(!alignmentSet.get() || alignmentSet->Status() !=
CAV_SUCCESS) {
338 returnalignmentSet->Status();
342unique_ptr<AlignmentDisplay> display(
new AlignmentDisplay(sequenceSet.get(), alignmentSet.get()));
343 if(!display.get() || display->Status() !=
CAV_SUCCESS) {
345 returndisplay->Status();
361from = (options &
CAV_LEFTTAILS) ? 0 : display->GetFirstAlignedLoc(),
362to = (options &
CAV_RIGHTTAILS) ? display->GetWidth()-1 : display->GetLastAlignedLoc();
367retval = display->DumpCondensed(*outStream, options,
368from, to, paragraphWidth, conservationThreshhold, title, nFeatures, alnFeatures);
370retval = display->DumpText(*outStream, options,
371from, to, paragraphWidth, conservationThreshhold, title, nFeatures, alnFeatures);
373retval = display->DumpFASTA(from, to, paragraphWidth,
386 const void*asnDataBlock,
388 unsigned intoptions,
389 unsigned intparagraphWidth,
390 doubleconservationThreshhold,
403 CNcbiIstrstreamasnIstrstream(
static_cast<const char*
>(asnDataBlock));
415unique_ptr<const SeqEntryList> sequences(seqs);
416unique_ptr<const SeqAnnotList> alignments(alns);
419title, nFeatures, alnFeatures, outputStream, diagnosticStream);
423 const void*asnDataBlock,
425 unsigned intoptions,
426 unsigned intparagraphWidth,
427 doubleconservationThreshhold,
433conservationThreshhold, title, nFeatures, features,
NULL,
NULL);
437 constncbi::objects::CNcbi_mime_asn1& mime,
438 unsigned intoptions,
439 unsigned intparagraphWidth,
440 doubleconservationThreshhold,
451 if(mime.IsStrucseqs()) {
452sequences = &(mime.GetStrucseqs().GetSequences());
453alignments = &(mime.GetStrucseqs().GetSeqalign());
454}
else if(mime.IsAlignstruc()) {
455sequences = &(mime.GetAlignstruc().GetSequences());
456alignments = &(mime.GetAlignstruc().GetSeqalign());
457}
else if(mime.IsAlignseq()) {
458sequences = &(mime.GetAlignseq().GetSequences());
459alignments = &(mime.GetAlignseq().GetSeqalign());
460}
else if(mime.IsGeneral()) {
461 if(mime.GetGeneral().GetSeq_align_data().IsBundle()) {
462sequences = &(mime.GetGeneral().GetSeq_align_data().GetBundle().GetSequences());
463alignments = &(mime.GetGeneral().GetSeq_align_data().GetBundle().GetSeqaligns());
464}
else if(mime.GetGeneral().GetSeq_align_data().IsCdd()) {
465localSeqList.resize(1);
466localSeqList.front().Reset(
const_cast<CSeq_entry*
>(&(mime.GetGeneral().GetSeq_align_data().GetCdd().GetSequences())));
467sequences = &localSeqList;
468alignments = &(mime.GetGeneral().GetSeq_align_data().GetCdd().GetSeqannot());
472 if(!sequences || !alignments) {
473 ERR_POST_X(31,
Error<<
"Ncbi-mime-asn1 object is not of recognized type");
477 return CAV_DisplayMultiple(*sequences, *alignments, options, paragraphWidth, conservationThreshhold,
478title, nFeatures, features, outputStream, diagnosticStream);
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.
list< CRef< objects::CSeq_annot > > SeqAnnotList
bool IsUnaligned(char ch)
bool ReadASNFromIstream(CNcbiIstream &inStream, ASNClass &ASNobject, bool isBinary, string &err)
static bool VerifyAlignmentData(const AlignmentSet *alignmentSet, const AlignmentDisplay *display)
int CAV_DisplayMultiple(const SeqEntryList &sequences, const SeqAnnotList &alignments, unsigned int options, unsigned int paragraphWidth, double conservationThreshhold, const char *title, int nFeatures, const AlignmentFeature *alnFeatures, CNcbiOstream *outputStream, CNcbiOstream *diagnosticStream)
static int LoadASNFromIstream(CNcbiIstream &asnIstream, const SeqEntryList **sequences, const SeqAnnotList **alignments)
static EDiagSev defaultDiagPostLevel
list< CRef< objects::CSeq_entry > > SeqEntryList
C interface header for cddalignview as function call.
#define CAV_IGNORE_BAD_ALN
#define CAV_ERROR_DISPLAY
#define CAV_SHOW_IDENTITY
#define CAV_FASTA_LOWERCASE
#define CAV_ERROR_BAD_PARAMS
#define CAV_ERROR_BAD_ASN
#define CAV_NO_CHANGE_DIAG
unsigned int GetWidth(void) const
static const double SHOW_IDENTITY
char GetCharAt(int alnLoc, int row) const
ResidueVector masterToSlave
EDiagSev SetDiagPostLevel(EDiagSev post_sev=eDiag_Error)
Set the threshold severity for posting the messages.
#define ERR_POST_X(err_subcode, message)
Error posting with default error code and given error subcode.
EDiagSev
Severity level for the posted diagnostics.
void SetDiagStream(CNcbiOstream *os, bool quick_flush=true, FDiagCleanup cleanup=0, void *cleanup_data=0, const string &stream_name="")
Set diagnostic stream.
@ eDiag_Info
Informational message.
@ eDiag_Error
Error message.
@ eDiag_Fatal
Fatal error â guarantees exit(or abort)
void Critical(CExceptionArgs_Base &args)
void Error(CExceptionArgs_Base &args)
void Info(CExceptionArgs_Base &args)
void Reset(void)
Reset reference object.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
unsigned int
A callback function used to compare two keys in a database.
Defines NCBI C++ diagnostic APIs, classes, and macros.
The NCBI C++/STL use hints.
NCBI C++ stream class wrappers for triggering between "new" and "old" C++ stream libraries.
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