If I could get help on understanding what and how I should do things that would be great.
Implement and test a C++ program that, assuming that you have character arrays that are of size N (locations 0 through N1):
Reads a series of strings of the form "aactgcta..." from a file into a character array called original (the string will be less than N in length)
Change each of the characters in original to be uppercase versions of themselves
Copy the contents of original to a character array called duplicate
Reverse the contents of duplicate to a character array called reverse
Compliment (A > T, T > A, G > C, C > G) the contents of reverse to a character array called reverseCompliment
Display "original = aactgcgccgta..., reverse = ..., reverse compliment = ..." for each entry in the file
For the purposes of this lab N <= 10.
My code so far;
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
|
#include <iostream>
#include <fstream>
using namespace std;
int main(){
ifstream inputFile;
const int N = 10;
char duplicate[N], reverse[N], compliment[N];
inputFile.open("DNAreads.dat");
char original[N];
if (inputFile.is_open()) {
}
for (int i=0; i < N-1; i++){
original[i] = toupper(original[i]);
duplicate [i] = original[i];
}
for (int i = 0, j = N-1; i < j; i++, j--){
reverse[i] = original[j];
reverse[j] = original[i];
}
for (int i = 0; i < N-1; i++){
if (reverse[i] = 'A', compliment[i] = 'T')
else if (reverse[i] = 'T', compliment[i]= 'A')
else if (reverse[i] = 'G', compliment[i]= 'C')
else if (reverse[i] = 'C', compliment[i]= 'G')
}
cout << original, reverse, compliment;
inputFile.close();
}
|