1 #include <stdlib.h> 2 #include <stdio.h> 3 4 #include <ViennaRNA/fold_compound.h> 5 #include <ViennaRNA/utils/basic.h> 6 #include <ViennaRNA/utils/strings.h> 7 #include <ViennaRNA/mfe.h> 8 9 10 int main()11main() 12 { 13 /* initialize random number generator */ 14 vrna_init_rand(); 15 16 /* Generate a random sequence of 50 nucleotides */ 17 char *seq = vrna_random_string(50, "ACGU"); 18 19 /* Create a fold compound for the sequence */ 20 vrna_fold_compound_t *fc = vrna_fold_compound(seq, NULL, VRNA_OPTION_DEFAULT); 21 22 /* allocate memory for MFE structure (length + 1) */ 23 char *structure = (char *)vrna_alloc(sizeof(char) * (strlen(seq) + 1)); 24 25 /* predict Minmum Free Energy and corresponding secondary structure */ 26 float mfe = vrna_mfe(fc, structure); 27 28 /* print sequence, structure and MFE */ 29 printf("%s\n%s [ %6.2f ]\n", seq, structure, mfe); 30 31 /* cleanup memory */ 32 free(seq); 33 free(structure); 34 vrna_fold_compound_free(fc); 35 36 return 0; 37 } 38