示例#1
0
bool CPeptideDatabase::readPepList(char* fn){
	FILE* f=fopen(fn,"rt");

	char pep[64];
	float rt1,rt2;
	int charge;
	double mass;
	char basePep[64];
	char name[32];
	int i,j;

	bool bFound;

	while(!feof(f)){
		fscanf(f,"%s\t%f\t%f\t%d\t%lf\n",pep,&rt1,&rt2,&charge,&mass);

		//match base peptide to database;
		strcpy(basePep,"");
		for(i=0;i<strlen(pep);i++){
			if(isalpha(pep[i])) strncat(basePep,&pep[i],1);
		}

		//iterate through all proteins for match
		bFound=false;
		for(i=0;i<vDB.size();i++){
			if(strstr(&vDB[i].strSeq[0],basePep)!=NULL){
				bFound=true;
				strncpy(name,&vDB[i].strName[0],31);
				name[31]='\0';
				addPeptide(pep,name,rt1,rt2,charge,mass);
			}
		}
		if(!bFound) cout << basePep << " not found." << endl;

	}

	fclose(f);
	return true;

}
ProteinScoreHolder::ProteinScoreHolder(std::string name, bool isDecoy, ProteinScoreHolder::Peptide peptide,
    int groupId)
	: name_(name), q_(0.0), qemp_(0.0), pep_(0.0), p_(0.0), score_(0.0),
	  isDecoy_(isDecoy), groupId_(groupId), specCountsUnique_(0u), specCountsAll_(0u) {
  if (!peptide.name.empty()) addPeptide(peptide);
}