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
|
/*
Exact M.W. of ssRNA (e.g., RNA Transcript)
M.W. = (An x 329.2) + (Un x 306.2) + (Cn x 305.2) + (Gn x 345.2) + 159ª
An, Un, Cn, and Gn are the number of each respective nucleotide within the polynucleotide.
M.W. calculated is valid at physiological pH.
ªAddition of "159" to the M.W. takes into account the M.W. of a 5' triphosphate.
Exact M.W. of ssDNA (e.g., Oligonucleotides)
M.W. = (An x 313.2) + (Tn x 304.2) + (Cn x 289.2) + (Gn x 329.2) + 79.0ª
An, Tn, Cn, and Gn are the number of each respective nucleotide within the polynucleotide.
ªAddition of "79.0" to the M.W. takes into account the 5' monophosphate left by most restriction enzymes.
No phosphate is present at the 5' end of strands made by primer extension.
Initially, this program will only compute for the MW for DNA.
*/
#include <iomanip>
#include <iostream>
int main()
{
float sum = 0;
char bases[] = "aAcCgGtT";
float values[] =
{
313.2,313.2,289.2,289.2,329.2,329.2,304.2,304.2,
};
char sequence[100];
std::cout<<"Please enter a DNA sequence (up to 100 letters): "; // Input sequence
std::cin>> std::setw ( 100 ) >> sequence; // Assign it to sequence
for ( int i = 0; sequence[i] != '\0'; i++ ) // for loop, go through sequence until terminal
{
for ( int j = 0; bases[j] != '\0'; j++ ) //within that loop, assign the correct mass
{
if ( sequence[i] == bases[j] ) // Assigns mass to base pair
std::cout << values[j] <<' '; //displays masses of base pairs entered
}
}
std::cout <<"Fragment Mass: " << sum;
return 0;
}
|