Example #1
0
DFT::DFT(uint32_t winSize, uint32_t padSize, SpectralType specT, uint32_t numAuxA)
:	mSizeWin(0), mSizeHop(0),
	mFFT(0),
	mPadOA(0), mTapW(0), mTapR(0), mPrecise(false)
{
	//printf("DFT::DFT\n");
	resize(winSize, padSize);
	spectrumType(specT);	
	numAux(numAuxA);
}
// printStartQuery - prints the hit
void SpectraSTTxtSearchOutput::printHit(string query, unsigned int hitRank, SpectraSTLibEntry* entry, SpectraSTSimScores& simScores) {
   
  if (!entry) {
    
    (*m_fout).width(4);
    (*m_fout) << "0";
    (*m_fout).width(MAX_NAME_LEN);
    (*m_fout) << left << "NO_MATCH";
    (*m_fout) << endl;
    
    return; 
  }
 
  if (hitRank > 1) {
    (*m_fout).width(MAX_NAME_LEN);
    (*m_fout) << left << "--";
  }
    
  (*m_fout).width(4);
  (*m_fout) << left << hitRank;
    
  stringstream peptidess;
  peptidess << entry->getName();
  (*m_fout).width(MAX_NAME_LEN);
  (*m_fout) << left << peptidess.str();
  simScores.printFixedWidth((*m_fout));	
    
  (*m_fout).width(10);
  (*m_fout) << left << entry->getStatus();
    
  (*m_fout).width(10);	
  string inst("");
  if (entry->getOneComment("Inst", inst)) {
    (*m_fout) << left << inst;
  } else {
    (*m_fout) << left << "Unk";
  }
    
  (*m_fout).width(6);	
  string spectrumType("");
  if (entry->getOneComment("Spec", spectrumType)) {
    (*m_fout) << left << spectrumType.substr(0, spectrumType.length() < 3 ? spectrumType.length() : 3);
  } else {
    (*m_fout) << left << "Unk";
  }

  (*m_fout).width(20);
  (*m_fout) << left << entry->getLibFileOffset();

  string protein("");
  stringstream proteinss;
  string sample("");
  string::size_type pos = 0;
  if (entry->getOneComment("Protein", protein)) {
    if (protein.find('/') != string::npos) {
      int proteinCount = atoi(nextToken(protein, 0, pos, "/\t\r\n").c_str());
      proteinss << proteinCount << ':';
      bool isFirstProtein = true;
      while (pos < protein.length()) {
	if (!isFirstProtein) proteinss << ';';
	proteinss << nextToken(protein, pos, pos, "/\t\r\n", "/");
	isFirstProtein = false;
      }
    } else {
      proteinss << '1' << ':' << protein;
    }
      
  } else if (entry->getOneComment("Sample", sample)) {
    // if no protein field is given, use the sample field. (this is useful for unidentified spectra)
    if (sample.find('/') != string::npos) {
      int sampleCount = atoi(nextToken(sample, 0, pos, "/\t\r\n").c_str());
      proteinss << sampleCount << ':';
      bool isFirstSample = true;
      while (pos < sample.length()) {
	if (!isFirstSample) proteinss << ';';
	proteinss << nextToken(sample, pos, pos, "/\t\r\n", "/");
	isFirstSample = false;
      }
    }
	
  } else {
    proteinss << '0';
  }
    
  (*m_fout) << proteinss.str();
  
  (*m_fout) << endl;
  	
}