Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- char nfunkcia(char pole[]){
- FILE *fr;
- if ((fr = fopen("DNAsekvencia.dat", "r")) == NULL) {
- printf("Neotvoreny subor\n");
- return 0;
- }
- char c;
- int i = 0;
- while ((c = getc(fr)) != EOF){
- if (c == 'A' || c == 'a' || c == 'C' || c == 'c' || c == 'G' || c == 'g' || c == 'T' || c == 't'){
- pole[i] = c;
- i++;
- }
- else if (c == ' ' || c == '\n') continue;
- else{
- printf("Sekvencia nesplna podmienky\n");
- return 0;
- }
- }
- printf("Sekvenciu sa podarilo nacitat\n");
- return pole;
- }
- void hist(char pole[]){
- int i;
- int ac = 0, cc = 0, gc = 0, tc = 0;
- if ((pole[0] == 'A') || (pole[0] == 'a') || (pole[0] == 'C') || (pole[0] == 'c') || (pole[0] == 'G') || (pole[0] == 'g') || (pole[0] == 'T') || (pole[0] == 't')){
- for (i = 0; i < MAX; i++){
- if ((pole[i] == 'A') || (pole[i] == 'a')){
- ac++;
- }
- else if ((pole[i] == 'C') || (pole[i] == 'c')){
- cc++;
- }
- else if ((pole[i] == 'G') || (pole[i] == 'g')){
- gc++;
- }
- else if ((pole[i] == 'T') || (pole[i] == 't')){
- tc++;
- }
- }
- printf("A: %d\n", ac);
- printf("C: %d\n", cc);
- printf("G: %d\n", gc);
- printf("T: %d\n", tc);
- }
- else printf("Sekvencia nie je nacitana\n");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement