ionFinder/src/peptide.cpp
void PeptideNamespace::Peptide::addNeutralLoss(double lossMass, bool labelDecoyNL)
{
	//calculate neutral loss combinations
	std::vector<double> neutralLossIons;
	for(int i = 1; i <= nMod; i++)
		neutralLossIons.push_back(i * lossMass);
	
	size_t len = fragments.size();
	size_t nLosses = neutralLossIons.size();
	for(size_t i = 0; i < len; i++)
	{
		for(size_t j = 0; j < nLosses; j++)
		{
			fragments.push_back(fragments[i].makeNLFrag(neutralLossIons[j], j + 1));
			
			//calc forceLabel
			if(!labelDecoyNL){
				size_t modCount_temp = nModsInSpan(fragments.back().getBegin(), fragments.back().getEnd());
				bool forceLabel = (modCount_temp == fragments.back().getNumNl());
				fragments.back().setForceLabel(forceLabel);
			}//end if
		}//end for j
	}//end for i
}
/**
 \brief Add neutral loss fragment ions to Peptide <br>
 Neutral loss ions for each b and y ion are added to Peptide for
 each mass in \p losses.
 
 \param lossMass mass of neutral loss to add
 \param labelDecoyNL Should artifact neutral loss ions be labeled in spectra?
 */
\brief Add neutral loss fragment ions to Peptide 
Neutral loss ions for each b and y ion are added to Peptide for
each mass in \p losses.


\ brief Add neutral loss fragment ions to Peptide Neutral loss ions for each b and y ion are added to Peptide for each mass in \ p losses .
void PeptideNamespace::Peptide::addNeutralLoss(double lossMass, bool labelDecoyNL)
{
	std::vector<double> neutralLossIons;
	for(int i = 1; i <= nMod; i++)
		neutralLossIons.push_back(i * lossMass);
	size_t len = fragments.size();
	size_t nLosses = neutralLossIons.size();
	for(size_t i = 0; i < len; i++)
	{
		for(size_t j = 0; j < nLosses; j++)
		{
			fragments.push_back(fragments[i].makeNLFrag(neutralLossIons[j], j + 1));
			if(!labelDecoyNL){
				size_t modCount_temp = nModsInSpan(fragments.back().getBegin(), fragments.back().getEnd());
				bool forceLabel = (modCount_temp == fragments.back().getNumNl());
				fragments.back().setForceLabel(forceLabel);
			}
		}
	}
}
void PeptideNamespace :: Peptide :: addNeutralLoss ( double lossMass , bool labelDecoyNL ) { std :: vector < double > neutralLossIons ; for ( int i = 1 ; i <= nMod ; i ++ ) neutralLossIons . push_back ( i * lossMass ) ; size_t len = fragments . size ( ) ; size_t nLosses = neutralLossIons . size ( ) ; for ( size_t i = 0 ; i < len ; i ++ ) { for ( size_t j = 0 ; j < nLosses ; j ++ ) { fragments . push_back ( fragments [ i ] . makeNLFrag ( neutralLossIons [ j ] , j + 1 ) ) ; if ( ! labelDecoyNL ) { size_t modCount_temp = nModsInSpan ( fragments . back ( ) . getBegin ( ) , fragments . back ( ) . getEnd ( ) ) ; bool forceLabel = ( modCount_temp == fragments . back ( ) . getNumNl ( ) ) ; fragments . back ( ) . setForceLabel ( forceLabel ) ; } } } }
\brief Add neutral loss fragment ions to Peptide <br>
Neutral loss ions for each b and y ion are added to Peptide for
each mass in \p losses.
\ brief Add neutral loss fragment ions to Peptide <br > Neutral loss ions for each b and y ion are added to Peptide for each mass in \ p losses .
//calculate neutral loss combinations //calc forceLabel //end if //end for j //end for i