cawlign 0.0.1
Codon-aware pairwise sequence alignment
Loading...
Searching...
No Matches
tn93_shared.h
1#ifndef __TN93SHARED__
2#define __TN93SHARED__
3
4#include <iostream>
5#include <cstdlib>
6#include <cstdio>
7#include <iomanip>
8#include <math.h>
9#include <string.h>
10#include <unistd.h>
11#include <climits>
12#include "stringBuffer.h"
13
14using namespace std;
15
16#define RESOLVE_A 0x01
17#define RESOLVE_C 0x02
18#define RESOLVE_G 0x04
19#define RESOLVE_T 0x08
20
21
22#define RESOLVE 0
23#define AVERAGE 1
24#define SKIP 2
25#define GAPMM 3
26#define SUBSET 4
27#define MISMATCH 5
28#define INFORMATIVE 6
29
30#define RAND_RANGE 0xffffffffUL /* Maximum value returned by genrand_int32 */
31
32#define MIN(a,b) (a) < (b) ? (a) : (b)
33#define MAX(a,b) (a) > (b) ? (a) : (b)
34
36
37 long first_nongap,
38 last_nongap,
39 resolved_start,
40 resolved_end;
41
43 first_nongap = LONG_MAX;
44 last_nongap = 0L;
45 resolved_start = 0L;
46 resolved_end = 0L;
47 }
48
49};
50
51void init_genrand(unsigned long s);
52unsigned long genrand_int32(void);
53double computeTN93 (const char * s1, const char *s2, const unsigned long L, const char matchMode, const long * randomize, const long min_overlap, unsigned long* = NULL, const double = 0.0, const unsigned long cnt = 0, const long count1 = 1, const long count2 = 1, const sequence_gap_structure * = NULL, const sequence_gap_structure * = NULL);
54
55long computeDifferences (const char * s1,
56 const char *s2,
57 const unsigned long L,
58 const char matchMode,
59 Vector& storage,
60 const sequence_gap_structure * = NULL,
61 const sequence_gap_structure * = NULL);
62
63
64long stringLength (Vector& lengths, unsigned long index);
65char* stringText (const StringBuffer& strings, const Vector& lengths, unsigned long index);
66void addASequenceToList (StringBuffer& sequences, Vector& seqLengths, long &firstSequenceLength, StringBuffer& names, Vector& nameLengths);
67int readFASTA (FILE* F, char& automatonState, StringBuffer &names, StringBuffer& sequences, Vector &nameLengths, Vector &seqLengths, long& firstSequenceLength, bool oneByOne = false, Vector* sequenceInstances = NULL, char sep = ':', double include_prob = 1.0, bool show_progress = false);
68void dump_sequence_fasta (unsigned long index, FILE* output, long firstSequenceLength, double * d = NULL, bool = false, unsigned long from = 0L, unsigned long to = 0L);
69void initAlphabets(bool = false, char * = NULL, bool id_map = false);
70void merge_two_sequences (const char* source, char* target, const long sequence_length);
71long perfect_match (const char* source, char* target, const long sequence_length);
72void dump_fasta (const char* source, const long sequence_length, FILE* output, bool newln = true, bool = false, unsigned long from = 0L, unsigned long to = 0L);
73
74int reverseComplement (StringBuffer& sequence, unsigned long from, unsigned long to);
75struct sequence_gap_structure describe_sequence (const char* source, const unsigned long sequence_length, const unsigned long char_count = 4UL);
76
77const long * resolve_char (unsigned char, bool = false, bool = true);
78const double resolution_count (unsigned char, bool = false);
79const char unmap_char (unsigned char, bool = false);
80inline void unpack_difference (long diff, long& location, unsigned& alt) {
81 location = diff >> 8;
82 alt = diff & 0xff;
83}
84
85
86extern StringBuffer names,
87 sequences;
88
89extern unsigned char * resolveTheseAmbigs;
90
91extern double resolve_fraction;
92
93extern Vector nameLengths,
94 seqLengths,
95 workingNodes,
96 nodeParents;
97
98extern VectorFP distanceEstimates;
99extern const double resolutionsCount [];
100extern char validFlags[];
101
102#endif
Definition stringBuffer.h:8
Definition stringBuffer.h:44
Definition stringBuffer.h:67
Definition tn93_shared.h:35