1 #include <stdlib.h> 2 #include <stdio.h> 3 #include <string.h> 4 5 #include <ViennaRNA/model.h> 6 #include <ViennaRNA/fold_compound.h> 7 #include <ViennaRNA/utils/basic.h> 8 #include <ViennaRNA/utils/strings.h> 9 #include <ViennaRNA/mfe.h> 10 11 int main()12main() 13 { 14 /* initialize random number generator */ 15 vrna_init_rand(); 16 17 /* Generate a random sequence of 50 nucleotides */ 18 char *seq = vrna_random_string(50, "ACGU"); 19 20 /* allocate memory for MFE structure (length + 1) */ 21 char *structure = (char *)vrna_alloc(sizeof(char) * (strlen(seq) + 1)); 22 23 /* create a new model details structure to store the Model Settings */ 24 vrna_md_t md; 25 26 /* ALWAYS set default model settings first! */ 27 vrna_md_set_default(&md); 28 29 /* change temperature and activate G-Quadruplex prediction */ 30 md.temperature = 25.0; /* 25 Deg Celcius */ 31 md.gquad = 1; /* Turn-on G-Quadruples support */ 32 33 /* create a fold compound */ 34 vrna_fold_compound_t *fc = vrna_fold_compound(seq, &md, VRNA_OPTION_DEFAULT); 35 36 /* predict Minmum Free Energy and corresponding secondary structure */ 37 float mfe = vrna_mfe(fc, structure); 38 39 /* print sequence, structure and MFE */ 40 printf("%s\n%s [ %6.2f ]\n", seq, structure, mfe); 41 42 /* cleanup memory */ 43 free(structure); 44 vrna_fold_compound_free(fc); 45 46 return 0; 47 } 48