* begin = src + (pos / 4);
65 const char* end = src + ((pos + length - 1) / 4) + 1;
66 const char* iter = end;
68 size_t offset= (pos + length - 1) % 4;
72 for( ; iter != begin; ++dst ) {
86 if( length % 4 != 0 ) {
87*dst =
table[
static_cast<Uint1>(*iter) * 2 + 1];
88 if( iter != begin ) {
90*dst |= (char)
table[
static_cast<Uint1>(*iter) * 2];
96*dst &= char(0xFF << ((4 - (length % 4)) % 4) * 2);
108 size_tstart_offset = (pos + length - 1) % 2;
112 const char* begin = src + (pos / 2);
113 const char* end = src + ((pos + length - 1) / 2) + 1;
114 const char* iter = end;
116 switch( start_offset ) {
120 for( ; iter != begin; ++dst ) {
124 if( length % 2 != 0 ) {
134*dst = char((
static_cast<Uint1>(*iter) & 0xF0) |
135(
static_cast<Uint1>(*(iter - 1)) & 0x0F));
138 if( length % 2 != 0 ) {
140*dst = char(
static_cast<Uint1>(*iter) & 0xF0);
150 template<
typenameSrcCont,
typenameDstCont>
152(
constSrcCont& src,
159 if( src.empty() || (length == 0) ) {
167pos, length, &*dst.begin());
172(
const string& src,
179 return s_Reverse(src, src_coding, pos, length, dst);
184(
constvector<char>& src,
191 return s_Reverse(src, coding,pos, length, dst);
202 _ASSERT((dst != 0) && (src != 0));
204 switch( src_coding ) {
215reverse_copy(src + pos, src + pos + length, dst);
227 template<
typenameSrcCont,
typenameDstCont>
229(
constSrcCont& src,
236 if( src.empty() || (length == 0) ) {
244pos, length, &*dst.begin());
249(
const string& src,
261(
constvector<char>& src,
278 const char* iter = src + (pos / 4);
279 const char* end = src + ((pos + length - 1) / 4) + 1;
281 if( pos % 4 == 0 ) {
282 for( ; iter != end; ++iter, ++dst ) {
283*dst = char(~(*iter));
286 if( length % 4 != 0 ) {
287*(--dst) &=
char(0xFF << (8 - (length % 4) * 2));
295 table[
static_cast<Uint1>(*(iter + 1)) * 2 + 1] );
299 if( length % 4 != 0 ) {
300*dst = (char)
table[
static_cast<Uint1>(*iter) * 2];
301 if( ++iter != end ) {
302*dst |= (char)
table[
static_cast<Uint1>(*iter) * 2 + 1];
307*dst &= char(0xFF << ((4 - (length % 4)) % 4) * 2);
319 const char* end = src + pos + length;
320 const char* iter = src + pos;
322 for( ; iter != end; ++iter, ++dst ) {
323*dst = char(3 -
static_cast<Uint1>(*iter));
336 const char* iter = src + (pos / 2);
337 const char* end = src + (pos + length - 1) / 2 + 1;
344 for( ; iter != end; ++iter, ++dst ) {
345*dst = (char)
table[
static_cast<Uint1>(*iter)];
348 if( length % 2 != 0 ) {
359 table[
static_cast<Uint1>(*(iter + 1)) * 2 + 1] );
362 if( length % 2 != 0 ) {
363*dst = (char)
table[
static_cast<Uint1>(*iter) * 2];
380 _ASSERT((dst != 0) && (src != 0));
382 switch( src_coding ) {
404 "There is no complement for the specified coding.");
411 template<
typenameSrcCont,
typenameDstCont>
413(
constSrcCont& src,
420 if( src.empty() || (length == 0) ) {
428pos, length, &*dst.begin());
433(
const string& src,
445(
constvector<char>& src,
462 size_t offset= (pos + length - 1) % 4;
465 const char* begin = src + (pos / 4);
466 const char* iter = src + (pos + length - 1) / 4 + 1;
475 table[
static_cast<Uint1>(*(iter - 1)) * 2 + 1];
479 if( length % 4 != 0 ) {
480*dst =
table[
static_cast<Uint1>(*iter) * 2];
481 if( iter != begin ) {
483*dst |= (char)
table[
static_cast<Uint1>(*iter) * 2 + 1];
490 for( ; iter != begin; ++dst ) {
497*dst &= char(0xFF << ((4 - (length % 4)) % 4) * 2);
509 const char* begin = src + pos;
510 const char* iter = src + pos + length;
512 for( ; iter != begin; ++dst ) {
513*dst = char(3 -
static_cast<Uint1>(*--iter));
526 const char* begin = src + (pos / 2);
527 const char* iter = src + ((pos + length - 1) / 2) + 1;
529 size_t offset= (pos + length - 1) % 2;
539 table[
static_cast<Uint1>(*(iter - 1)) * 2 + 1];
542 if( length % 2 != 0 ) {
543*dst =
table[
static_cast<Uint1>(*iter) * 2];
550 for( ; iter != begin; ++dst ) {
554 if( length % 2 != 0 ) {
572 _ASSERT((dst != 0) && (src != 0));
574 switch( src_coding ) {
597 "There is no complement for the specified coding.");
603 template<
typenameSrcCont>
611 if( src.empty() || (length == 0) ) {
649 char*
first= src + pos;
654temp = char(3 - *
first);
660 copy(src + pos, src + pos + length, src);
672 char*
buf=
new char[length];
689 char*
buf=
new char[length];
709 switch( src_coding ) {
731 "There is no complement for the specified coding.");
static const Uint1 * GetTable(size_t offset)
static const Uint1 * GetTable(size_t offset)
static const Uint1 * GetTable(size_t offset)
static const Uint1 * GetTable(size_t offset)
static const Uint1 * GetTable(size_t offset)
static const Uint1 * GetTable(void)
static const Uint1 * GetTable(void)
static const Uint1 * GetTable(void)
static SIZE_TYPE Convert(const CTempString &src, TCoding src_coding, TSeqPos pos, TSeqPos length, string &dst, TCoding dst_coding)
static SIZE_TYPE Reverse(const string &src, TCoding src_coding, TSeqPos pos, TSeqPos length, string &dst)
static SIZE_TYPE ReverseComplement(const string &src, TCoding src_coding, TSeqPos pos, TSeqPos length, string &dst)
static SIZE_TYPE Complement(const string &src, TCoding src_coding, TSeqPos pos, TSeqPos length, string &dst)
Include a standard set of the NCBI C++ Toolkit most basic headers.
The NCBI C++ standard methods for dealing with std::string.
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
static DLIST_TYPE *DLIST_NAME() last(DLIST_LIST_TYPE *list)
unsigned int TSeqPos
Type for sequence locations and lengths.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
uint8_t Uint1
1-byte (8-bit) unsigned integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
NCBI_NS_STD::string::size_type SIZE_TYPE
<!DOCTYPE HTML >< html > n< header > n< title > PubSeq Gateway Help Page</title > n< style > n table
void copy(Njn::Matrix< S > *matrix_, const Njn::Matrix< T > &matrix0_)
static SIZE_TYPE s_Ncbi2naRevCmp(const char *src, TSeqPos pos, TSeqPos length, char *dst)
static SIZE_TYPE s_Ncbi2naExpandRevCmp(const char *src, TSeqPos pos, TSeqPos length, char *dst)
static SIZE_TYPE s_4naReverse(const char *src, TSeqPos pos, TSeqPos length, char *dst)
static SIZE_TYPE s_Ncbi4naRevCmp(const char *src, TSeqPos pos, TSeqPos length, char *dst)
SIZE_TYPE s_ReverseComplement(const SrcCont &src, CSeqUtil::TCoding src_coding, TSeqPos pos, TSeqPos length, DstCont &dst)
static SIZE_TYPE s_Ncbi2naComplement(const char *src, TSeqPos pos, TSeqPos length, char *dst)
static SIZE_TYPE s_2naReverse(const char *src, TSeqPos pos, TSeqPos length, char *dst)
SIZE_TYPE s_Complement(const SrcCont &src, CSeqUtil::TCoding src_coding, TSeqPos pos, TSeqPos length, DstCont &dst)
static SIZE_TYPE s_Ncbi2naExpandComplement(const char *src, TSeqPos pos, TSeqPos length, char *dst)
SIZE_TYPE s_Reverse(const SrcCont &src, CSeqUtil::TCoding src_coding, TSeqPos pos, TSeqPos length, DstCont &dst)
static SIZE_TYPE s_Ncbi4naComplement(const char *src, TSeqPos pos, TSeqPos length, char *dst)
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