A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/cav__alndisplay_8cpp_source.html below:

NCBI C++ ToolKit: src/objtools/cddalignview/cav_alndisplay.cpp Source File

54 #define NCBI_USE_ERRCODE_X Objtools_CAV_Disp 72 #define LEFT_JUSTIFY resetiosflags(IOS_BASE::right) << setiosflags(IOS_BASE::left) 73 #define RIGHT_JUSTIFY resetiosflags(IOS_BASE::left) << setiosflags(IOS_BASE::right) 78  for

(

unsigned int i

=0;

i

<newStr.size(); ++

i

) newStr[

i

] =

tolower

((

unsigned char

) newStr[

i

]);

95  if

(!sequenceSet->

master

) {

96  ERR_POST_X

(1,

Error

<<

"Need to know master sequence of SequenceSet for AlignmentDisplay construction"

);

109

AlignmentSet::AlignmentList::const_iterator

a

, ae = alignmentSet->

alignments

.end();

110  for

(

a

=alignmentSet->

alignments

.begin();

a

!=ae; ++

a

) {

123  int

prevAlignedSlaveSeqLoc = -1, prevAlignedSlaveAlnLoc = -1;

125  for

(

int

alnLoc=0; alnLoc<=(

int

)

GetWidth

(); ++alnLoc) {

127  int

masterSeqLoc = -1, alignedSlaveSeqLoc = -1;

131  if

(masterSeqLoc >= 0) {

132

alignedSlaveSeqLoc = (*a)->masterToSlave[masterSeqLoc];

133  if

(alignedSlaveSeqLoc >= 0) {

134  textRows

.front()->SetCharAt(alnLoc,

137  toupper

((

unsigned char

) (*a)->slave->sequenceString[alignedSlaveSeqLoc]));

142

masterSeqLoc = (*a)->master->sequenceString.size();

143

alignedSlaveSeqLoc = (*a)->slave->sequenceString.size();

146  if

(alignedSlaveSeqLoc >= 0) {

147  if

(alignedSlaveSeqLoc - prevAlignedSlaveSeqLoc > 1) {

148

intervalList.resize(intervalList.size() + 1);

149

intervalList.back().alnLocBefore = prevAlignedSlaveAlnLoc;

150

intervalList.back().alnLocAfter = alnLoc;

151

intervalList.back().seqLocFrom = prevAlignedSlaveSeqLoc + 1;

152

intervalList.back().seqLocTo = alignedSlaveSeqLoc - 1;

154

prevAlignedSlaveSeqLoc = alignedSlaveSeqLoc;

155

prevAlignedSlaveAlnLoc = alnLoc;

162

IntervalList::iterator

i

, ie = intervalList.end();

163  int

alnLocOffset = 0;

164  for

(

i

=intervalList.begin();

i

!=ie; ++

i

) {

167  i

->alnLocBefore += alnLocOffset;

168  i

->alnLocAfter += alnLocOffset;

171

displaySpace =

i

->alnLocAfter -

i

->alnLocBefore - 1,

172

unalignedLength =

i

->seqLocTo -

i

->seqLocFrom + 1,

173

extraSpace = displaySpace - unalignedLength;

176  if

(extraSpace < 0) {

180  if

(

i

->seqLocFrom == 0) {

182

}

else if

(

i

->seqLocTo == (*a)->slave->sequenceString.size() - 1) {

185

insertPos =

i

->alnLocAfter - displaySpace / 2;

189

alnLocOffset -= extraSpace;

194  for

(

l

=0;

l

<(

unsigned int

)unalignedLength; ++

l

) {

196  i

->alnLocBefore + 1 + ((

i

->seqLocFrom == 0) ?

l

+ extraSpace :

l

),

197  tolower

((

unsigned char

) (*a)->slave->sequenceString[

i

->seqLocFrom +

l

]));

247  unsigned int

gapLoc, resLoc;

282  typedef

vector < int > SqueezeLocs;

283

SqueezeLocs squeezeLocs(

GetNRows

());

286  int

alnLoc, lastAlignedLoc;

290  ERR_POST_X

(5,

Info

<<

"checking for squeeze up to "

<< (lastAlignedLoc+1));

292  for

(alnLoc=0; alnLoc<=lastAlignedLoc+1; ++alnLoc) {

298  if

(!

textRows

[

row

]->IsSqueezable(alnLoc, &nGaps, &(squeezeLocs[

row

]), minNGaps))

300  if

(nGaps < (

int

) minNGaps) minNGaps = nGaps;

305  ERR_POST_X

(6,

Info

<<

"squeezing "

<< minNGaps <<

" gaps at loc "

<< alnLoc);

308

lastAlignedLoc -= minNGaps;

323  int

firstAligned, prevAligned, nextAligned, firstUnaligned, lastUnaligned;

324  int

nGaps, nShift, shiftRes, shiftGap,

i

;

336  for

(

i

=0;

i

<firstAligned-nGaps; ++

i

) {

338  textRows

[

row

]->SetCharAt(firstAligned-1-nGaps-

i

,

'-'

);

342

prevAligned = firstAligned;

343  while

(prevAligned < ((

int

)

GetWidth

())-2) {

351

firstUnaligned = prevAligned + 1;

354  for

(lastUnaligned = firstUnaligned;

360  for

(nextAligned = lastUnaligned + 1;

364  if

(nextAligned ==

GetWidth

())

break

;

367

nGaps = nextAligned - lastUnaligned - 1;

368

nShift = (lastUnaligned - firstUnaligned + 1) / 2;

369  if

(nGaps > 0 && nShift > 0) {

370

shiftRes = lastUnaligned;

371

shiftGap = nextAligned - 1;

372  for

(

i

=0;

i

<nShift; ++

i

) {

377

prevAligned = nextAligned;

393  if

(alnLoc < 0 || alnLoc >= (

int

)

GetWidth

() || row < 0 || row >= (

int

)

GetNRows

()) {

394  ERR_POST_X

(7,

Error

<<

"AlignmentDisplay::GetCharAt() - coordinate out of range"

);

480  for

(

unsigned int i

=0;

i

<s.size(); ++

i

) {

491  int

firstCol,

int

lastCol,

int

nColumns,

double

conservationThreshhold,

492  const char

*titleHTML,

int

nFeatures,

const AlignmentFeature

*alnFeatures)

const 496  if

(firstCol < 0 || lastCol >= (

int

)

GetWidth

() || firstCol > lastCol || nColumns < 1) {

497  ERR_POST_X

(8,

Error

<<

"AlignmentDisplay::DumpText() - nonsensical display region parameters"

);

503  if

(!alnFeatures) nFeatures = 0;

504  if

(nFeatures > 0) nDisplayRows += nFeatures;

507

vector < vector < bool > > annotLocsByIndex;

509  int

featIndex, masterIndex;

511

annotLocsByIndex.resize(nFeatures);

512  for

(featIndex=0; featIndex<nFeatures; ++featIndex) {

514  for

(

i

=0; (

int

)

i

<alnFeatures[featIndex].nLocations; ++

i

) {

515

masterIndex = alnFeatures[featIndex].

locations

[

i

];

517

annotLocsByIndex[featIndex][masterIndex] =

true

;

523

deque < CRef < CondensedColumn > > condensedColumns;

524  int

alnLoc, alnRow,

row

;

526  for

(alnLoc=firstCol; alnLoc<=lastCol; ++alnLoc) {

527  for

(alnRow=0; alnRow<(

int

)

GetNRows

(); ++alnRow)

529  bool

alignedColumn = (alnRow ==

GetNRows

());

531

condensedColumns.resize(condensedColumns.size() + 1);

532

condensedColumns.back().Reset(

535  if

(condensedColumns.size() == 0 ||

537

condensedColumns.resize(condensedColumns.size() + 1);

538

condensedColumns.back().Reset(

542  for

(

row

=0;

row

<nDisplayRows; ++

row

) {

548

alnRow =

row

- nFeatures;

550

isAlnRow = (alnRow >= 0 && alnRow < (

int

)

GetNRows

());

553

}

else if

(alignedColumn) {

556  if

(masterIndex >= 0 && annotLocsByIndex[featIndex][masterIndex])

557

condensedColumns.back()->AddRowChar(

row

, alnFeatures[featIndex].featChar);

559

condensedColumns.back()->AddRowChar(

row

,

' '

);

565

vector < string > titles(nDisplayRows), uids(doHTML ?

GetNRows

() : 0);

566  int

maxTitleLength = 0, maxSeqLocStrLength = 0,

decimalLength;

567  for

(

row

=0;

row

<nDisplayRows; ++

row

) {

573

alnRow =

row

- nFeatures;

575

isAlnRow = (alnRow >= 0 && alnRow < (

int

)

GetNRows

());

578

titles[

row

] = isAlnRow ?

580  string

(alnFeatures[featIndex].shortName);

581  if

(titles[

row

].

size

() > (

unsigned int

) maxTitleLength) maxTitleLength = titles[

row

].size();

583

decimalLength = ((

int

)

log10

((

double

)

585  if

(decimalLength > maxSeqLocStrLength) maxSeqLocStrLength = decimalLength;

589  if

(doHTML && isAlnRow) {

599

vector < int > lastShownSeqLocs(

GetNRows

());

600  for

(alnRow=0; alnRow<(

int

)

GetNRows

(); ++alnRow) {

601

lastShownSeqLocs[alnRow] = -1;

602  for

(alnLoc=0; alnLoc<firstCol; ++alnLoc)

607  if

(doHTML && doHTMLHeader)

608

os <<

"<HTML><TITLE>"

<< (titleHTML ? titleHTML :

"CDDAlignView HTML Display"

) <<

609  "</TITLE><BODY BGCOLOR="

<<

bgColor

<<

">\n"

;;

612  if

(doHTML) os <<

"<TABLE>\n"

;

613  int

paragraphStart, nParags = 0, nCondensedColumns;

615  for

(paragraphStart=0;

616

paragraphStart<(

int

)condensedColumns.size();

617

paragraphStart+=nCondensedColumns, ++nParags) {

620  int

displayWidth = condensedColumns[paragraphStart]->GetDisplayWidth();

621

nCondensedColumns = 1;

622  while

(paragraphStart+nCondensedColumns < (

int

)condensedColumns.size()) {

623  int

columnWidth = condensedColumns[paragraphStart+nCondensedColumns]->GetDisplayWidth();

624  if

(displayWidth + columnWidth <= nColumns) {

625

displayWidth += columnWidth;

638  if

(paragraphStart > 0) os <<

'\n'

;

641  for

(

row

=0;

row

<nDisplayRows; ++

row

) {

647

alnRow =

row

- nFeatures;

649

isAlnRow = (alnRow >= 0 && alnRow < (

int

)

GetNRows

());

652  if

(isAlnRow && doHTML && uids[alnRow].

size

() > 0) {

653

os <<

"<a href=\"https://www.ncbi.nlm.nih.gov/entrez/query.fcgi" 654

<<

"?cmd=Search&doptcmdl=GenPept&db=Protein&term=" 655

<< uids[alnRow] <<

"\" onMouseOut=\"window.status=''\"\n" 656

<<

"onMouseOver=\"window.status='" 659

<<

"';return true\">" 660

<< setw(0) << titles[

row

] <<

"</a>"

;

662  if

(doHTML && !isAlnRow) os <<

"<font color="

<< featColor << '>

'; 663  os << setw(0) << titles[row]; 665  os << setw(maxTitleLength+1-titles[row].size()) << ' '; 668  // count displayed residues 669  int nDisplayedResidues = 0; 670  for (i=0; i<(unsigned int)nCondensedColumns; ++i) 671  nDisplayedResidues += condensedColumns[paragraphStart+i]->GetNResidues(row); 673  // left start pos (output 1-numbered for humans...) 674  if (doHTML) os << "<font color=" << numColor << '

>

'; 675  if (nDisplayedResidues > 0) 676  os << RIGHT_JUSTIFY << setw(maxSeqLocStrLength) << (lastShownSeqLocs[alnRow]+2) << ' '; 678  os << RIGHT_JUSTIFY << setw(maxSeqLocStrLength) << ' ' << ' '; 680  // dump sequence, applying color changes only when necessary 683  for (i=0; i<(unsigned int)nCondensedColumns; ++i) { 684  string color = condensedColumns[paragraphStart+i]->GetColor(); 685  if (color != prevColor) { 686  os << "</font><font color=" << color << '

>

'; 689  condensedColumns[paragraphStart+i]->DumpRow(os, row); 693  for (i=0; i<(unsigned int)nCondensedColumns; ++i) { 694  condensedColumns[paragraphStart+i]->DumpRow(os, row); 699  if (nDisplayedResidues > 0) { 701  if (doHTML) os << "<font color=" << numColor << '

>

'; 702  os << LEFT_JUSTIFY << setw(0) << (lastShownSeqLocs[alnRow]+nDisplayedResidues+1); 703  if (doHTML) os << "</font>"; 707  // setup to begin next parag 708  lastShownSeqLocs[alnRow] += nDisplayedResidues; 711  // print alignment annotation characters 714  os << RIGHT_JUSTIFY << setw(maxSeqLocStrLength) << ' ' << ' '; 717  for (i=0; i<(unsigned int)nCondensedColumns; ++i) 718  condensedColumns[paragraphStart+i]->DumpRow(os, row); 720  os << (doHTML ? "</font>\n" : "\n"); 725  if (doHTML) os << "</pre></td></tr>\n"; 728  if (doHTML) os << "</TABLE>\n"; 730  // add feature legend 732  os << (doHTML ? "<BR>\n" : "\n"); 733  for (featIndex=0; featIndex<nFeatures; ++featIndex) 734  if (alnFeatures[featIndex].description) 735  os << alnFeatures[featIndex].shortName << ": " << alnFeatures[featIndex].description 736  << (doHTML ? "<BR>\n" : "\n"); 739  if (doHTML && doHTMLHeader) os << "</BODY></HTML>\n"; 741  // additional sanity check on seqloc markers 742  if (firstCol == 0 && lastCol == GetWidth()-1) { 743  for (alnRow=0; alnRow<(int)GetNRows(); ++alnRow) { 744  if (lastShownSeqLocs[alnRow] != 745  indexAlnLocToSeqLocRows[alnRow]->sequence->sequenceString.size()-1) { 746  ERR_POST_X(10, Error << "full display - seqloc markers don't

add up

"); 750  if (alnRow == GetNRows()) 751  ERR_POST_X(11, Info << "

full display - seqloc markers add up correctly

"); 757 int AlignmentDisplay::DumpText(CNcbiOstream& os, unsigned int options, 758  int firstCol, int lastCol, int nColumns, double conservationThreshhold, 759  const char *titleHTML, int nFeatures, const AlignmentFeature *alnFeatures) const 761  bool doHTML = ((options & CAV_HTML) > 0), doHTMLHeader = ((options & CAV_HTML_HEADER) > 0); 763  if (firstCol < 0 || lastCol >= (int)GetWidth() || firstCol > lastCol || nColumns < 1) { 765  return CAV_ERROR_BAD_PARAMS; 768  // how many rows in the display, including annotations? 769  int nDisplayRows = GetNRows(); 770  if (!alnFeatures) nFeatures = 0; 771  if (nFeatures > 0) nDisplayRows += nFeatures; 773  // set up the titles and uids, figure out how much space any seqLoc string will take 774  vector < string > titles(nDisplayRows), uids(doHTML ? GetNRows() : 0); 775  int row, featIndex, alnRow, maxTitleLength = 0, maxSeqLocStrLength = 0, leftMargin, decimalLength; 777  for (row=0; row<nDisplayRows; ++row) { 778  if (options & CAV_ANNOT_BOTTOM) { 780  featIndex = row - GetNRows(); 783  alnRow = row - nFeatures; 785  isAlnRow = (alnRow >= 0 && alnRow < (int)GetNRows()); 788  titles[row] = isAlnRow ? 789  indexAlnLocToSeqLocRows[alnRow]->sequence->GetTitle() : 790  string(alnFeatures[featIndex].shortName); 791  if (titles[row].size() > (unsigned int)maxTitleLength) maxTitleLength = titles[row].size(); 793  decimalLength = ((int) log10((double) 794  indexAlnLocToSeqLocRows[alnRow]->sequence->sequenceString.size())) + 1; 795  if (decimalLength > maxSeqLocStrLength) maxSeqLocStrLength = decimalLength; 798  // uid for link to entrez 799  if (doHTML && isAlnRow) { 800  if (indexAlnLocToSeqLocRows[alnRow]->sequence->GetLabel() != "query" && 801  indexAlnLocToSeqLocRows[alnRow]->sequence->GetLabel() != "

consensus

") 802  uids[alnRow] = indexAlnLocToSeqLocRows[alnRow]->sequence->GetLabel(); 805  leftMargin = maxTitleLength + maxSeqLocStrLength + 2; 807  // need to keep track of first, last seqLocs for each row in each paragraph; 808  // find seqLoc of first residue >= firstCol 809  vector < int > lastShownSeqLocs(GetNRows()); 811  for (alnRow=0; alnRow<(int)GetNRows(); ++alnRow) { 812  lastShownSeqLocs[alnRow] = -1; 813  for (alnLoc=0; alnLoc<firstCol; ++alnLoc) 814  if (!IsGap(textRows[alnRow]->GetCharAt(alnLoc))) lastShownSeqLocs[alnRow]++; 818  if (doHTML && doHTMLHeader) 819  os << "

<HTML><TITLE>

" << (titleHTML ? titleHTML : "

CDDAlignView HTML Display

") << 820  "

</TITLE><BODY BGCOLOR=

" << bgColor << "

>

\n";; 822  // do make look-up location index for each feature 823  vector < vector < bool > > annotLocsByIndex; 826  annotLocsByIndex.resize(nFeatures); 827  for (featIndex=0; featIndex<nFeatures; ++featIndex) { 828  annotLocsByIndex[featIndex].resize(indexAlnLocToSeqLocRows[0]->sequence->Length(), false); 829  for (i=0; i<alnFeatures[featIndex].nLocations; ++i) { 830  masterIndex = alnFeatures[featIndex].locations[i]; 831  if (masterIndex >= 0 && masterIndex < (int)indexAlnLocToSeqLocRows[0]->sequence->Length()) 832  annotLocsByIndex[featIndex][masterIndex] = true; 837  // split alignment up into "

paragraphs

", each with nColumns 838  if (doHTML) os << "

<

TABLE

>

\n"; 839  int paragraphStart, nParags = 0; 840  for (paragraphStart=0; (firstCol+paragraphStart)<=lastCol; paragraphStart+=nColumns, ++nParags) { 845  if (!(options & CAV_NO_PARAG_COLOR)) 846  os << "

bgcolor=

" << blockBGColors[nParags % nBlockColors]; 849  if (paragraphStart > 0) os << '\n'; 852  int nMarkers = 0, width; 853  if (doHTML) os << "

<font

color

=

" << rulerColor << '>'; 854  for (i=0; i<nColumns && (firstCol+paragraphStart+i)<=lastCol; ++i) { 855  if ((paragraphStart+i+1)%10 == 0) { 857  width = leftMargin + i + 1; 860  os << RIGHT_JUSTIFY << setw(width) << (paragraphStart+i+1); 864  if (doHTML) os << "

</font>

"; 866  if (doHTML) os << "

<font

color

=

" << rulerColor << '>'; 867  for (i=0; i<leftMargin; ++i) os << ' '; 868  for (i=0; i<nColumns && (firstCol+paragraphStart+i)<=lastCol; ++i) { 869  if ((paragraphStart+i+1)%10 == 0) 871  else if ((paragraphStart+i+1)%5 == 0) 876  if (doHTML) os << "

</font>

"; 880  vector < string > columnColors; 882  for (i=0; i<nColumns && (firstCol+paragraphStart+i)<=lastCol; ++i) 883  columnColors.resize(columnColors.size()+1, 884  GetColumnColor(firstCol+paragraphStart+i, conservationThreshhold)); 886  // output each alignment row 887  int nDisplayedResidues; 888  for (row=0; row<nDisplayRows; ++row) { 889  if (options & CAV_ANNOT_BOTTOM) { 891  featIndex = row - GetNRows(); 894  alnRow = row - nFeatures; 896  isAlnRow = (alnRow >= 0 && alnRow < (int)GetNRows()); 898  // actual sequence characters; count how many non-gaps in each row 899  nDisplayedResidues = 0; 902  for (i=0; i<nColumns && (firstCol+paragraphStart+i)<=lastCol; ++i) { 903  char ch = textRows[alnRow]->GetCharAt(firstCol+paragraphStart+i); 905  if (!IsGap(ch)) ++nDisplayedResidues; 910  if (isAlnRow && doHTML && uids[alnRow].size() > 0) { 911  os << "

<

a

href=\

"https://www.ncbi.nlm.nih.gov/entrez/query.fcgi" 912

<<

"?cmd=Search&doptcmdl=GenPept&db=Protein&term=" 913

<< uids[alnRow] <<

"\" onMouseOut=\"window.status=''\"\n" 914

<<

"onMouseOver=\"window.status='" 917

<<

"';return true\">" 918

<< setw(0) << titles[

row

] <<

"</a>"

;

920  if

(doHTML && !isAlnRow) os <<

"<font color="

<< featColor << '>

'; 921  os << setw(0) << titles[row]; 923  os << setw(maxTitleLength+1-titles[row].size()) << ' '; 926  // left start pos (output 1-numbered for humans...) 927  if (doHTML) os << "<font color=" << numColor << '

>

'; 928  if (nDisplayedResidues > 0) 929  os << RIGHT_JUSTIFY << setw(maxSeqLocStrLength) << (lastShownSeqLocs[alnRow]+2) << ' '; 931  os << RIGHT_JUSTIFY << setw(maxSeqLocStrLength) << ' ' << ' '; 933  // dump sequence, applying color changes only when necessary 936  for (i=0; i<(int)rowChars.size(); ++i) { 937  if (columnColors[i] != prevColor) { 938  os << "</font><font color=" << columnColors[i] << '

>

'; 939  prevColor = columnColors[i]; 948  if (nDisplayedResidues > 0) { 950  if (doHTML) os << "<font color=" << numColor << '

>

'; 951  os << LEFT_JUSTIFY << setw(0) << (lastShownSeqLocs[alnRow]+nDisplayedResidues+1); 952  if (doHTML) os << "</font>"; 956  // setup to begin next parag 957  lastShownSeqLocs[alnRow] += nDisplayedResidues; 960  // print alignment annotation characters 963  os << RIGHT_JUSTIFY << setw(maxSeqLocStrLength) << ' ' << ' '; 965  // do characters, but only allow annot where master residue is aligned to something 966  for (i=0; i<nColumns && (firstCol+paragraphStart+i)<=lastCol; ++i) { 967  if (IsAligned(textRows[0]->GetCharAt(firstCol+paragraphStart+i))) { 968  masterIndex = indexAlnLocToSeqLocRows[0]->GetSeqLocAt(firstCol+paragraphStart+i); 969  os << ((masterIndex >= 0 && annotLocsByIndex[featIndex][masterIndex]) 970  ? alnFeatures[featIndex].featChar : ' '); 975  os << (doHTML ? "</font>\n" : "\n"); 980  if (doHTML) os << "</pre></td></tr>\n"; 983  if (doHTML) os << "</TABLE>\n"; 985  // add feature legend 987  os << (doHTML ? "<BR>\n" : "\n"); 988  for (featIndex=0; featIndex<nFeatures; ++featIndex) 989  if (alnFeatures[featIndex].description) 990  os << alnFeatures[featIndex].shortName << ": " << alnFeatures[featIndex].description 991  << (doHTML ? "<BR>\n" : "\n"); 994  if (doHTML && doHTMLHeader) os << "</BODY></HTML>\n"; 996  // additional sanity check on seqloc markers 997  if (firstCol == 0 && lastCol == GetWidth()-1) { 998  for (alnRow=0; alnRow<(int)GetNRows(); ++alnRow) { 999  if (lastShownSeqLocs[alnRow] != 1000  indexAlnLocToSeqLocRows[alnRow]->sequence->sequenceString.size()-1) { 1001  ERR_POST_X(13, Error << "full display - seqloc markers don't

add up

"); 1005  if (alnRow == GetNRows()) 1006  ERR_POST_X(14, Info << "

full display - seqloc markers add up correctly

"); 1012 int AlignmentDisplay::DumpFASTA(int firstCol, int lastCol, int nColumns, 1013  bool doLowercase, CNcbiOstream& os) const 1015  if (firstCol < 0 || lastCol >= (int)GetWidth() || firstCol > lastCol || nColumns < 1) { 1017  return CAV_ERROR_BAD_PARAMS; 1020  // output each alignment row 1021  for (unsigned int row=0; row<GetNRows(); ++row) { 1023  // create title line 1024  os << '>' << objects::CSeq_id::GetStringDescr(indexAlnLocToSeqLocRows[row]->sequence->bioseqASN.GetObject(), objects::CSeq_id::eFormat_FastA) << '\n'; 1026  // split alignment up into "

paragraphs

", each with nColumns 1027  int paragraphStart, nParags = 0, i; 1028  for (paragraphStart=0; (firstCol+paragraphStart)<=lastCol; paragraphStart+=nColumns, ++nParags) { 1029  for (i=0; i<nColumns && (firstCol+paragraphStart+i)<=lastCol; ++i) { 1030  char ch = textRows[row]->GetCharAt(firstCol+paragraphStart+i); 1031  if (!doLowercase) ch = toupper((unsigned char) ch); 1041 const string AlignmentDisplay::GetColumnColor(int alnLoc, double conservationThreshhold) const 1043  // standard probabilities (calculated by BLAST using BLOSUM62 - see conservation_colorer.cpp in Cn3D++) 1044  typedef map < char , double > Char2Double; 1045  static CSafeStatic<Char2Double> s_StandardProbabilities; 1046  Char2Double& StandardProbabilities = *s_StandardProbabilities; 1047  if (StandardProbabilities.size() == 0) { 1048  StandardProbabilities['A'] = 0.07805; 1049  StandardProbabilities['C'] = 0.01925; 1050  StandardProbabilities['D'] = 0.05364; 1051  StandardProbabilities['E'] = 0.06295; 1052  StandardProbabilities['F'] = 0.03856; 1053  StandardProbabilities['G'] = 0.07377; 1054  StandardProbabilities['H'] = 0.02199; 1055  StandardProbabilities['I'] = 0.05142; 1056  StandardProbabilities['K'] = 0.05744; 1057  StandardProbabilities['L'] = 0.09019; 1058  StandardProbabilities['M'] = 0.02243; 1059  StandardProbabilities['N'] = 0.04487; 1060  StandardProbabilities['P'] = 0.05203; 1061  StandardProbabilities['Q'] = 0.04264; 1062  StandardProbabilities['R'] = 0.05129; 1063  StandardProbabilities['S'] = 0.07120; 1064  StandardProbabilities['T'] = 0.05841; 1065  StandardProbabilities['V'] = 0.06441; 1066  StandardProbabilities['W'] = 0.01330; 1067  StandardProbabilities['X'] = 0; 1068  StandardProbabilities['Y'] = 0.03216; 1071  // if this column isn't completely aligned, use plain color 1073  for (row=0; row<GetNRows(); ++row) 1074  if (!IsAligned(textRows[row]->GetCharAt(alnLoc))) return plainColor; 1076  // create profile (residue frequencies) for this column 1077  Char2Double profile; 1078  Char2Double::iterator p, pe; 1079  for (row=0; row<GetNRows(); ++row) { 1080  char ch = toupper((unsigned char) textRows[row]->GetCharAt(alnLoc)); 1082  case 'A': case 'R': case 'N': case 'D': case 'C': 1083  case 'Q': case 'E': case 'G': case 'H': case 'I': 1084  case 'L': case 'K': case 'M': case 'F': case 'P': 1085  case 'S': case 'T': case 'W': case 'Y': case 'V': 1088  ch = 'X'; // make all but natural aa's just 'X' 1090  if ((p=profile.find(ch)) != profile.end()) 1091  p->second += 1.0/GetNRows(); 1093  profile[ch] = 1.0/GetNRows(); 1096  // check for identity... 1097  if (conservationThreshhold == SHOW_IDENTITY) { 1098  if (profile.size() == 1 && profile.begin()->first != 'X') 1099  return conservedColor; 1104  // ... or calculate information content for this column (calculated in bits -> logs of base 2) 1105  double information = 0.0; 1107  for (p=profile.begin(); p!=pe; ++p) { 1108  static const double ln2 = log(2.0), threshhold = 0.0001; 1109  double expFreq = StandardProbabilities[p->first]; 1110  if (expFreq > threshhold) { 1111  double freqRatio = p->second / expFreq; 1112  if (freqRatio > threshhold) 1113  information += p->second * log(freqRatio) / ln2; 1117  // if conserved, use conservation color 1118  if (information > conservationThreshhold) return conservedColor; 1120  // if is unconserved, use block color to show post-IBM block locations 1127

void TextRow::InsertGaps(int nGaps, int beforePos)

1129

if (beforePos < 0 || beforePos > (int)Length()) {

1134  chars.insert(beforePos, nGaps, '-'); 1137 void TextRow::DeleteGaps(int nGaps, int startPos) 1139  if (startPos < 0 || startPos+nGaps-1 > (int)Length()) { 1144  // check to make sure they're all gaps 1145  for (int i=0; i<nGaps; ++i) { 1146  if (!IsGap(chars[startPos + i])) { 1152  chars.erase(startPos, nGaps); 1155 // find out how many gaps (up to maxGaps) are present from alnLoc to the next aligned 1156 // residue to the right; set startPos to the first gap, nGaps to # gaps starting at startPos 1157 bool TextRow::IsSqueezable(int alnLoc, int *nGaps, int *startPos, int maxGaps) const 1159  if (alnLoc < 0 || alnLoc >= (int)chars.size()) { 1164  // skip unaligned residues 1165  while (alnLoc < (int)chars.size() && IsUnaligned(chars[alnLoc])) ++alnLoc; 1166  if (alnLoc == chars.size() || IsAligned(chars[alnLoc])) return false; 1170  for (*nGaps=1, ++alnLoc; alnLoc < (int)chars.size() && IsGap(chars[alnLoc]); (*nGaps)++, ++alnLoc) 1171  if (*nGaps == maxGaps) break; 1176 IndexAlnLocToSeqLocRow::IndexAlnLocToSeqLocRow(const Sequence *seq, int length) : 1179  if (length > 0) seqLocs.resize(length, -1); 1182 void IndexAlnLocToSeqLocRow::InsertGaps(int nGaps, int beforePos) 1184  if (nGaps <= 0 || seqLocs.size() == 0) return; 1186  if (beforePos < 0 || beforePos > (int)Length()) { 1191  IntVec::iterator s = seqLocs.begin(); 1192  for (int i=0; i<beforePos; ++i) ++s; 1193  seqLocs.insert(s, nGaps, -1); 1196 void IndexAlnLocToSeqLocRow::ReIndex(const TextRow& textRow) 1198  seqLocs.resize(textRow.Length()); 1200  for (int i=0; i<(int)textRow.Length(); ++i) { 1201  if (IsGap(textRow.GetCharAt(i))) 1204  seqLocs[i] = seqLoc++; 1206  if (seqLoc != sequence->sequenceString.size())

static const char * plainColor

static const char * numColor

static const char * featColor

static const char * conservedColor

static const char * bgColor

list< UnalignedInterval > IntervalList

static const int nBlockColors

static string ShortAndEscapedString(const string &s)

static string StrToLower(const string &str)

static const char * blockBGColors[nBlockColors]

static const char * rulerColor

static const char * blockColor

bool IsUnaligned(char ch)

C interface header for cddalignview as function call.

#define CAV_NO_PARAG_COLOR

#define CAV_ERROR_DISPLAY

#define CAV_ERROR_BAD_PARAMS

int DumpCondensed(CNcbiOstream &os, unsigned int options, int firstCol, int lastCol, int nColumns, double conservationThreshhold=2.0, const char *titleHTML=NULL, int nFeatures=0, const AlignmentFeature *alnFeatures=NULL) const

IndexAlnLocToSeqLocRows indexAlnLocToSeqLocRows

void SplitUnaligned(void)

unsigned int GetWidth(void) const

void ShiftUnalignedLeft(void)

const string GetColumnColor(int alnLoc, double conservationThreshhold) const

int DumpText(CNcbiOstream &os, unsigned int options, int firstCol, int lastCol, int nColumns, double conservationThreshhold=2.0, const char *titleHTML=NULL, int nFeatures=0, const AlignmentFeature *alnFeatures=NULL) const

unsigned int GetNRows(void) const

AlignmentDisplay(const SequenceSet *sequenceSet, const AlignmentSet *alignmentSet)

static const double SHOW_IDENTITY

int DumpFASTA(int firstCol, int lastCol, int nColumns, bool doLowercase, CNcbiOstream &outStream) const

char GetCharAt(int alnLoc, int row) const

void InsertGaps(int nGaps, int beforePos)

void DumpRow(CNcbiOstream &os, int row) const

void AddRowChar(int row, char ch)

int GetDisplayWidth(void) const

CondensedColumnAligned(int nRows, string color)

int GetNResidues(int row) const

static const char * postfix

static const char * prefix

void AddRowChar(int row, char ch)

void DumpRow(CNcbiOstream &os, int row) const

int GetDisplayWidth(void) const

int GetNResidues(int row) const

CondensedColumnUnaligned(int nRows, string color)

virtual int GetDisplayWidth(void) const =0

virtual ~CondensedColumn(void)

virtual void DumpRow(CNcbiOstream &os, int row) const =0

CondensedColumn(int nRows, string columnColor)

virtual int GetNResidues(int row) const =0

string GetColor(void) const

virtual void AddRowChar(int row, char ch)=0

void ReIndex(const TextRow &textRow)

void InsertGaps(int nGaps, int beforePos)

void DeleteGaps(int nGaps, int startPos)

bool IsSqueezable(int alnLoc, int *nGaps, int *startPos, int maxGaps) const

void InsertGaps(int nGaps, int beforePos)

std::ofstream out("events_result.xml")

main entry point for tests

static const char * str(char *buf, int n)

#define ERR_POST_X(err_subcode, message)

Error posting with default error code and given error subcode.

void Error(CExceptionArgs_Base &args)

void Info(CExceptionArgs_Base &args)

#define BEGIN_NCBI_SCOPE

Define ncbi namespace.

IO_PREFIX::ostream CNcbiOstream

Portable alias for ostream.

unsigned int

A callback function used to compare two keys in a database.

<!DOCTYPE HTML >< html > n< header > n< title > PubSeq Gateway Help Page</title > n< style > n td

const struct ncbi::grid::netcache::search::fields::SIZE size

Static variables safety - create on demand, destroy on application termination.

Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.

The NCBI C++/STL use hints.

static SLJIT_INLINE sljit_ins l(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)

#define row(bind, expected)


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