inline IndexedList::IndexedList(size_t const & nbClust, bool const & doFill) :
		_list(), _element(nbClust, nbClust) {
	_list.reserve(nbClust);
	if (doFill) {
		fill();
	}
}
static IntVector& calc_fasta_multi_digest_fragments ( const string& peptideFormula )
{
	static IntVector cleavageIndex;
	int numAA = peptideFormula.length ();
	cleavageIndex.reserve ( numAA );
	cleavageIndex.clear ();

	if ( numAA ) {
		int penultimateAA = numAA - 1;
		for ( int i = 0 ; i < penultimateAA ; i++ ) {
			for ( int j = 0 ; j < numDigests ; j++ ) {
				char break_test_aa = ( digestSpecificityArray [j] == 'C' ) ? peptideFormula [i] : peptideFormula [i+1];
				if ( aa_composition_mask [break_test_aa] & break_mask_array [j] ) {
					char exclude_test_aa = ( digestSpecificityArray [j] == 'C' ) ? peptideFormula [i+1] : peptideFormula [i];
					if ( (aa_composition_mask [exclude_test_aa] & exclude_mask_array [j]) == 0 ) {
						cleavageIndex.push_back ( i );
						break;
					}
				}
			}
		}
		cleavageIndex.push_back ( penultimateAA );
	}
	return ( cleavageIndex );
}
Example #3
0
void testReserve(IntVector& test)
{
	//cout << "Expand to 7(Exits)" << endl;
	//test.reserve(7);
	//testValues(test);

	cout << "Expand to 8" << endl;
	test.reserve(8);
	testValues(test);
	
	cout << "Expand to 16" << endl;
	test.reserve(9);
	testValues(test);
	
	cout << "Expand to 33" << endl;
	test.reserve(33);
	testValues(test);
	
	//cout << "Expand to 32" << endl;
	//test.reserve(32);
	//testValues(test);
}
static IntVector& calc_fasta_n_term_fragments ( const string& peptideFormula )
{
	static IntVector cleavageIndex;
	int numAA = peptideFormula.length ();
	cleavageIndex.reserve ( numAA );
	cleavageIndex.clear ();

	if ( numAA ) {
		int penultimateAA = numAA - 1;

		for ( int i = 0 ; i < penultimateAA ; i++ ) {
			if ( aa_composition_mask [peptideFormula [i+1]] & break_mask ) {
				if ( (aa_composition_mask [peptideFormula [i]] & exclude_mask ) == 0 ) {
					cleavageIndex.push_back ( i );
				}
			}
		}
		cleavageIndex.push_back ( penultimateAA );
	}
	return ( cleavageIndex );
}
inline void IndexedList::reset(size_t const & s) {
	_element.assign(s, s);
	_list.clear();
	_list.reserve(max_size());
}
inline IndexedList::IndexedList(size_t const & nbClust) :
		_list(), _element(nbClust, nbClust) {
	_list.reserve(max_size());
}