-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
2487 lines (2205 loc) · 52.5 KB
/
main.cpp
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include <iostream>
#include <vector>
#include <string>
#include <fstream>
#include <cmath>
#include <sstream>
#include <cstdlib>
using namespace std;
struct Paladrome
{
string sequence;
unsigned int start;
unsigned int stop;
};
struct Amino
{
char peptide;
string peptide3l;
string peptideName;
int number;
};
struct Codon
{
string bases;
char peptide;
char type;
bool special;
bool start;
bool stop;
double bondAngle;
double bondLength;
string peptide3l;
string peptideName;
};
struct Point
{
double x;
double y;
double z;
Codon type;
};
struct Frame
{
vector<Codon> list;
int startCodon;
int lastCodon;
string codingDNA;
bool error;
bool doesBreak;
bool marker;
};
struct intext
{
string code;
bool extron;
};
struct SpliceSite
{
//start[cut]first...last[cut]
string start;
string first;
vector<string> middle;
string last;
string stop;
};
struct ThreeLettersCount
{
string threeLetters;
unsigned int number;
};
struct LetterCount
{
char letter;
unsigned int number;
};
struct Peptide
{
Codon codon;
vector<ThreeLettersCount> bases;
unsigned int countBases()
{
unsigned int number = 0;
for (int i = 0; i < bases.size(); i++)
{
number += bases.at(i).number;
}
return number;
}
vector<ThreeLettersCount> IUPACBases;
unsigned int countIUPACBases()
{
unsigned int number = 0;
for (int i = 0; i < bases.size(); i++)
{
number += IUPACBases.at(i).number;
}
return number;
}
};
string RNAtoDNA(string RNA);
string DNAtoRNA(string DNA);
string DNAantiCodon(string DNA);
string RNAantiCodon(string RNA);
string flipString(string input);
vector<Codon> getCodonSheet(string filePath);
string getDNA(string filePath);
vector<string> parseStrings(string codonString);
Codon getAntiCodon(string inputCodon, vector<Codon> codonSheet);
Codon findCodon(const string &DNA, const vector<Codon> &codonSheet);
int findStartCodon(const string &DNA, const vector<Codon> &codonSheet, const int &start);
vector<Codon> getCodonSequence(int startCodon, int &lastCodon, const vector<Codon> &codonSheet, const string &DNA, string &codingDNA, bool &error, bool &doesBreak);
void printCodonSheetToConsole(const vector<Codon> &codonSheet);
bool printCodonSheetToFile(const vector<Codon> &codonSheet, const string &filePath);
vector<Frame> getFrames(const string &DNA, const vector<Codon> &codonSheet);
void printFramesToConsole(const vector<Frame> &Frames);
bool printFramesToFile(const vector<Frame> &Frames, const string &filePath);
bool printCodeToFile(string Code, string filePath);
void printCodeToConsole(string Code);
bool isPaladrome(const string Code);
vector<Paladrome> findPaladromes(const string &code, const int &minsize);
vector<Frame> findMinFrames(const vector<Frame> &Frames, const int &minsize);
vector<Frame> mergeFrames(const vector<Frame> &Frames1, const vector<Frame> &Frames2);
string DNAflipAntiString(string DNA);
bool printMachineFramesToFile(const vector<Frame> &Frames, const string &filePath);
bool isSubset(const char &large, const char &small);
double measureDistance(Point &point1, Point &point2);
double measureAngle(Point &point1, Point &point2, Point &point3);
Point translate(const Point &input, const double &x, const double &y, const double &z);
Point stretch(const Point &input, const double &x, const double &y, const double &z);
Point rotate_x(const Point &input, const double &angle);
Point rotate_y(const Point &input, const double &angle);
Point rotate_z(const Point &input, const double &angle);
vector<Amino> countPeptide(const vector<Codon> &codons);
vector<ThreeLettersCount> countCodons(const vector<Codon> &codons);
vector<ThreeLettersCount> countThreeLetters(const string &code, bool &error);
vector<LetterCount> countLetters(const string &code);
string getStatistics(const vector<Codon> &codonSheet, const string &DNA, bool &error, vector<Peptide> &peptides);
int getRandomNumber(const int &minimum, const int &maximum, const int &iteration);
ThreeLettersCount pickBase(vector<ThreeLettersCount> bases);
string getSequenceFromProtein(const Frame &proteinFrame, vector<Peptide> &peptides);
string getSequenceFromProtein(const string proteinString, vector<Peptide> &peptides);
char fromIUPAC(const char &large);
string fromIUPAC(const string &large);
Peptide getPeptideIUPACCodon(Peptide peptide);
vector<char> getMasters(const vector<char> &characters);
vector<Frame> getMinimumFrames(const string &DNA, const vector<Codon> &codonSheet, const unsigned int &minimumSize);
bool isDNA(const string &DNA);
bool isRNA(const string &RNA);
bool isNucleotide(const string &bases);
bool isPeptideLetter(const string &peptides, const vector<Codon> &codonSheet);
bool printToLog(string input);
string threeLetterPeptideToLetterPeptide(const string &peptides, vector<Codon> codonSheet);
string letterPeptideToThreeLetterPeptide(const string &peptides, vector<Codon> codonSheet);
bool isDNA(const string &DNA);
bool isRNA(const string &RNA);
bool isNucleotide(const string &bases);
bool isPeptideLetter(const string &peptides, const vector<Codon> &codonSheet);
bool isPeptideThreeLetters(const string &peptides, const vector<Codon> &codonSheet);
string getTypes(const string &code, const vector<Codon> &codonSheet);
string getTypes(const string &code, vector<int> &types, const vector<Codon> &codonSheet);
bool isLoop(const string &one, const string &two);
string findAndReplace(string input, const string &searchFor, const string &replaceWith, int &start);
string findAndReplaceOnceThrough(string input, const string &searchFor, const string &replaceWith);
string findAndReplace(string input, const string &searchFor, const string &replaceWith, int &start);
string findAndReplaceAll(string input, const string &searchFor, const string &replaceWith);
/*
This program does have some errors. Temporary fixes have been implemented. For some reason, the number 204 keeps appearing in the output. This sometimes manafests itself as the ascii 204 character.
This was fixed with the lines:
if (tmpCodon.peptideName != "")
{
list.push_back(tmpCodon);
}
Please fix before stable release.
Also a similar problem was found with the codon sheet. The last entry seems to be a partially complete entry of the last complete entry. This was solved by:
if (peptideName != "")
{
codonSheet.push_back(tmp);
}
*/
int main(int argc, char* argv[])
{
vector<string> userConsoleArgs;
for (int i = 0; i < argc; i++)
{
string temp(argv[i]);
userConsoleArgs.push_back(temp);
}
return 1;
bool helpFlag = false;
bool errorFlag = false;
for (int i = 0; i < userConsoleArgs.size(); i++)
{
if(userConsoleArgs.compare("-o") && (i + 1) != userConsoleArgs.size())
{
}
}
if (argc >= 1)
bool error = 0;
string codonSheetLocation = "CodonDatabase.txt";
string DNAlocation = "DNAInput.txt";
string outputLocation = "DNAOutput.txt";
outputLocation = "CuratedOutput.txt";
cout << "Copyright(C) 2016. Mason Brothers. All Rights Reserved." << endl;
cout << "This program takes DNA and converts it to Proteins." << endl << endl;
vector<Codon> codonSheet = getCodonSheet(codonSheetLocation);
//printCodonSheetToConsole(codonSheet);
string DNA = getDNA(DNAlocation);
//string RNA = DNAtoRNA(DNA);
//cout << RNA << endl;
//printCodeToFile(DNA, outputLocation);
//printCodeToConsole(DNA);
//cout << "Error: " << error << endl << endl;
int minProteinSize = 100;
vector<Frame> bigFrames = getMinimumFrames(DNA, codonSheet, minProteinSize);
printFramesToConsole(bigFrames);
//printFramesToFile(bigFrames,"Frames.txt");
cout << "There where " << bigFrames.size() << " reading frames with or more than " << minProteinSize << " amino acids.";
cout << endl << endl;
/*
int start = 0;
string test = "123Tes121233est123";
string searchfor = "123";
string replaceWith = "";
//cout << findAndReplaceOnceThrough(test,searchfor,replaceWith) << endl;
cout << findAndReplaceAll(test,searchfor,replaceWith) << endl;
//cout << findAndReplace(test,searchfor,replaceWith,start) << endl;
*/
/*
vector<Paladrome> paladromes;
paladromes = findPaladromes(DNA, 2);
for (int i = 0; i < paladromes.size(); i++)
{
cout << paladromes.at(i).sequence << " (" << paladromes.at(i).start << ", " << paladromes.at(i).stop << ")" << endl;
}
cout << endl;
*/
//printMachineFramesToFile(bigFrames, "Stuff.txt");
//printFramesToConsole(bigFrames);
//vector<Peptide> peptides;
//cout << getStatistics(codonSheet, DNA, error, peptides);
//cout << getTypes(DNA, codonSheet) << endl;
/*
vector<Frame> someFrames = findMinFrames(Frames,100);
Frame test = someFrames.at(0);
*/
//string proteinString = "MKDLNNTKGNTKSEGSTERGNSGVDRGIVVPNTQIKMRFLNQVRYYSVNNNLKIGKDTNIELSKDTSTSDLLEFEKLVIDNINEENINNNLLSIIKNVDILILAYNRIKSKPGNITPGTTLETLDGINIIYLNKLSNELGTGKFKFKPMRIVNIPKPKGGIRPLSVGNPRDKIVQEVIRIILDTIFDKKISTHSHGFRKNISCQTAI";
//string proteinString = "MV";
//cout << proteinString << endl << getSequenceFromProtein(proteinString,peptides) << endl;
/*
forwardFrames = getFrames(sequence.str(),codonSheet);
printFramesToConsole(forwardFrames);
*/
cout << endl;
cout << "Error: " << error << endl << endl;
/*
int testNumber = 4;
int testCount = 0;
for (int i = 0; i < peptides.at(testNumber).bases.size(); i++)
{
cout << peptides.at(testNumber).bases.at(i).threeLetters << "\t" << peptides.at(testNumber).bases.at(i).number << endl;
testCount += peptides.at(testNumber).bases.at(i).number;
}
cout << endl << "testCount: " << testCount << endl;
cout << getRandomNumber(0, testCount, 1) << endl;
cout << getRandomNumber(0, testCount, 1) << endl;
cout << getRandomNumber(0, testCount, 1) << endl;
cout << getRandomNumber(0, testCount, 1) << endl;
cout << getRandomNumber(0, testCount, 1) << endl;
cout << getRandomNumber(0, testCount, 1) << endl;
cout << getRandomNumber(0, testCount, 1) << endl;
cout << getRandomNumber(0, testCount, 1) << endl;
cout << pickBase(peptides.at(testNumber).bases).threeLetters << endl;
cout << pickBase(peptides.at(testNumber).bases).threeLetters << endl;
cout << pickBase(peptides.at(testNumber).bases).threeLetters << endl;
cout << pickBase(peptides.at(testNumber).bases).threeLetters << endl;
cout << pickBase(peptides.at(testNumber).bases).threeLetters << endl;
cout << pickBase(peptides.at(testNumber).bases).threeLetters << endl;
cout << pickBase(peptides.at(testNumber).bases).threeLetters << endl;
cout << pickBase(peptides.at(testNumber).bases).threeLetters << endl;
cout << pickBase(peptides.at(testNumber).bases).threeLetters << endl;
cout << pickBase(peptides.at(testNumber).bases).threeLetters << endl;
cout << pickBase(peptides.at(testNumber).bases).threeLetters << endl;
cout << pickBase(peptides.at(testNumber).bases).threeLetters << endl;
cout << pickBase(peptides.at(testNumber).bases).threeLetters << endl;
cout << pickBase(peptides.at(testNumber).bases).threeLetters << endl;
cout << pickBase(peptides.at(testNumber).bases).threeLetters << endl;
cout << pickBase(peptides.at(testNumber).bases).threeLetters << endl;
cout << pickBase(peptides.at(testNumber).bases).threeLetters << endl;
cout << pickBase(peptides.at(testNumber).bases).threeLetters << endl;
cout << pickBase(peptides.at(testNumber).bases).threeLetters << endl;
cout << pickBase(peptides.at(testNumber).bases).threeLetters << endl;
*/
/*
Point one;
one.x = 7;
one.y = 7;
one.z = 7;
Point two;
two.x = 1;
two.y = 1;
two.z = 1;
Point three;
three.x = -10;
three.y = -10;
three.z = -10;
cout << measureAngle(one,two,three) << endl << measureDistance(one,two) << endl;
*/
//cout << rand() << "\t" << getRandomNumber(0,100,1) << endl;
cout << "End of the Program!" << endl;
return 0;
}
string motifToIUPAC(const string &input)
{
//Note: This will only work for DNA not proteins
string output = input;
output = findAndReplaceAll(output,"[AT]","W");
output = findAndReplaceAll(output,"[TA]","W");
output = findAndReplaceAll(output,"[CG]","S");
output = findAndReplaceAll(output,"[GC]","S");
output = findAndReplaceAll(output,"[AC]","M");
output = findAndReplaceAll(output,"[CA]","M");
output = findAndReplaceAll(output,"[GT]","K");
output = findAndReplaceAll(output,"[TG]","K");
output = findAndReplaceAll(output,"[AG]","R");
output = findAndReplaceAll(output,"[GA]","R");
output = findAndReplaceAll(output,"[CT]","Y");
output = findAndReplaceAll(output,"[TC]","Y");
output = findAndReplaceAll(output,"[CGT]","B");
output = findAndReplaceAll(output,"[CTG]","W");
output = findAndReplaceAll(output,"[TCG]","B");
output = findAndReplaceAll(output,"[T]","W");
}
string findAndReplaceAll(string input, const string &searchFor, const string &replaceWith)
{
string stringOne = input;
string stringTwo;
while (1)
{
stringTwo = findAndReplaceOnceThrough(stringOne, searchFor,replaceWith);
stringOne = findAndReplaceOnceThrough(stringTwo, searchFor,replaceWith);
if (stringOne==stringTwo)
{
return stringOne;
}
}
}
string findAndReplaceOnceThrough(string input, const string &searchFor, const string &replaceWith)
{
int start = 0;
string output;
for (int i = 0; i < input.size(); i++)
{
output = findAndReplace(input, searchFor, replaceWith, start);
if (output==input)
{
return output;
}
input = output;
start += replaceWith.size();
i = start;
}
return input;
}
string findAndReplace(string input, const string &searchFor, const string &replaceWith, int &start)
{
unsigned int first = input.find(searchFor,start);
if (string::npos == input.find(searchFor,start))
{
return input;
}
input.erase(first,searchFor.size());
input.insert(first,replaceWith);
start = first;
return input;
}
bool isLoop(const string &one, const string &two)
{
if (one.size()!=two.size())
{
return 0;
}
if (RNAtoDNA(one) == DNAantiCodon(flipString(RNAtoDNA(two))))
{
return 1;
}
return 0;
}
string getTypes(const string &code, const vector<Codon> &codonSheet)
{
vector<int> temp;
return getTypes(code, temp, codonSheet);
}
string getTypes(const string &code, vector<int> &types, const vector<Codon> &codonSheet)
{
ostringstream temp;
temp << "The code type(s) is/are: ";
if (isDNA(code))
{
temp << "DNA";
types.push_back(0);
}
if (isRNA(code))
{
if (types.size())
{
temp << ", ";
}
temp << "RNA";
types.push_back(1);
}
if (isNucleotide(code))
{
if (types.size())
{
temp << ", ";
}
temp << "Nucleotide";
types.push_back(2);
}
if (isPeptideLetter(code, codonSheet))
{
if (types.size())
{
temp << ", ";
}
temp << "Peptide";
types.push_back(3);
}
if (isPeptideThreeLetters(code, codonSheet))
{
if (types.size())
{
temp << ", ";
}
temp << "Peptide31";
types.push_back(4);
}
return temp.str();
}
bool printToLog(string input)
{
string fileLocation = "log.txt";
ofstream file;
file.open(fileLocation.c_str(), ios::out | ios::app);
if (file.fail())
{
return 0;
}
file << input << endl;
file.close();
return 1;
}
string threeLetterPeptideToLetterPeptide(const string &peptides, vector<Codon> codonSheet)
{
ostringstream sequence;
if(!isPeptideThreeLetters(peptides, codonSheet))
{
printToLog("Error: Does not contain all Peptides");
return "";
}
for (int i = 0; i < peptides.size(); i=i+3)
{
string tempString;
tempString.push_back(peptides.at(i));
tempString.push_back(peptides.at(i+1));
tempString.push_back(peptides.at(i+2));
for (int j = 0; j < codonSheet.size(); j++)
{
if (tempString==codonSheet.at(j).peptide3l)
{
sequence << codonSheet.at(j).peptide;
break;
}
}
}
return sequence.str();
}
string letterPeptideToThreeLetterPeptide(const string &peptides, vector<Codon> codonSheet)
{
ostringstream sequence;
string tempString;
if(!isPeptideLetter(peptides, codonSheet))
{
printToLog("Error: Does not contain all Peptides");
return "";
}
for (int i = 0; i < peptides.size(); i++)
{
for (int j = 0; j < codonSheet.size(); j++)
{
if (peptides.at(i)==codonSheet.at(j).peptide)
{
sequence << codonSheet.at(j).peptide3l;
break;
}
}
}
return sequence.str();
}
bool isDNA(const string &DNA)
{
for (int i = 0; i < DNA.size(); i++)
{
if (!(DNA.at(i)=='A' || DNA.at(i)=='T' || DNA.at(i) =='G' || DNA.at(i) =='C'))
{
return 0;
}
}
return 1;
}
bool isRNA(const string &RNA)
{
for (int i = 0; i < RNA.size(); i++)
{
if (!(RNA.at(i)=='A' || RNA.at(i)=='U' || RNA.at(i) =='G' || RNA.at(i) =='C'))
{
return 0;
}
}
return 1;
}
bool isNucleotide(const string &bases)
{
for (int i = 0; i < bases.size(); i++)
{
if (!(bases.at(i)=='A' || bases.at(i)=='T' || bases.at(i) =='G' || bases.at(i) =='C' || bases.at(i) =='U'))
{
return 0;
}
}
return 1;
}
bool isPeptideLetter(const string &peptides, const vector<Codon> &codonSheet)
{
for (int i = 0; i < peptides.size(); i++)
{
bool good = 0;
for (int j = 0; j < codonSheet.size(); j++)
{
if (peptides.at(i)==codonSheet.at(j).peptide)
{
good = 1;
}
}
if (good==0)
{
return 0;
}
}
return 1;
}
bool isPeptideThreeLetters(const string &peptides, const vector<Codon> &codonSheet)
{
if (!(peptides.size()%3==0))
{
return 0;
}
for (int i = 0; i < peptides.size(); i=i+3)
{
string tempString;
tempString.push_back(i);
tempString.push_back(i+1);
tempString.push_back(i+2);
bool good = 0;
for (int j = 0; j < codonSheet.size(); j++)
{
if (tempString==codonSheet.at(j).peptide3l)
{
good = 1;
}
}
if (good==0)
{
return 0;
}
}
return 1;
}
vector<Frame> getMinimumFrames(const string &DNA, const vector<Codon> &codonSheet, const unsigned int &minimumSize)
{
vector<Frame> forwardFrames = getFrames(DNA,codonSheet);
vector<Frame> reverseFrames = getFrames(DNAflipAntiString(DNA), codonSheet);
for (int i = 0; i < forwardFrames.size(); i++)
{
forwardFrames.at(i).marker = 0;
}
for (int i = 0; i < reverseFrames.size(); i++)
{
reverseFrames.at(i).marker = 1;
}
vector<Frame> Frames = mergeFrames(forwardFrames, reverseFrames);
vector<Frame> bigFrames = findMinFrames(Frames,minimumSize);
return bigFrames;
}
/* TO DO
-build counters
-amino
-nucleotides
-codons
-fix spliceSites stuff
-work on folding algorithm
-add prefix to header files
-find and replace
-replace "int" with "unsigned long int"
-openGL, openCL, openMP and Qt
*/
/*
Peptide getPeptideIUPACCodon(Peptide peptide)
{
for (int i = 0; i < peptide.bases.size(); i++)
{
string bases;
peptide.bases.at(i).threeLetters.at*
}
}
*/
void addMasters(vector<Peptide> &peptides)
{
for (int i = 0; i < peptides.size(); i++)
{
for (int j = 0; j < 3; j++)
{
vector<char> letters;
for (int k = 0; k < peptides.at(i).bases.size(); k++)
{
letters.push_back(peptides.at(i).bases.at(j).threeLetters.at(k));
}
//peptides.at(i).IUPACBases = getMasters(letters);
}
}
}
vector<char> getMasters(const vector<char> &characters)
{
char R = 0;
char Y = 0;
char K = 0;
char M = 0;
char S = 0;
char W = 0;
char B = 0;
char D = 0;
char H = 0;
char V = 0;
char N = 0;
vector<char> output;
for (int i = 0; i < characters.size(); i++)
{
if (isSubset('R',characters.at(i)))
{
R++;
}
if (isSubset('Y',characters.at(i)))
{
Y++;
}
if (isSubset('K',characters.at(i)))
{
K++;
}
if (isSubset('M',characters.at(i)))
{
M++;
}
if (isSubset('S',characters.at(i)))
{
S++;
}
if (isSubset('W',characters.at(i)))
{
W++;
}
if (isSubset('B',characters.at(i)))
{
B++;
}
if (isSubset('D',characters.at(i)))
{
D++;
}
if (isSubset('H',characters.at(i)))
{
H++;
}
if (isSubset('V',characters.at(i)))
{
V++;
}
if (isSubset('H',characters.at(i)))
{
V++;
}
}
if (R >= 2)
{
output.push_back('R');
}
if (Y >= 2)
{
output.push_back('Y');
}
if (K >= 2)
{
output.push_back('K');
}
if (M >= 2)
{
output.push_back('M');
}
if (S >= 2)
{
output.push_back('S');
}
if (W >= 2)
{
output.push_back('W');
}
if (B >= 3)
{
output.push_back('B');
}
if (D >= 3)
{
output.push_back('D');
}
if (H >= 3)
{
output.push_back('H');
}
if (V >= 3)
{
output.push_back('V');
}
if (N >= 4)
{
output.push_back('N');
}
return output;
}
char fromIUPAC(const char &large)
{
char small;
if (large == 'T' || large == 'U' || large == 'A' || large == 'C' || large == 'G')
{
small = large;
}
else if (large == 'R')
{
int random = getRandomNumber(0,1,1);
if (random==0)
{
small = 'A';
}
else if (random==1)
{
small = 'G';
}
}
else if (large == 'Y')
{
int random = getRandomNumber(0,1,1);
if (random==0)
{
small = 'C';
}
else if (random==1)
{
small = 'T';
}
}
else if (large == 'K')
{
int random = getRandomNumber(0,1,1);
if (random==0)
{
small = 'G';
}
else if (random==1)
{
small = 'T';
}
}
else if (large == 'M')
{
int random = getRandomNumber(0,1,1);
if (random==0)
{
small = 'A';
}
else if (random==1)
{
small = 'C';
}
}
else if (large == 'S')
{
int random = getRandomNumber(0,1,1);
if (random==0)
{
small = 'C';
}
else if (random==1)
{
small = 'G';
}
}
else if (large == 'W')
{
int random = getRandomNumber(0,1,1);
if (random==0)
{
small = 'A';
}
else if (random==1)
{
small = 'T';
}
}
else if (large == 'B')
{
int random = getRandomNumber(0,2,1);
if (random==0)
{
small = 'G';
}
else if (random==1)
{
small = 'T';
}
else if (random==2)
{
small = 'C';
}
}
else if (large == 'D')
{
int random = getRandomNumber(0,2,1);
if (random==0)
{
small = 'G';
}
else if (random==1)
{
small = 'T';
}
else if (random==2)
{
small = 'A';
}
}
else if (large == 'H')
{