int SetIntCmp(Set<int> set1, Set<int> set2){ int sum1 = SetSum(set1); int sum2 = SetSum(set2); if(sum1 == sum2) return 0; else if(sum1 < sum2) return -1; else if(sum1 > sum2) return 1; else return 0; }
void CMSHit::RecordMatchesScan(CLadder& Ladder, int& iHitInfo, CMSPeak *Peaks, EMSPeakListTypes Which, int NOffset, int COffset) { try { SetSum() += Ladder.GetSum(); SetM() += Ladder.GetM(); // examine hits array int i; for(i = 0; i < Ladder.size(); i++) { // if hit, add to hitlist if(Ladder.GetHit()[i] > 0) { SetHitInfo(iHitInfo).SetCharge() = (char) Ladder.GetCharge(); SetHitInfo(iHitInfo).SetIonSeries() = (char) Ladder.GetType(); // if(kIonDirection[Ladder.GetType()] == 1) SetHitInfo(iHitInfo).SetNumber() = (short) i + NOffset; // else SetHitInfo(iHitInfo).SetNumber() = (short) i + COffset; SetHitInfo(iHitInfo).SetNumber() = Ladder.GetLadderNumber()[i]; SetHitInfo(iHitInfo).SetIntensity() = Ladder.GetIntensity()[i]; // for poisson test SetHitInfo(iHitInfo).SetMZ() = Ladder[i]; SetHitInfo(iHitInfo).SetDelta() = Ladder.GetDelta()[i]; // iHitInfo++; } } } catch (NCBI_NS_STD::exception& e) { ERR_POST(Info << "Exception caught in CMSHit::RecordMatchesScan: " << e.what()); throw; } }
void PrintVectorSetInt(Vector<Set<int> > arr){ for(int i = 0; i < arr.size(); i++){ Set<int>::Iterator iter = arr[i].iterator(); cout << "["; while(iter.hasNext()){ cout << iter.next(); if(iter.hasNext()) cout << ", "; } cout << "] (Sum=" << SetSum(arr[i]) << ")" << endl; } cout << endl << endl << endl; }
void CMSHit::RecordMatches(CLadderContainer& LadderContainer, int iMod, CMSPeak *Peaks, unsigned ModMask, CMod ModList[], int NumMod, const char *PepStart, int Searchctermproduct, int Searchb1, int TheoreticalMassIn ) { // create hitlist. note that this is deleted in the assignment operator CreateHitInfo(); // need to calculate the number of mods from mask and NumMod(?) NumModInfo = CountMods(ModMask,NumMod); ModInfo.reset(new CMSModInfo[NumModInfo]); SetTheoreticalMass() = TheoreticalMassIn; // increment thru hithist int iHitInfo(0); EMSPeakListTypes Which = Peaks->GetWhich(GetCharge()); SetM() = 0; SetSum() = 0; // scan thru each ladder int ChargeLimit(0); if (GetCharge() < Peaks->GetConsiderMult()) ChargeLimit = 1; TLadderMap::iterator Iter; LadderContainer.Begin(Iter, ChargeLimit, ChargeLimit); while(Iter != LadderContainer.SetLadderMap().end()) { RecordMatchesScan(*((*(Iter->second))[iMod]),iHitInfo, Peaks, Which, Searchb1, Searchctermproduct); LadderContainer.Next(Iter, ChargeLimit, ChargeLimit); } SetN() = (Peaks->GetPeakLists())[Which]->GetNum(); // need to make function to save the info in ModInfo RecordModInfo(ModMask, ModList, NumMod, PepStart ); }
/**************************************************************************************************** * @函数名称: WriteData * @功 能: 往加密狗写数据 * @参 数: 无 * @返回值: S_OK 操作成功,否则 返回对应的错误代码 * @说 明: 往加密狗前128内存写数据 ****************************************************************************************************/ HRESULT CDog::WriteData() { DogPassword = 0; DogBytes = MAX_PRIVATE_MEMORY_LEN; DogData = &m_pMemoryBuf[0]; DogAddr = 0x00; m_BufLen = DogBytes; //对数据进行和校验保证其不被改动 if( S_OK != SetSum() ) { //WriteLog( "写加密狗-校验和失败\r\n" ); return S_FALSE; } //写数据 if( 0 != WriteDog() ) { //WriteLog( "写加密狗-写狗失败\r\n" ); return S_FALSE; } return S_OK; }