This repository has been archived by the owner on Feb 27, 2023. It is now read-only.
forked from hallamlab/FragGeneScanPlus
-
Notifications
You must be signed in to change notification settings - Fork 3
/
util_lib.h
87 lines (71 loc) · 1.91 KB
/
util_lib.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/**
* @file util_lib.h
*/
#ifndef __UTIL_LIB_H
#define __UTIL_LIB_H
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include "hmm.h"
double **dmatrix(int num_col);
int **imatrix(int num_col);
int *ivector(int nh);
void free_dmatrix(double **m);
void free_imatrix(int **m);
/**
* Parses the given string into a HMM_StateTransition.
*/
HMM_StateTransition hmm_state_transition_parse (const char *nt);
/**
* Parses the given character as a nucleotide.
*/
Nucleotide nucleotide_parse (char nt);
/**
* Returns the reverse complement of the given nucleotide.
*/
Nucleotide nucleotide_complement (Nucleotide nt);
/**
* Returns the trinucleotide from combining the given nucleotides.
*/
int trinucleotide (Nucleotide a, Nucleotide b, Nucleotide c);
/**
* Translates the given DNA sequence.
*
* @param dna The sequence we want to translate.
* @param dna The length of the sequence.
* @param[out] protein The output buffer for the protein.
* @param strand What strand to translate.
*/
void get_protein(const Nucleotide dna[], int dna_len, char *protein, Strand strand, const char * translation_table, const char * translation_table_rc);
/**
* A queue for worker thread buffers.
*/
typedef struct BufferQueue {
/** The next thread in the queue */
struct BufferQueue *next;
/** The worker thread */
ThreadData *td;
/** The specific buffer */
unsigned int buffer;
} QUEUE;
/**
* Prints out the contents of the given buffer.
*/
void printq(unsigned int which);
/**
* Enqueues the given worker thread's buffer to the given queue
*/
void enqueue(ThreadData *td, unsigned int buffer, unsigned int which);
/**
* Dequeues the first element of the given queue.
*/
QUEUE *deq(unsigned int which);
/**
* Loads the requested queue into the first arguments' address.
*/
void cutnpaste_q(QUEUE **dest, unsigned int which);
/**
* A lazy version of memset().
*/
void stopMemset(char *ptr, int length);
#endif