阅读背景:

查找字符串中的所有子字符串并存储结果?

来源:互联网 
class ORF_Finder {
public:
    void findORFs(string & strand, int sizeOfStrand); 
    vector<string> orf1Strands; 
    vector<string> orf2Strands;
    vector<string> orf3Strands; 
private:
    string newStrand;
    string newSub;
};    


void ORF_Finder::findORFs(string & strand, int sizeOfStrand) {

        int pos, pos1, index = 0;

for (int i = 0; i < strand.size(); i++) {
        pos = strand.find("ATG"); 
        pos1 = strand.find("TAA"); 
        newSub = strand.substr(pos, pos1);
        newStrand.insert(index, newSub);
        strand.erase(pos, pos1);
        index = index + 3; 

        if ((pos1 % 3 == 0) && (pos1 >= pos + 21)) {
            orf1Strands.push_back(newStrand); 
        }

        else if ((pos1 % 3 == 1) && (pos1 >= pos + 21)) { 
            orf2Strands.push_back(newStrand);
        }

        else if ((pos1 % 3 == 2) && (pos1 >= pos + 21)) {
            orf3Strands.push_back(newStrand); 
        }
   }
}
class ORF_Finder {
public:
    void findORFs(st



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: