libuproc  1.2.0
ecurve.h
Go to the documentation of this file.
1 /* Copyright 2014 Peter Meinicke, Robin Martinjak
2  *
3  * This file is part of libuproc.
4  *
5  * libuproc is free software: you can redistribute it and/or modify it under
6  * the terms of the GNU Lesser General Public License as published by the Free
7  * Software Foundation, either version 3 of the License, or (at your option)
8  * any later version.
9  *
10  * libuproc is distributed in the hope that it will be useful, but WITHOUT ANY
11  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with libuproc. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
30 #ifndef UPROC_ECURVE_H
31 #define UPROC_ECURVE_H
32 
33 #include <stdio.h>
34 #include <stdarg.h>
35 
36 #include "uproc/alphabet.h"
37 #include "uproc/io.h"
38 #include "uproc/list.h"
39 #include "uproc/word.h"
40 
53 typedef struct uproc_ecurve_s uproc_ecurve;
54 
61 {
64 
67 };
68 
73 
76 };
77 
79 enum {
82 
85 
88 };
89 
96 uproc_ecurve *uproc_ecurve_create(const char *alphabet, size_t suffix_count);
97 
100 
145  uproc_list *suffixes);
146 
154 
179 int uproc_ecurve_lookup(const uproc_ecurve *ecurve,
180  const struct uproc_word *word,
181  struct uproc_word *lower_neighbour,
182  uproc_family *lower_class,
183  struct uproc_word *upper_neighbour,
184  uproc_family *upper_class);
185 
188 
195  uproc_io_stream *stream);
196 
197 uproc_ecurve *uproc_ecurve_loadps(enum uproc_ecurve_format format,
198  void (*progress)(double),
199  uproc_io_stream *stream);
200 
216  enum uproc_io_type iotype, const char *pathfmt,
217  ...);
218 
225  enum uproc_io_type iotype,
226  void (*progress)(double), const char *pathfmt,
227  ...);
228 
235  enum uproc_io_type iotype, const char *pathfmt,
236  va_list ap);
237 
244  enum uproc_io_type iotype,
245  void (*progress)(double), const char *pathfmt,
246  va_list ap);
247 
253 int uproc_ecurve_stores(const uproc_ecurve *ecurve,
254  enum uproc_ecurve_format format,
255  uproc_io_stream *stream);
256 
262 int uproc_ecurve_storeps(const uproc_ecurve *ecurve,
263  enum uproc_ecurve_format format,
264  void (*progress)(double), uproc_io_stream *stream);
265 
280 int uproc_ecurve_store(const uproc_ecurve *ecurve,
281  enum uproc_ecurve_format format,
282  enum uproc_io_type iotype, const char *pathfmt, ...);
283 
289 int uproc_ecurve_storep(const uproc_ecurve *ecurve,
290  enum uproc_ecurve_format format,
291  enum uproc_io_type iotype, void (*progress)(double),
292  const char *pathfmt, ...);
293 
299 int uproc_ecurve_storev(const uproc_ecurve *ecurve,
300  enum uproc_ecurve_format format,
301  enum uproc_io_type iotype, const char *pathfmt,
302  va_list ap);
303 
309 int uproc_ecurve_storepv(const uproc_ecurve *ecurve,
310  enum uproc_ecurve_format format,
311  enum uproc_io_type iotype, void (*progress)(double),
312  const char *pathfmt, va_list ap);
313 
322 uproc_ecurve *uproc_ecurve_mmap(const char *pathfmt, ...);
323 
329 uproc_ecurve *uproc_ecurve_mmapv(const char *pathfmt, va_list ap);
330 
335 void uproc_ecurve_munmap(uproc_ecurve *ecurve);
336 
345 int uproc_ecurve_mmap_store(const uproc_ecurve *ecurve, const char *pathfmt,
346  ...);
347 
353 int uproc_ecurve_mmap_storev(const uproc_ecurve *ecurve, const char *pathfmt,
354  va_list ap);
361 #endif
int uproc_ecurve_mmap_store(const uproc_ecurve *ecurve, const char *pathfmt,...)
Store ecurve in a format suitable for uproc_ecurve_mmap()
uproc_family family
Protein family.
Definition: ecurve.h:66
int uproc_ecurve_storev(const uproc_ecurve *ecurve, enum uproc_ecurve_format format, enum uproc_io_type iotype, const char *pathfmt, va_list ap)
Store ecurve to file.
int uproc_ecurve_storep(const uproc_ecurve *ecurve, enum uproc_ecurve_format format, enum uproc_io_type iotype, void(*progress)(double), const char *pathfmt,...)
Store ecurve to file.
int uproc_ecurve_lookup(const uproc_ecurve *ecurve, const struct uproc_word *word, struct uproc_word *lower_neighbour, uproc_family *lower_class, struct uproc_word *upper_neighbour, uproc_family *upper_class)
Find the closest neighbours of a word in the ecurve.
int uproc_ecurve_stores(const uproc_ecurve *ecurve, enum uproc_ecurve_format format, uproc_io_stream *stream)
Store ecurve to stream.
List of homogenous items (also known as "vector" or "arraylist")
uproc_ecurve * uproc_ecurve_loadpv(enum uproc_ecurve_format format, enum uproc_io_type iotype, void(*progress)(double), const char *pathfmt, va_list ap)
Load ecurve from file.
int uproc_ecurve_mmap_storev(const uproc_ecurve *ecurve, const char *pathfmt, va_list ap)
Store ecurve to mmap file.
Amino acid alphabet.
uproc_ecurve * uproc_ecurve_create(const char *alphabet, size_t suffix_count)
Create ecurve object.
Out of bounds.
Definition: ecurve.h:87
No exact match.
Definition: ecurve.h:84
Module: Amino acid translation alphabets.
void uproc_ecurve_destroy(uproc_ecurve *ecurve)
Destroy ecurve object.
Module: General IO.
uproc_ecurve * uproc_ecurve_mmap(const char *pathfmt,...)
Map a file to an ecurve.
int uproc_ecurve_storepv(const uproc_ecurve *ecurve, enum uproc_ecurve_format format, enum uproc_io_type iotype, void(*progress)(double), const char *pathfmt, va_list ap)
Store ecurve to file.
uproc_ecurve * uproc_ecurve_loadv(enum uproc_ecurve_format format, enum uproc_io_type iotype, const char *pathfmt, va_list ap)
Load ecurve from file.
uproc_ecurve * uproc_ecurve_mmapv(const char *pathfmt, va_list ap)
Store ecurve to file.
Module: List.
int uproc_ecurve_add_prefix(uproc_ecurve *ecurve, uproc_prefix pfx, uproc_list *suffixes)
Add a prefix entry.
uint_least64_t uproc_suffix
Type for suffixes.
Definition: common.h:84
uproc_ecurve * uproc_ecurve_loadp(enum uproc_ecurve_format format, enum uproc_io_type iotype, void(*progress)(double), const char *pathfmt,...)
Load ecurve from file.
Machine-dependent binary format.
Definition: ecurve.h:75
int uproc_ecurve_storeps(const uproc_ecurve *ecurve, enum uproc_ecurve_format format, void(*progress)(double), uproc_io_stream *stream)
Store ecurve to stream.
Module: Amino acid words.
int uproc_ecurve_finalize(uproc_ecurve *ecurve)
Finalize ecurve.
uproc_suffix suffix
Suffix.
Definition: ecurve.h:63
uproc_ecurve_format
Storage format.
Definition: ecurve.h:70
Portable plain text file.
Definition: ecurve.h:72
Optionally compressed I/O stream.
uint_least32_t uproc_prefix
Type for prefixes.
Definition: common.h:65
Evolutionary Curve.
uproc_ecurve * uproc_ecurve_loads(enum uproc_ecurve_format format, uproc_io_stream *stream)
Load ecurve from stream.
int uproc_ecurve_store(const uproc_ecurve *ecurve, enum uproc_ecurve_format format, enum uproc_io_type iotype, const char *pathfmt,...)
Store ecurve to file.
Amino acid word.
Definition: word.h:45
uint_least16_t uproc_family
Identifier of a protein family.
Definition: common.h:93
Exact match.
Definition: ecurve.h:81
uproc_ecurve * uproc_ecurve_load(enum uproc_ecurve_format format, enum uproc_io_type iotype, const char *pathfmt,...)
Load ecurve from file.
Pair of suffix and family.
Definition: ecurve.h:60
uproc_alphabet * uproc_ecurve_alphabet(const uproc_ecurve *ecurve)
Return the internal alphabet.
void uproc_ecurve_munmap(uproc_ecurve *ecurve)
Release mapping and close the underlying file descriptor.
uproc_io_type
Underlying stream type.
Definition: io.h:59