File: out.h

package info (click to toggle)
mothur 1.48.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 13,684 kB
  • sloc: cpp: 161,854; makefile: 122; sh: 31
file content (134 lines) | stat: -rwxr-xr-x 3,248 bytes parent folder | download | duplicates (9)
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#ifndef out_h
#define out_h

#include "seq.h"
#include "hsp.h"
#include "orf.h"
#include "path.h"
#include <float.h>

struct AlnData
	{
/***
SA.Seq and SB.Seq align.
Reverse strand stuff for nucleotides is handled like this:
	SA.RevComp must be false.
	If SB.RevComp is true, then SA.Seq is r.c.'d relative to the sequence in
	the input file (query or db). If so, coordinates in HSP refer to SB.Seq
	so are also r.c.'d relative to the original sequence.
***/
	SeqData SA;
	SeqData SB;
	HSPData HSP;
	const char *Path;
	char IdDesc[256];

	float FractId;
	float RawScore;
	float BitScore;
	float Evalue;

	void LogMe() const
		{
		Log("AD: ");
		HSP.LogMe();
		Log(" %s,%s\n", SA.Label, SB.Label);
		}
	};

bool OnDerepHit(const SeqData &SA, const SeqData &SB);

bool OnLocalUngappedHit(const SeqData &SA, const SeqData &SB,
  const HSPData &HSP, float &Evalue, float &FractId);

bool OnLocalGappedHit(const SeqData &SA, const SeqData &SB,
  const HSPData &HSP, const PathData &PD, float &Evalue, float &FractId);

bool OnGlobalHit(const SeqData &SA, const SeqData &SB, const PathData &PD,
  float &FractId);

void OnReject(const SeqData &SA, const SeqData &SB, double FractId,
  const char *Path);

void OnNotMatched(const char *Label, unsigned L);
void OnNewCluster(unsigned ClusterIndex, const char *Label, unsigned L);
void OnNewLibCluster(unsigned ClusterIndex, const char *Label, unsigned L);
void OnLibCluster(unsigned ClusterIndex, unsigned Size, double AvgId,
  const char *Label);
void OnNewCluster(unsigned ClusterIndex, unsigned Size, double AvgId,
  const char *Label);
void OnChainCov(const SeqData &NucleoSD, const SeqData &TargetSD,
  float Score, float ChainCov);

void SetUserFieldIndexes(const string &s);

void BlastOut(FILE *f, const AlnData &AD);
void Blast6Out(FILE *f, const AlnData &AD);
void FastaPairOut(FILE *f, const AlnData &AD);
void UserOut(FILE *f, const AlnData &AD);

void BlastOutORF(FILE *f, const AlnData &AD);

void OpenOutputFiles();
void CloseOutputFiles();
void SetLibSeedCount(unsigned DBSeqCount);
const char *UserFieldIndexToStr(unsigned i);

extern float **g_SubstMx;

static char g_IdChar = '|';
static char g_DiffChar = ' ';

static inline char GetSymN(byte Letter1, byte Letter2)
	{
	Letter1 = toupper(Letter1);
	Letter2 = toupper(Letter2);
	if (Letter1 == Letter2)
		return g_IdChar;
	return g_DiffChar;
	}

static inline char GetSymA(byte Letter1, byte Letter2)
	{
	Letter1 = toupper(Letter1);
	Letter2 = toupper(Letter2);
	if (Letter1 == Letter2)
		return '|';

	float Score = g_SubstMx[Letter1][Letter2];
	if (Score >= 2.0f)
		return ':';
	if (Score > 0.0f)
		return '.';
	return ' ';
	}

static inline char GetSym(byte Letter1, byte Letter2, bool Nucleo)
	{
	if (Nucleo)
		return GetSymN(Letter1, Letter2);
	else
		return GetSymA(Letter1, Letter2);
	}

static unsigned GetNDig(unsigned n)
	{
	if (n < 10)
		return 1;
	if (n < 100)
		return 2;
	if (n < 1000)
		return 3;
	if (n < 10000)
		return 4;
	if (n < 100000)
		return 5;
	if (n < 1000000)
		return 6;
	return 10;
	}

extern unsigned *g_UserFieldIndexes;
extern unsigned g_UserFieldCount;

#endif // out_h