2 ###################################
3 # Access to RNAlib routines to #
4 # convert energy parameter files #
5 # from ViennaRNAPackage 1.8.4 to #
9 ###################################
19 #include "convert_epars.h"
20 #include "RNAparconv_cmdl.h"
22 int main(int argc, char *argv[]){
23 struct RNAparconv_args_info args_info;
24 char *ifileName, *ofileName;
28 ifileName = ofileName = NULL;
30 options = VRNA_CONVERT_OUTPUT_ALL;
33 #############################################
34 # check the command line parameters
35 #############################################
37 if(RNAparconv_cmdline_parser (argc, argv, &args_info) != 0) exit(1);
40 if(args_info.input_given) ifileName = strdup(args_info.input_arg);
42 if(args_info.output_given) ofileName = strdup(args_info.output_arg);
43 /* output without (special) hairpin energies + enthalpies */
44 if(args_info.without_HairpinE_given) options &= ~(VRNA_CONVERT_OUTPUT_HP
45 |VRNA_CONVERT_OUTPUT_SPECIAL_HP);
46 /* output without stacking energies + enthalpies */
47 if(args_info.without_StackE_given) options &= ~VRNA_CONVERT_OUTPUT_STACK;
48 /* output without 5' dangle energies + enthalpies */
49 if(args_info.without_Dangle5_given) options &= ~VRNA_CONVERT_OUTPUT_DANGLE5;
50 /* output without 3' dangle energies + enthalpies */
51 if(args_info.without_Dangle3_given) options &= ~VRNA_CONVERT_OUTPUT_DANGLE3;
52 /* output without interior loop energies + enthalpies */
53 if(args_info.without_IntE_given) options &= ~(VRNA_CONVERT_OUTPUT_NINIO
54 |VRNA_CONVERT_OUTPUT_INT
55 |VRNA_CONVERT_OUTPUT_INT_11
56 |VRNA_CONVERT_OUTPUT_INT_21
57 |VRNA_CONVERT_OUTPUT_INT_22);
58 /* output without bulge loop energies + enthalpies */
59 if(args_info.without_BulgeE_given) options &= ~VRNA_CONVERT_OUTPUT_BULGE;
60 /* output without multi loop energies + enthalpies */
61 if(args_info.without_MultiE_given) options &= ~VRNA_CONVERT_OUTPUT_ML;
62 /* output without misc energies + enthalpies */
63 if(args_info.without_Misc_given) options &= ~VRNA_CONVERT_OUTPUT_MISC;
64 /* output without hairpin mismatch energies + enthalpies */
65 if(args_info.without_MismatchH_given) options &= ~VRNA_CONVERT_OUTPUT_MM_HP;
66 /* output without interior loop mismatch energies + enthalpies */
67 if(args_info.without_MismatchI_given) options &= ~(VRNA_CONVERT_OUTPUT_MM_INT
68 |VRNA_CONVERT_OUTPUT_MM_INT_1N
69 |VRNA_CONVERT_OUTPUT_MM_INT_23);
70 /* output without multi loop mismatch energies + enthalpies */
71 if(args_info.without_MismatchM_given) options &= ~VRNA_CONVERT_OUTPUT_MM_MULTI;
72 /* output without exterior loop mismatch energies + enthalpies */
73 if(args_info.without_MismatchE_given) options &= ~VRNA_CONVERT_OUTPUT_MM_EXT;
75 /* output given energy parameters only */
76 if(args_info.vanilla_given) options |= VRNA_CONVERT_OUTPUT_VANILLA;
78 /* just dump Vienna 1.8.4 parameters in new format */
79 if(args_info.dump_given) options |= VRNA_CONVERT_OUTPUT_DUMP;
81 /* file names given as unnamed option? */
82 for(i = 0; i < args_info.inputs_num; i++){
83 if(ifileName == NULL) ifileName = strdup(args_info.inputs[i]);
84 else if(ofileName == NULL) ofileName = strdup(args_info.inputs[i]);
86 RNAparconv_cmdline_parser_print_help();
87 nrerror("unrecognized or too many parameter options given!");
92 if(args_info.silent_given) silent = 1;
94 /* free allocated memory of command line data structure */
95 RNAparconv_cmdline_parser_free (&args_info);
98 #############################################
100 #############################################
103 if(ifileName == NULL)
104 if(!(silent || (options & VRNA_CONVERT_OUTPUT_DUMP)))
105 fprintf(stdout, "Enter parameters:\n(Indicate last line of input parameters by typing \"# END\" or EOF\n\n");
107 convert_parameter_file(ifileName, ofileName, options);