1 #ifndef VIENNA_RNA_PACKAGE_COMMANDS_H 2 #define VIENNA_RNA_PACKAGE_COMMANDS_H 3 4 /** 5 * @file commands.h 6 * @ingroup utils, file_utils, command_files 7 * @brief Parse and apply different commands that alter the behavior of 8 * secondary structure prediction and evaluation 9 */ 10 11 /** 12 * @addtogroup command_files 13 * @{ 14 * @brief Functions to parse and interpret the content of @ref constraint-formats-file 15 */ 16 17 /** @brief A data structure that contains commands */ 18 typedef struct vrna_command_s *vrna_cmd_t; 19 20 21 #include <ViennaRNA/fold_compound.h> 22 23 /** 24 * @brief Command parse/apply flag indicating hard constraints 25 * @see #vrna_cmd_t, vrna_file_commands_read(), vrna_file_commands_apply(), vrna_commands_apply() 26 */ 27 #define VRNA_CMD_PARSE_HC 1U 28 /** 29 * @brief Command parse/apply flag indicating soft constraints 30 * @see #vrna_cmd_t, vrna_file_commands_read(), vrna_file_commands_apply(), vrna_commands_apply() 31 */ 32 #define VRNA_CMD_PARSE_SC 2U 33 /** 34 * @brief Command parse/apply flag indicating unstructured domains 35 * @see #vrna_cmd_t, vrna_file_commands_read(), vrna_file_commands_apply(), vrna_commands_apply() 36 */ 37 #define VRNA_CMD_PARSE_UD 4U 38 /** 39 * @brief Command parse/apply flag indicating structured domains 40 * @see #vrna_cmd_t, vrna_file_commands_read(), vrna_file_commands_apply(), vrna_commands_apply() 41 */ 42 #define VRNA_CMD_PARSE_SD 8U 43 /** 44 * @brief Command parse/apply flag indicating default set of commands 45 * @see #vrna_cmd_t, vrna_file_commands_read(), vrna_file_commands_apply(), vrna_commands_apply() 46 */ 47 #define VRNA_CMD_PARSE_DEFAULTS (VRNA_CMD_PARSE_HC \ 48 | VRNA_CMD_PARSE_SC \ 49 | VRNA_CMD_PARSE_UD \ 50 | VRNA_CMD_PARSE_SD \ 51 ) 52 53 #define VRNA_CMD_PARSE_SILENT 16U 54 55 /** 56 * @brief Extract a list of commands from a command file 57 * 58 * Read a list of commands specified in the input file 59 * and return them as list of abstract commands 60 * 61 * @see vrna_commands_apply(), vrna_file_commands_apply(), 62 * vrna_commands_free() 63 * 64 * @param filename The filename 65 * @param options Options to limit the type of commands read from the file 66 * @return A list of abstract commands 67 */ 68 vrna_cmd_t 69 vrna_file_commands_read(const char *filename, 70 unsigned int options); 71 72 73 /** 74 * @brief Apply a list of commands from a command file 75 * 76 * This function is a shortcut to directly parse a commands file 77 * and apply all successfully parsed commands to a #vrna_fold_compound_t 78 * data structure. It is the same as: 79 * @snippet commands.c Applying commands from file 80 * 81 * @param vc The #vrna_fold_compound_t the command list will be applied to 82 * @param filename The filename 83 * @param options Options to limit the type of commands read from the file 84 * @return The number of commands successfully applied 85 */ 86 int 87 vrna_file_commands_apply(vrna_fold_compound_t *vc, 88 const char *filename, 89 unsigned int options); 90 91 92 /** 93 * @brief Apply a list of commands to a #vrna_fold_compound_t 94 * 95 * @param vc The #vrna_fold_compound_t the command list will be applied to 96 * @param commands The commands to apply 97 * @param options Options to limit the type of commands read from the file 98 * @return The number of commands successfully applied 99 */ 100 int 101 vrna_commands_apply(vrna_fold_compound_t *vc, 102 vrna_cmd_t commands, 103 unsigned int options); 104 105 106 /** 107 * @brief Free memory occupied by a list of commands 108 * 109 * Release memory occupied by a list of commands 110 * @param commands A pointer to a list of commands 111 */ 112 void 113 vrna_commands_free(vrna_cmd_t commands); 114 115 116 /** 117 * @} 118 */ 119 120 #endif 121