Advertisement
Guest User

Untitled

a guest
Jan 19th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3.  
  4. int main() {
  5.  
  6. char x, y, a, b, c;
  7. long pozicija_X, pocetna_poz = 0;
  8. int br_Nukleoida = 0, br_Sekvenci = 0, max = 0;
  9.  
  10. FILE *genetski_kod1 = fopen("genetski_kod.txt", "r");
  11. FILE *genetski_kod2 = fopen("genetski_kod.txt", "r");
  12.  
  13. if(genetski_kod1 != NULL){
  14. if(genetski_kod2 != NULL){
  15.  
  16. pozicija_X = 0;
  17. do{
  18.  
  19. fseek(genetski_kod1, pozicija_X, SEEK_SET);
  20. fseek(genetski_kod2, pozicija_X + 3, SEEK_SET);
  21.  
  22. br_Nukleoida = 0;
  23. br_Sekvenci = 0;
  24.  
  25. do{
  26.  
  27. x = getc(genetski_kod1);
  28. y = getc(genetski_kod2);
  29.  
  30. if((x != 'A' && x != 'C' && x != 'T' && x != 'G' && x != EOF) ||
  31. (y != 'A' && y != 'C' && y != 'T' && y != 'G' && y != EOF)){
  32. printf("Pogresan format");
  33. return 0;
  34. }
  35.  
  36. if(x == y){
  37. br_Nukleoida++;
  38.  
  39. if (br_Nukleoida == 3) {
  40. br_Sekvenci++;
  41. br_Nukleoida = 0;
  42. }
  43.  
  44. }
  45. else{
  46. br_Nukleoida = 0;
  47. break;
  48. }
  49.  
  50. }while(y != EOF);
  51.  
  52. if(br_Sekvenci > max){
  53. max = br_Sekvenci;
  54. pocetna_poz = pozicija_X;
  55. }
  56.  
  57. pozicija_X++;
  58.  
  59. }while(x != EOF);
  60.  
  61. fseek(genetski_kod1, pocetna_poz, SEEK_SET);
  62.  
  63. a = getc(genetski_kod1);
  64. b = getc(genetski_kod1);
  65. c = getc(genetski_kod1);
  66.  
  67. if(a == EOF || b == EOF || c == EOF){
  68. printf("Pogresan format");
  69. return 0;
  70. }
  71.  
  72. printf("%c%c%c", a, b, c);
  73. }
  74. else printf("Pogresan format");
  75.  
  76. }
  77. else printf("Pogresan format");
  78.  
  79.  
  80. return 0;
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement