1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
#include <iostream>
#include <string>
#include <cctype>
using namespace std;
void ORFfinder1(string strand, string strand1);
void ORFfinder2(string strand, string strand2);
void ORFfinder3(string strand, string strand3);
int main () {
string strand, strand1, strand2, strand3;
cout << "Enter a string: ";
cin >> strand;
ORFfinder1(strand, strand1);
ORFfinder2(strand, strand2);
ORFfinder3(strand, strand3);
return 0;
}
void ORFfinder1(string strand, string strand1) {
int pos, pos1;
int size = strand.length();
for (int i = 0; i < size; i = i + 3) {
pos = strand.find("ATG", i);
}
pos1 = strand.find("TAA");
if (pos1 > 7) {
strand1 = strand.substr(pos, pos1);
cout << strand1;
}
else {
cout << "Sorry, nothing found at reading frame 1." << endl;
}
}
void ORFfinder2(string strand, string strand2) {
int pos, pos1;
int size = strand.length();
for (int i = 1; i < size; i = i + 3) {
pos = strand.find("ATG", i);
}
pos1 = strand.find("TAA");
if (pos1 > 7) {
strand2 = strand.substr(pos, pos1);
cout << strand2;
}
else {
cout << "Sorry, nothing found at reading frame 2." << endl;
}
}
void ORFfinder3(string strand, string strand3) {
int pos, pos1;
int size = strand.length();
for (int i = 2; i < size; i = i + 3) {
pos = strand.find("ATG", i);
}
pos1 = strand.find("TAA");
if (pos1 > 7) {
strand3 = strand.substr(pos, pos1);
cout << strand3;
}
else {
cout << "Sorry, nothing found at reading frame 3." << endl;
}
}
|