1 #ifndef chime_h
2 #define chime_h
3 
4 #include "seq.h"
5 
6 struct ChimeHit2
7 	{
8 	string QLabel;
9 	string ALabel;
10 	string BLabel;
11 	string Q3;
12 	string A3;
13 	string B3;
14 
15 	//unsigned LY, LN, LA, LD;
16 	//unsigned RY, RN, RA, RD;
17 	double PctIdQT, PctIdQA, PctIdQB, PctIdQM, PctIdAB;
18 
19 	unsigned ColLo;
20 	unsigned ColXLo;
21 	unsigned ColXHi;
22 	unsigned ColHi;
23 	unsigned QXLo;
24 	unsigned QXHi;
25 
26 	double Div;
27 	double Score;
28 	double H;
29 
30 	unsigned CS_LY, CS_LN, CS_LA, CS_RY, CS_RN, CS_RA;
31 
32 	float AbQ;
33 	float AbA;
34 	float AbB;
35 
ChimeHit2ChimeHit236 	ChimeHit2()
37 		{
38 		Clear();
39 		}
40 
ClearChimeHit241 	void Clear()
42 		{
43 		Q3.clear();
44 		A3.clear();
45 		B3.clear();
46 		QLabel.clear();
47 		ALabel.clear();
48 		BLabel.clear();
49 
50 		//LY = LN = LA = LD = UINT_MAX;
51 		//RY = RN = RA = RD = UINT_MAX;
52 		ColLo = ColHi = QXLo = QXHi = ColXLo = ColXHi = UINT_MAX;
53 		CS_LY = CS_LN = CS_LA = CS_RY = CS_RN = CS_RA = UINT_MAX;
54 		PctIdQT = PctIdQA = PctIdQB = PctIdQM = PctIdAB = -1.0;
55 		Div = -1.0;
56 		H = -1.0;
57 		Score = -1.0;
58 		AbQ = AbA = AbB = -1.0f;
59 		};
60 
AcceptChimeHit261 	bool Accept() const
62 		{
63 		return Score >= opt_minh && Div >= opt_mindiv && CS_LY >= opt_mindiffs && CS_RY >= opt_mindiffs;
64 		}
65 
LogMeChimeHit266 	void LogMe() const
67 		{
68 		Log("@L %c ", yon(Score >= 1.0 && Div >= 1.0));
69 		Log(" %.4f", Score);
70 		Log(" LY %u LN %u LA %u", CS_LY, CS_LN, CS_LA);
71 		Log(" RY %u RN %u RA %u", CS_RY, CS_RN, CS_RA);
72 		Log(" Div %.1f%%", Div);
73 		Log(" Q=%s", QLabel.c_str());
74 		Log(" A=%s", ALabel.c_str());
75 		Log(" B=%s", BLabel.c_str());
76 		Log(" QA %.1f%% QB=%.1f%% AB=%.1f%% QM=%.1f%%", PctIdQA, PctIdQB, PctIdAB, PctIdQM);
77 		Log("\n");
78 		}
79 
80 	bool operator<(const ChimeHit2 &rhs) const
81 		{
82 		if (Score == rhs.Score)
83 			return Div > rhs.Div;
84 		return Score > rhs.Score;
85 		}
86 	};
87 
isacgt(char c)88 static inline bool isacgt(char c)
89 	{
90 	return c == 'A' || c == 'C' || c == 'G' || c == 'T';
91 	}
92 
isgap(char c)93 static bool inline isgap(char c)
94 	{
95 	return c == '-' || c == '.';
96 	}
97 
98 void GetChunkInfo(unsigned L, unsigned &Length, vector<unsigned> &Los);
99 float GetAbFromLabel(const string &Label);
100 void WriteChimeHitCS(FILE *f, const ChimeHit2 &Hit);
101 void WriteChimeHit(FILE *f, const ChimeHit2 &Hit);
102 void WriteChimeFileHdr(FILE *f);
103 
104 #endif // chime_h
105