Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <stdio.h>
- int main() {
- char x, y, a, b, c;
- long pozicija_X, pocetna_poz = 0;
- int br_Nukleoida = 0, br_Sekvenci = 0, max = 0;
- FILE *genetski_kod1 = fopen("genetski_kod.txt", "r");
- FILE *genetski_kod2 = fopen("genetski_kod.txt", "r");
- if(genetski_kod1 != NULL){
- if(genetski_kod2 != NULL){
- pozicija_X = 0;
- do{
- fseek(genetski_kod1, pozicija_X, SEEK_SET);
- fseek(genetski_kod2, pozicija_X + 3, SEEK_SET);
- br_Nukleoida = 0;
- br_Sekvenci = 0;
- do{
- x = getc(genetski_kod1);
- y = getc(genetski_kod2);
- if((x != 'A' && x != 'C' && x != 'T' && x != 'G' && x != EOF) ||
- (y != 'A' && y != 'C' && y != 'T' && y != 'G' && y != EOF)){
- printf("Pogresan format");
- return 0;
- }
- if(x == y){
- br_Nukleoida++;
- if (br_Nukleoida == 3) {
- br_Sekvenci++;
- br_Nukleoida = 0;
- }
- }
- else{
- br_Nukleoida = 0;
- break;
- }
- }while(y != EOF);
- if(br_Sekvenci > max){
- max = br_Sekvenci;
- pocetna_poz = pozicija_X;
- }
- pozicija_X++;
- }while(x != EOF);
- fseek(genetski_kod1, pocetna_poz, SEEK_SET);
- a = getc(genetski_kod1);
- b = getc(genetski_kod1);
- c = getc(genetski_kod1);
- if(a == EOF || b == EOF || c == EOF){
- printf("Pogresan format");
- return 0;
- }
- printf("%c%c%c", a, b, c);
- }
- else printf("Pogresan format");
- }
- else printf("Pogresan format");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement