当前位置: 首页>>代码示例>>C++>>正文


C++ AutoArray::resize方法代码示例

本文整理汇总了C++中libmaus2::autoarray::AutoArray::resize方法的典型用法代码示例。如果您正苦于以下问题:C++ AutoArray::resize方法的具体用法?C++ AutoArray::resize怎么用?C++ AutoArray::resize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在libmaus2::autoarray::AutoArray的用法示例。


在下文中一共展示了AutoArray::resize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: np

			ReturnValue np(iter_a const a, iter_a const ae, iter_b const b, iter_b const be, index_type const maxd = std::numeric_limits<index_type>::max())
			{
				assert ( ae-a >= 0 );
				assert ( be-b >= 0 );

				size_t const an = ae-a;
				size_t const bn = be-b;

				if ( ! an || ! bn )
				{
					return ReturnValue(0,0,0);
				}

				size_t const sn = std::max(an,bn);
				// number of diagonals
				index_type const numdiag = (sn<<1)+1;

				if ( numdiag > static_cast<index_type>(DE.size()) )
				{
					DE.resize(numdiag);
					DO.resize(numdiag);
				}

				NPElement * DP = DE.begin() + sn;
				NPElement * DN = DO.begin() + sn;

				// diagonal containing bottom right of matrix
				int64_t fdiag = std::numeric_limits<int64_t>::max();

				// how far do we get without an error?
				{
					index_type const s = slide<iter_a,iter_b,false>(a,ae,b,be,0);
					DP[0].offset = s;
				}

				if ( DP[0].offset >= static_cast<int64_t>(std::min(an,bn)) )
				{
					assert ( DP[0].offset == static_cast<int64_t>(std::min(an,bn)) );

					uint64_t const n = std::min(an,bn);
					return ReturnValue(n,n,0);
				}

				index_type d = 1;

				assert ( DP[0].offset < static_cast<int64_t>(std::min(an,bn)) );

				{
					index_type const p = DP[0].offset;
					index_type const s = slide<iter_a,iter_b,true>(a,ae,b+1,be,p);
					DN[-1].offset = p + s;
				}
				{
					index_type const p = DP[0].offset+1;
					index_type const s = slide<iter_a,iter_b,false>(a,ae,b,be,p);
					DN[ 0].offset = p + s;
				}
				{
					index_type const p = DP[0].offset;
					index_type const s = slide<iter_a,iter_b,false>(a+1,ae,b,be,p);
					DN[ 1].offset = p + s;
				}
				d += 1;
				std::swap(DP,DN);

				for ( ; d < maxd ; ++d )
				{
					// std::cerr << "d=" << d << std::endl;

					bool done = false;

					for ( int64_t di = -d+1; di <= d-1; ++di )
					{
						int64_t const apos = std::max( di,static_cast<int64_t>(0))+DP[di].offset;
						int64_t const bpos = std::max(-di,static_cast<int64_t>(0))+DP[di].offset;
						assert ( apos >= 0 );
						assert ( bpos >= 0 );

						assert ( static_cast< uint64_t >(apos) <= an );
						assert ( static_cast< uint64_t >(bpos) <= bn );

						// std::cerr << "d=" << d << " di=" << di << " apos=" << apos << " bpos=" << bpos << " an=" << an << " bn=" << bn << std::endl;

						if (
							static_cast< uint64_t >(apos) == an
							||
							static_cast< uint64_t >(bpos) == bn
						)
						{
							fdiag = di;
							done = true;
						}
					}
					if ( done )
					{
						break;
					}

					iter_a aa = a;
					iter_b bb = b + d;
//.........这里部分代码省略.........
开发者ID:gt1,项目名称:libmaus2,代码行数:101,代码来源:NPLNoTrace.hpp

示例2: clipAdapters

bool clipAdapters(
	libmaus2::bambam::BamAlignment & algn,
	libmaus2::autoarray::AutoArray<char> & R,
	libmaus2::autoarray::AutoArray<char> & Q,
	libmaus2::bambam::BamSeqEncodeTable const & seqenc,
	libmaus2::autoarray::AutoArray<libmaus2::bambam::cigar_operation> & cigop,
	libmaus2::bambam::BamAlignment::D_array_type & T
)
{
	// a3,as
	uint64_t const asclip = algn.hasAux("as") ? algn.getAuxAsNumber<int>("as") : 0;
	uint64_t const a3clip = algn.hasAux("a3") ? algn.getAuxAsNumber<int>("a3") : 0;
	uint64_t const aclip = std::max(asclip,a3clip);
	bool     const reverse = algn.isReverse();

	if ( aclip )
	{
		uint64_t const len = algn.decodeRead(R);
		algn.decodeQual(Q);

		if ( (len - aclip) > 1 )
		{
			if ( algn.isMapped() )
			{
				uint32_t const numcigop = algn.getCigarOperations(cigop);

				if ( numcigop == cigop.size() )
					cigop.resize(numcigop+1);

				if ( reverse )
				{
				    std::reverse(cigop.begin(),cigop.begin()+numcigop);
				}


				// can't just add a HC to the cigar
				uint32_t index;
				uint32_t hardclip = 0;
				uint32_t cig_type;
				int32_t  left     = aclip;
				int32_t  repos    = 0;

				for ( index = numcigop - 1; index > 0; index-- )
				{
				    	cig_type = bam_cigar_type(cigop[index].first);

					if ( cig_type == 0 )
					{
				    	    	hardclip += cigop[index].second;
					}
					else
					{
					    	if ( cig_type & 1 )
						{
						    	if ( cigop[index].second < left )
							{
					    	    	    	left -= cigop[index].second;
						    	}
							else
							{
							    	break;
						    	}
					    	}

				    	    	if ( cig_type & 2 )
						{
				    		    	// move pos if reversed
						    	repos += cigop[index].second;
					    	}
					}
				}

				cig_type = bam_cigar_type(cigop[index].first);

				if ( cigop[index].second != left )
				{
				    	cigop[index++].second -= left;
				}

 				cigop[index] = libmaus2::bambam::cigar_operation(libmaus2::bambam::BamFlagBase::LIBMAUS2_BAMBAM_CHARD_CLIP, aclip + hardclip);

			    	if ( numcigop > index + 1 )
				    	cigop.resize(index + 1);

				if ( reverse )
				{
				    std::reverse(cigop.begin(),cigop.begin() + index + 1);

				    // account for the last possible pos move
    	    	    	    	    if ( cig_type & 2 )
				    	    repos += left;

				    if ( repos )
				    {
				    	// clipping has moved the pos point
					algn.putPos(algn.getPos() + repos);
				    }

				}

//.........这里部分代码省略.........
开发者ID:gt1,项目名称:biobambam2,代码行数:101,代码来源:ClipAdapters.cpp

示例3: resize

			void resize(uint64_t const n)
			{
				requests.resize(n);
			}
开发者ID:dkj,项目名称:libmaus2,代码行数:4,代码来源:BwtMergeZBlockRequestVector.hpp


注:本文中的libmaus2::autoarray::AutoArray::resize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。