void TimeWarp::createCombinedMatrix(DoubleMatrix myChromaMatrix, DoubleVector energyVector, DoubleMatrix* chromaEnergyMatrix){
	chromaEnergyMatrix->clear();
	int sizeRatio = energyVector.size() / myChromaMatrix.size();//
	printf("COMBINE: size of my chroma is %i\n", (int) myChromaMatrix.size());// energyVector.size() / myChromaMatrix.size();
	printf("COMBINED: size ratio of energy to chroma is %i \n", sizeRatio);
	int chromaSize = myChromaMatrix.size();	
//	printf("index is %i\n", index);
	
	for (int i = 0;i < energyVector.size();i++){
		DoubleVector d;
		int index = min(chromaSize-1, (int) floor(i/sizeRatio));

		for (int y = 0;y < 12;y++){
			d.push_back(myChromaMatrix[index][y]);//
		}

		
		d.push_back(energyVector[i]);
					(*chromaEnergyMatrix).push_back(d);
	}
	printf("COMBINED: size of chroma energy is %i\n", (int)(*chromaEnergyMatrix).size());

//	int x = (int)(*chromaEnergyMatrix).size()/3;
//	printf("energy[%i] %f \n", x, energyVector[x]);
/*
 for (int y = 0;y < 13;y++){
		printf("chroma[%i][%i] %f \n", x, y, myChromaMatrix[x/sizeRatio][y]);
		printf("c[%i][%i] %f \n", x, y, (*chromaEnergyMatrix)[x][y]);
	}
		printf("\n");
*/	

}
int SupportVectorMachine::classify(const DoubleVector& x, DoubleVector& scores, int index_offset) {
#ifdef HAVE_LIBSVM
	struct svm_node* toclassify=(struct svm_node*)malloc(sizeof(struct svm_node)*x.size()+1);
  
  for(uint d=0;d<x.size();++d) {
    toclassify[d].index=d+index_offset;
    toclassify[d].value=x[d];
  }
  toclassify[x.size()].index=-1;

  int C=this->C();
  double *s=new double[C];
  
  svm_predict_values(model,toclassify,s);
  
  scores=DoubleVector(C,0.0);
  double maxScore=-std::numeric_limits<double>::max();
  int argmaxScore=-1;
  for(int c=0;c<C;++c) { 
    scores[c]=s[c]; 
    if(scores[c]>maxScore) {
      maxScore=scores[c];
      argmaxScore=c;
    }
  }
  
  free(toclassify); delete(s);
  return argmaxScore;
#else
  return 0;
#endif
}
void Pattern::configure(ConfigurationParameters& params, QString prefix) {
	//--- get all parameters with the prefix 'cluster:'
	QStringList clusterList = params.getParametersWithPrefixList( prefix, "cluster:" );
	foreach( QString cluster, clusterList ) {
		QString id = cluster.split(':')[1];
		if ( id.isNull() || id.isEmpty() ) continue;
		//--- now, it check if there is a inputs and outputs parameter and load it
		QString str = params.getValue( prefix + "inputs:" + id );
		DoubleVector inputs;
		if (!str.isNull()) {
			QStringList list = str.split(QRegExp("\\s+"), QString::SkipEmptyParts);
			for( int i=0; i<list.size(); i++) {
				inputs.append( list[i].toDouble() );
			}
		}
		str = params.getValue( prefix + "outputs:" + id );
		DoubleVector outputs;
		if (!str.isNull()) {
			QStringList list = str.split(QRegExp("\\s+"), QString::SkipEmptyParts);
			for( int i=0; i<list.size(); i++) {
				outputs.append( list[i].toDouble() );
			}
		}
		if ( inputs.size() == 0 && outputs.size() == 0 ) continue;
		Cluster* cl = params.getObjectFromParameter<Cluster>( prefix+cluster, false, true );
		if ( inputs.size() > 0 ) {
			setInputsOf( cl, inputs );
		}
		if ( outputs.size() > 0 ) {
			setOutputsOf( cl, outputs );
		}
	}
Beispiel #4
0
void StopRule::multiple (DoubleVector &vec1, DoubleVector &vec2, DoubleMatrix &proMat) {
	int row_, col_;
	proMat.resize(vec1.size());
	for (row_ = 0; row_ < vec1.size(); row_++)
		proMat[row_].resize(vec2.size());

	for (row_ = 0; row_ < vec1.size(); row_ ++)
		for (col_ = 0; col_ < vec2.size(); col_ ++)
			proMat[row_][col_] = vec1[row_] * vec2[col_];
}
Beispiel #5
0
  void LowessSmoothing::smoothData(const DoubleVector& input_x, const DoubleVector& input_y, DoubleVector& smoothed_output)
  {
    if (input_x.size() != input_y.size())
    {
      throw Exception::InvalidValue(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
          "Sizes of x and y values not equal! Aborting... ", String(input_x.size()));
    }

    // unable to smooth over 2 or less data points (we need at least 3)
    if (input_x.size() <= 2)
    {
      smoothed_output = input_y;
      return;
    }

    Size input_size = input_y.size();

    // const Size q = floor( input_size * alpha );
    const Size q = (window_size_ < input_size) ? static_cast<Size>(window_size_) : input_size - 1;

    DoubleVector distances(input_size, 0.0);
    DoubleVector sortedDistances(input_size, 0.0);

    for (Size outer_idx = 0; outer_idx < input_size; ++outer_idx)
    {
      // Compute distances.
      // Size inner_idx = 0;
      for (Size inner_idx = 0; inner_idx < input_size; ++inner_idx)
      {
        distances[inner_idx] = std::fabs(input_x[outer_idx] - input_x[inner_idx]);
        sortedDistances[inner_idx] = distances[inner_idx];
      }

      // Sort distances in order from smallest to largest.
      std::sort(sortedDistances.begin(), sortedDistances.end());

      // Compute weigths.
      std::vector<double> weigths(input_size, 0);
      for (Size inner_idx = 0; inner_idx < input_size; ++inner_idx)
      {
        weigths.at(inner_idx) = tricube_(distances[inner_idx], sortedDistances[q]);
      }

      //calculate regression
      Math::QuadraticRegression qr;
      std::vector<double>::const_iterator w_begin = weigths.begin();
      qr.computeRegressionWeighted(input_x.begin(), input_x.end(), input_y.begin(), w_begin);

      //smooth y-values
      double rt = input_x[outer_idx];
      smoothed_output.push_back(qr.eval(rt));
    }

    return;
  }
Beispiel #6
0
void DoubleVector::append(const DoubleVector& v)
{
   const size_t old_size = x.size();
   std::valarray<double> y(x); // old vector
   x.resize(old_size + v.size());
   end = start + x.size() - 1;
   for (size_t i = 0; i < y.size(); ++i)
      x[i] = y[i];
   for (size_t i = 0; i < v.size(); ++i)
      x[i + old_size] = v(i + v.displayStart());
}
void PlotFunction::drawVector(DoubleVector& energyVec, int minIndex, int maxIndex, const WindowRegion& window, const double& maxNumberOfIndexPoints, const double& maxValue){

	float screenHeight = window.height;
	float screenWidth = window.width;  
	
	double  numberOfIndexPoints = min(maxNumberOfIndexPoints, (double) maxIndex - minIndex);
	double indicesPerStep = (maxIndex - minIndex) / numberOfIndexPoints;
	double pixelsPerStep = window.width / numberOfIndexPoints;
	
	int i, j;
	
	double heightScalar = window.height / (1.1*maxValue);
	
	int lastHeight = window.y + screenHeight - (energyVec[minIndex]*heightScalar);;
	int newHeight;
	int xPosition;
	int lastXposition = window.x;
	
	double exactIndex;
	for (exactIndex = minIndex; exactIndex < maxIndex; exactIndex += indicesPerStep){
		j = round(exactIndex);
		i = j - minIndex;
		
		if (j < energyVec.size()){
			xPosition = window.x + i*pixelsPerStep;
			newHeight =	window.y + screenHeight - (energyVec[j]*heightScalar);
			
			ofLine(lastXposition, lastHeight, xPosition, newHeight);
			
			lastHeight = newHeight;
			lastXposition = xPosition;
			
		}
	}
}
void CosSimilarityList::printHTML ( ostream& os, const DoubleVector& c, const string& styleID ) const
{
	for ( int i = 0 ; i < c.size () ; i++ ) {
		if ( c [i] == -100.0 )	tableEmptyCell ( os, styleID );
		else					tableCellSigFig ( os, c [i], 3, false, styleID );
	}
}
Beispiel #9
0
void _computeCovarianceMat(const RDGeom::Point3DConstPtrVect &refPoints,
                           const RDGeom::Point3DConstPtrVect &probePoints,
                           const DoubleVector &weights, double covMat[3][3]) {
  unsigned int i, j;
  for (i = 0; i < 3; i++) {
    for (j = 0; j < 3; j++) {
      covMat[i][j] = 0.0;
    }
  }
  unsigned int npt = refPoints.size();
  CHECK_INVARIANT(npt == probePoints.size(), "Number of points mismatch");
  CHECK_INVARIANT(npt == weights.size(),
                  "Number of points and number of weights do not match");
  const double *wData = weights.getData();

  const RDGeom::Point3D *rpt, *ppt;
  double w;
  for (i = 0; i < npt; i++) {
    rpt = refPoints[i];
    ppt = probePoints[i];
    w = wData[i];

    covMat[0][0] += w * (ppt->x) * (rpt->x);
    covMat[0][1] += w * (ppt->x) * (rpt->y);
    covMat[0][2] += w * (ppt->x) * (rpt->z);

    covMat[1][0] += w * (ppt->y) * (rpt->x);
    covMat[1][1] += w * (ppt->y) * (rpt->y);
    covMat[1][2] += w * (ppt->y) * (rpt->z);

    covMat[2][0] += w * (ppt->z) * (rpt->x);
    covMat[2][1] += w * (ppt->z) * (rpt->y);
    covMat[2][2] += w * (ppt->z) * (rpt->z);
  }
}
void CosSimilarityList::printDelimited ( ostream& os, const DoubleVector& c ) const
{
	for ( int i = 0 ; i < c.size () ; i++ ) {
		if ( c [i] == -100.0 )	delimitedEmptyCell ( os );
		else					delimitedCellSigFig ( os, c [i], 3 );
	}
}
int main(int argc, char **argv)
{
  std::string cornerString="   0.1     0.1      0.1   20 20 10";
  
  typedef boost::tokenizer<boost::char_separator<char> >            Tokenizer;
  typedef std::vector<double>                                       DoubleVector;
  typedef boost::tokenizer<boost::char_separator<char> >::iterator  TokIterator;

  boost::char_separator<char> sep(", ");
  Tokenizer tok(cornerString, sep);
  DoubleVector corners;
  corners.clear();

  for (TokIterator it=tok.begin(); it!=tok.end(); ++it ) {
    double q;
    printf("");
    sscanf(it->c_str(), "%lf", &q);
    //DPrintf(DebugReaction," %lf  ['%s'];  ", q, it->c_str());
    corners.push_back( q );
  }
  printf("the corners are:\n   ");
  printf("%e", corners[0]);
  for(int i=1; i<corners.size(); ++i ) {
    printf(", %e", corners[i]);
  }
  printf("\n");
}
Beispiel #12
0
void DataPartitions::doFrequency(DoubleVector dimData){
    m_partitions.clear();
    PairVector dimOrData;
    initPairs(dimOrData, dimData);
    pairSort(dimOrData);
    int dimsize = dimData.size();

    int nBins = this->m_rddtClust->m_rddtOp->m_nBins;
    if(nBins == 0 ){
        nBins = 1;
    }
    if(nBins>dimsize){
        nBins = dimsize;
    }
    for(int i = 0; i< nBins; i++){
        DataPartition* partition = new DataPartition();
        partition->setPartitions(this);
        partition->m_partitionIdx = i;
        this->m_partitions.push_back(partition);
    }

    int partitionsize = (int)ceil((double)dimsize/(double)nBins);
    for(unsigned i = 0; i< dimOrData.size(); i++){
        int p = (int)((double)i/(double)partitionsize);
        if(p>(int)m_partitions.size())
            p=m_partitions.size();
        int first = (dimOrData[i]).first;
        (m_partitions[p])->m_parIndices.push_back(first);
    }

}
TEST_F(EnergyPlusFixture,ReverseTranslator_ScheduleDayInterval) {
  // ScheduleDayInterval time entries contain the string 'Until: ' that must be
  // stripped off before constructing a Time object. We are also more lenient in
  // making this optional.
  Workspace ws(StrictnessLevel::Draft,IddFileType(IddFileType::EnergyPlus));
  OptionalWorkspaceObject owo = ws.addObject(IdfObject(IddObjectType::Schedule_Day_Interval));
  ASSERT_TRUE(owo);
  WorkspaceObject object = *owo;
  object.setName("Heating Setpoint Design Day");
  StringVector groupValues(2u);
  groupValues[0] = std::string("Until: 12:00");
  groupValues[1] = std::string("21.1");
  object.pushExtensibleGroup(groupValues);
  groupValues[0] = std::string("24:00");
  groupValues[1] = std::string("20.5");
  object.pushExtensibleGroup(groupValues);

  ReverseTranslator translator;
  Model model = translator.translateWorkspace(ws);
  EXPECT_TRUE(translator.errors().empty());
  // There are warnings related to ws being a partial model.
  EXPECT_TRUE(translator.untranslatedIdfObjects().empty());
  ScheduleDayVector daySchedules = model.getModelObjects<ScheduleDay>();
  ASSERT_EQ(1u,daySchedules.size());
  ScheduleDay daySchedule = daySchedules[0];
  DoubleVector values = daySchedule.values();
  ASSERT_EQ(2u,values.size());
  EXPECT_DOUBLE_EQ(21.1,values[0]);
  EXPECT_DOUBLE_EQ(20.5,values[1]);
  TimeVector times = daySchedule.times();
  ASSERT_EQ(2u,times.size());
  EXPECT_EQ(Time(0,12,0),times[0]);
  EXPECT_EQ(Time(0,24,0),times[1]);
}
Beispiel #14
0
double _sumOfWeights(const DoubleVector &weights) {
  const double *wData = weights.getData();
  double res = 0.0;
  for (unsigned int i = 0; i < weights.size(); i++) {
    CHECK_INVARIANT(wData[i] > 0.0, "Negative weight specified for a point");
    res += wData[i];
  }
  return res;
}
bool StepFunction::derivate( const DoubleVector& inputs, const DoubleVector&, DoubleVector& derivates ) const {
	//--- return the same as if it is a sigmoid with lambda = 1
	for( unsigned int i=0; i<inputs.size(); i++ ) {
		double y;
		y = 1.0/( 1.0 + std::exp( -inputs[i] ) );
		derivates[i] = y * ( 1.0 - y );
	}
	return true;
}
Beispiel #16
0
void DataPartitions::initPairs(PairVector &dimOrData, DoubleVector dimData){
    dimOrData.clear();
    for(unsigned i = 0; i< dimData.size(); i++){
        int first = (int)i;
        double second = dimData[i];
        std::pair<int, double> temp(first,second);
        dimOrData.push_back(temp);
    }
}
void PlotFunction::drawVector(DoubleVector& energyVec, int minIndex, int maxIndex, const WindowRegion& window, const double& maxResolution){
	
	
	minIndex = max(0, minIndex);
	maxIndex = min((int)energyVec.size()-1, maxIndex);
	int tmpTwenty = 20;
	double maximumValue = 1.1*getMaximum(energyVec, minIndex, maxIndex, tmpTwenty);
	drawVector(energyVec, minIndex, maxIndex, window, maxResolution, maximumValue);

}
Beispiel #18
0
  // must be mt-safe. don't use boost::python handles!
  double objectiveFunction(DoubleVector const &args) const {    
    double result=DBL_MAX, arg1, arg2, arg3;
    if (args.size() == 1) {
  	  arg1 = args[0];
  	  result = interp1d_grid(m_pGrid1, m_pF, arg1);
    } else if (args.size() == 2) {
  	  arg1 = args[0];
	  arg2 = args[1];		
	  result = interp2d_grid(m_pGrid1, m_pGrid2, m_pF, arg1, arg2);		
	  //printf("objectiveFn: %f %f -> %f\n", arg1, arg2, result);
    } else if (args.size() == 3) {
	  arg1 = args[0];
	  arg2 = args[1];
	  arg3 = args[2];
	  result = interp3d_grid(m_pGrid1, m_pGrid2, m_pGrid3, m_pF, arg1, arg2, arg3);		
    } else {
	  assert(false);
    }
	return result;
  }
bool RampFunction::derivate( const DoubleVector& inputs, const DoubleVector&, DoubleVector& derivates ) const {
	for( unsigned int i=0; i<inputs.size(); i++ ) {
		if ( inputs[i] >= min_x && inputs[i] <= max_x ) {
			derivates[i] = ( max_y-min_y )/( max_x-min_x );
		} else {
			double y;
			y = 1.0/( 1.0 + std::exp( -inputs[i] ) );
			derivates[i] = y * ( 1.0 - y );
		}
	}
	return true;
}
Beispiel #20
0
double _weightedSumOfLenSq(const RDGeom::Point3DConstPtrVect &points,
                           const DoubleVector &weights) {
  PRECONDITION(points.size() == weights.size(), "");
  double res = 0.0;
  RDGeom::Point3DConstPtrVect_CI pti;
  const double *wData = weights.getData();
  unsigned int i = 0;
  for (pti = points.begin(); pti != points.end(); pti++) {
    res += (wData[i] * ((*pti)->lengthSq()));
    i++;
  }
  return res;
}
FileSplit::FileSplit ( const IntVector& nFileSpec, const DoubleVector& prop, int maxSpectra )
{
	totSpec = accumulate ( nFileSpec.begin (), nFileSpec.end (), 0 );
	int maxSpecPerProcess = static_cast<int> ( totSpec * prop [0] );
	numSerial = ( maxSpecPerProcess / maxSpectra ) + 1;		// Number of serial searches
	IntVector nSearchSpec;
	for ( DoubleVectorSizeType i = 0 ; i < prop.size () ; i++ ) {
		for ( int j = 0 ; j < numSerial ; j++ ) {
			nSearchSpec.push_back ( static_cast<int> ( ( totSpec / numSerial ) * prop [i] ) );
		}
	}
	int rem = accumulate ( nSearchSpec.begin (), nSearchSpec.end (), 0 ) - totSpec;
	while ( rem != 0 ) {
		int inc = ( rem < 0 ) ? 1 : -1;
		for ( DoubleVectorSizeType i = 0 ; i < prop.size () ; i++ ) {
			nSearchSpec [i] += inc;
			rem += inc;
			if ( rem == 0 ) break;
		}
	}
	init ( nFileSpec, nSearchSpec );
}
double PlotFunction::getMaximum(DoubleVector& energyVec, const int& minIndex, const int& maxIndex, int& numberOfSteps){
	
	int step = max(1, (int)((maxIndex - minIndex) / (float) numberOfSteps));
	double maximumValue = energyVec[minIndex];
	int index = minIndex;
	while (index < maxIndex && index < energyVec.size()){
		index += step;
		if (energyVec[index] > maximumValue){
			maximumValue = energyVec[index];
		}
	}
	return maximumValue;
	
}
Beispiel #23
0
double DiscreteHeat::fx(const DoubleVector& f)
{
    double sum  = 0.0;

    pf = &f;
    DoubleVector u;
    IParabolicEquation::calculateU(u, hx, ht, N, M, a);

    double alpha;
    for (unsigned int i=0; i<u.size(); i++)
    {
        alpha = 1.0;
        if (i==0 || i==u.size()-1) alpha = 0.5;
        sum += alpha*(u[i] - U[i])*(u[i] - U[i]);
    }
    sum = hx*sum;

    double norm = 0.0;
    for (unsigned int j=0; j<=M; j++)
    {
        for (unsigned int i=0; i<=N; i++)
        {
            double alpha = 1.0;
            if (i==0 || i==N || j==0 || j==M) alpha = 0.5;
            if (i==0 && j==0) alpha = 0.25;
            if (i==0 && j==M) alpha = 0.25;
            if (i==N && j==0) alpha = 0.25;
            if (i==N && j==M) alpha = 0.25;

            double f1 = (f[j*(N+1)+i] - fxt(i*hx, j*ht));
            norm += alpha*f1*f1;
        }
    }
    norm = hx*ht*norm;

    return sum+norm;
}
Beispiel #24
0
RDGeom::Point3D _weightedSumOfPoints(const RDGeom::Point3DConstPtrVect &points,
                                     const DoubleVector &weights) {
  PRECONDITION(points.size() == weights.size(), "");
  RDGeom::Point3DConstPtrVect_CI pti;
  RDGeom::Point3D tmpPt, res;
  const double *wData = weights.getData();
  unsigned int i = 0;
  for (pti = points.begin(); pti != points.end(); pti++) {
    tmpPt = (*(*pti));
    tmpPt *= wData[i];
    res += tmpPt;
    i++;
  }
  return res;
}
void RampFunction::apply( DoubleVector& inputs, DoubleVector& outputs ) {
	unsigned int size = inputs.size();
	double m = ( max_y-min_y )/( max_x-min_x );
	double q = min_y - m*min_x;
	for ( unsigned int i = 0; i<size; i++ ) {
		double ret = m*(inputs[i]) + q;
		if (ret < min_y) {
			outputs[i] = min_y;
		} else if (ret > max_y) {
			outputs[i] = max_y;
		} else {
			outputs[i] = ret;
		}
	}
}
DoubleVector& get_cleaved_masses ( const string& protein, const IntVector& cleavageIndex )
{
	static DoubleVector cleavedMassArray ( 36000 );
	StringSizeType numAA = protein.length ();
	if ( numAA > cleavedMassArray.size () ) cleavedMassArray.resize ( numAA );

	for ( StringSizeType i = 0, j = 0 ; i < numAA ; ) {
		double mass = 0.0;
		StringSizeType index = cleavageIndex [j];
		while ( i <= index ) {
			mass += amino_acid_wt [protein[i++]];
		}
		cleavedMassArray [j++] = mass;
	}
	return cleavedMassArray;
}
  QVariant LinearFunction_Impl::toVariant() const {
    QVariantMap linearFunctionData = AnalysisObject_Impl::toVariant().toMap();

    linearFunctionData["function_type"] = QString("LinearFunction");

    QVariantList variablesList;
    DoubleVector coeffs = coefficients();
    int index(0), coeffsN(coeffs.size());
    Q_FOREACH(const Variable& var,variables()) {
      QVariantMap varMap = var.toVariant().toMap();
      varMap["variable_index"] = index;
      if (index < coeffsN) {
        varMap["coefficient"] = coeffs[index];
      }
      variablesList.push_back(QVariant(varMap));
      ++index;
    }
Beispiel #28
0
bool TimeWarp::extendAlignmentUp(const int& endIndexY, DoubleMatrix *alignmentMatrix){
	DoubleVector d;
	d = (*alignmentMatrix)[0];//alignmentMatrix[0];//
	int heightSize = d.size();
	if (heightSize < endIndexY){
		//then we haven't finished yet
		for (int i = 0;i < (*alignmentMatrix).size();i++){
			double value = getDistance(i, heightSize);
			value += getRestrictedMinimum(i, heightSize, value, 0, 0);//min values 0	
			(*alignmentMatrix)[i].push_back(value);//
		}
	}
	if ((*alignmentMatrix)[0].size() == endIndexY)
		return true;
	else
		return false;
	
}
void FakeSigmoidFunction::apply( DoubleVector& inputs, DoubleVector& outputs ) {
	unsigned int size = inputs.size();
	double x;
	double x0 = 6. + 2./3.;
	double zero = 0.5;
	for ( unsigned int i = 0; i<size; i++ ) {
		x = inputs[i];
		x *= lambda;
		x -= (.5 - zero) / (.075 + zero);
		if ( x <= -x0 ) {
			outputs[i] = 0.0;
		} else {
			if ( x < x0 ) {
				outputs[i] = .5 + .575 * x / ( 1.0 + fabs(x) );
			} else {
				outputs[i] = 1.0;
			}
		}
	}
}
void MowseScore::calculateMowseScores ( HitStats* hs, double proteinMW, const DoubleVector& peakMass )
{
	if ( hs->mowseScore == 0.0 ) {
		if ( statsNeedUpdating ) {
			assembleMowseStats ();
		}
		double pn = 1.0;

		int numPeaks = peakMass.size ();
		for ( int i = 0 ; i < numPeaks ; i++ ) {
			if ( hs->massMatched [i] == SCORE_MATCH && peakMass [i] < MAX_MOWSE_PEPTIDE_MASS ) {
				pn *= mowseScore [genMin ((int)(proteinMW/MOWSE_PROTEIN_AMU_BIN), MAX_MOWSE_PROTEIN_BIN_INDEX)][(int)(peakMass[i]/MOWSE_PEPTIDE_AMU_BIN)];
				if ( hs->mowseMissedCleavages [i] != 0 ) pn /= mowsePFactor;
			}
		}
		if ( pn )											// Prevent division by zero
			hs->mowseScore = 50000.0 / ( pn * proteinMW );
		else
			hs->mowseScore = 0.0;
	}
}