Files and I/O
Functions
-
float **get_ribosum(const char **Alseq, int n_seq, int length)
- #include <ViennaRNA/ribo.h>
Retrieve a RiboSum Scoring Matrix for a given Alignment.
-
float **readribosum(char *name)
- #include <ViennaRNA/ribo.h>
Read a RiboSum or other user-defined Scoring Matrix and Store into global Memory.
-
void vrna_file_copy(FILE *from, FILE *to)
- #include <ViennaRNA/io/utils.h>
Inefficient cp.
-
char *vrna_read_line(FILE *fp)
- #include <ViennaRNA/io/utils.h>
Read a line of arbitrary length from a stream.
Returns a pointer to the resulting string. The necessary memory is allocated and should be released using free() when the string is no longer needed.
- Parameters
fp – A file pointer to the stream where the function should read from
- Returns
A pointer to the resulting string
-
int vrna_mkdir_p(const char *path)
- #include <ViennaRNA/io/utils.h>
Recursivly create a directory tree.
-
char *vrna_basename(const char *path)
- #include <ViennaRNA/io/utils.h>
Extract the filename from a file path.
-
char *vrna_dirname(const char *path)
- #include <ViennaRNA/io/utils.h>
Extract the directory part of a file path.
-
char *vrna_filename_sanitize(const char *name, const char *replacement)
- #include <ViennaRNA/io/utils.h>
Sanitize a file name.
Returns a new file name where all invalid characters are substituted by a replacement character. If no replacement character is supplied, invalid characters are simply removed from the filename. File names may also never exceed a length of 255 characters. Longer file names will undergo a ‘smart’ truncation process, where the filenames suffix, i.e. everything after the last dot .’, is attempted to be kept intact. Hence, only the filename part before the suffix is reduced in such a way that the total filename complies to the length restriction of 255 characters. If no suffix is present or the suffix itself already exceeds the maximum length, the filename is simply truncated from the back of the string.
For now we consider the following characters invalid:
backslash ‘’
slash ‘/’
question mark ‘?’
percent sign ‘’
asterisk ‘*’
colon ‘:’
pipe symbol ‘|’
double quote ‘”’
triangular brackets ‘<’ and ‘>’
Furthermore, the (resulting) file name must not be a reserved file name, such as:
’.’
’..’
Note
This function allocates a new block of memory for the sanitized string. It also may return (a) NULL if the input is pointing to NULL, or (b) an empty string if the input only consists of invalid characters which are simply removed!
- Parameters
name – The input file name
replacement – The replacement character, or NULL
- Returns
The sanitized file name, or NULL
-
int vrna_file_exists(const char *filename)
- #include <ViennaRNA/io/utils.h>
Check if a file already exists in the file system.
- Parameters
filename – The name of (path to) the file to check for existence
- Returns
0 if it doesn’t exists, 1 otherwise
-
float **get_ribosum(const char **Alseq, int n_seq, int length)