File: qualityscores.h

package info (click to toggle)
mothur 1.48.5-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,676 kB
  • sloc: cpp: 161,854; makefile: 119; sh: 31
file content (75 lines) | stat: -rwxr-xr-x 2,079 bytes parent folder | download | duplicates (3)
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
#ifndef QUALITYSCORES
#define QUALITYSCORES

/*
 *  qualityscores.h
 *  Mothur
 *
 *  Created by Pat Schloss on 7/12/10.
 *  Copyright 2010 Schloss Lab. All rights reserved.
 *
 */

//DataStructure for a quality file.


#include "mothur.h"
#include "mothurout.h"
#include "sequence.hpp"
#include "utils.hpp"
#include "writer.h"

/**************************************************************************************************/

class QualityScores {
public:
	QualityScores();
    ~QualityScores() = default;
    QualityScores(string n, vector<int> qs);
	QualityScores(ifstream&);
    #ifdef USE_BOOST
    QualityScores(boost::iostreams::filtering_istream&);
    #endif
    int read(ifstream&);
	string getName();
	int getLength(){    return (int)qScores.size();  }
	//vector<int> getQualityScores() { return qScores; }
	void printQScores(ofstream&);
    void printQScores(ostream&);
    void printQScores(OutputWriter*);
	void trimQScores(int, int);
	void flipQScores();
	bool stripQualThreshold(Sequence&, double);
	bool stripQualRollingAverage(Sequence&, double, bool);
	bool stripQualWindowAverage(Sequence&, int, int, double, bool);
	bool cullQualAverage(Sequence&, double, bool);
	void updateQScoreErrorMap(map<char, vector<int> >&, string, int, int, int);
	void updateForwardMap(vector<vector<int> >&, int, int, int);
	void updateReverseMap(vector<vector<int> >&, int, int, int);
    void setName(string n);
    void setScores(vector<int> qs) { qScores = qs; seqLength = (int)qScores.size(); }
    vector<int> getScores() { return qScores; }

private:

	double calculateAverage(bool);
	double calculateExpectedErrors(void);
	MothurOut* m;
	vector<int> qScores;
    Utils util;

	string seqName;
	int seqLength;

    string getSequenceName(ifstream&);
    string getCommentString(ifstream&);

    #ifdef USE_BOOST
    string getCommentString(boost::iostreams::filtering_istream&);
    string getSequenceName(boost::iostreams::filtering_istream&);
    #endif
};

/**************************************************************************************************/

#endif