]> git.donarmstrong.com Git - mothur.git/blob - seqerrorcommand.h
added threshold parameter to make.contigs command.
[mothur.git] / seqerrorcommand.h
1 #ifndef SEQERRORCOMMAND
2 #define SEQERRORCOMMAND
3
4 /*
5  *  seqerrorcommand.h
6  *  Mothur
7  *
8  *  Created by Pat Schloss on 7/15/10.
9  *  Copyright 2010 Schloss Lab. All rights reserved.
10  *
11  */
12
13 #include "command.hpp"
14 #include "sequence.hpp"
15 #include "referencedb.h"
16
17
18 class SeqErrorCommand : public Command {
19 public:
20         SeqErrorCommand(string);
21         SeqErrorCommand();
22         ~SeqErrorCommand(){}
23         
24         vector<string> setParameters();
25         string getCommandName()                 { return "seq.error";                           }
26         string getCommandCategory()             { return "Sequence Processing";         }
27         string getHelpString(); 
28         string getCitation() { return "http://www.mothur.org/wiki/Seq.error"; }
29         string getDescription()         { return "seq.error"; }
30
31         
32         int execute(); 
33         void help() { m->mothurOut(getHelpString()); }  
34         
35 private:
36         bool abort;
37         ReferenceDB* rdb;
38         
39         struct linePair {
40                 unsigned long long start;
41                 unsigned long long end;
42                 linePair(unsigned long long i, unsigned long long j) : start(i), end(j) {}
43         ~linePair(){}
44         };
45         
46     struct Compare {
47         int AA, AT, AG, AC,     TA, TT, TG, TC, GA, GT, GG, GC, CA, CT, CG, CC, NA, NT, NG, NC, Ai, Ti, Gi, Ci, Ni, dA, dT, dG, dC;
48         string refName, queryName, sequence;
49         double errorRate;
50         int weight, matches, mismatches, total;
51         
52         Compare(){
53             AA=0; AT=0; AG=0; AC=0;
54             TA=0; TT=0; TG=0; TC=0;
55             GA=0; GT=0; GG=0; GC=0;
56             CA=0; CT=0; CG=0; CC=0;
57             NA=0; NT=0; NG=0; NC=0;
58             Ai=0; Ti=0; Gi=0; Ci=0; Ni=0;
59             dA=0; dT=0; dG=0; dC=0;
60             refName = "";
61             queryName = "";
62             weight = 1;
63             matches = 0;
64             mismatches = 0;
65             total = 0;
66             errorRate = 1.0000;
67             sequence = "";
68         }
69         ~Compare(){};
70     };
71
72         vector<int> processIDS;   //processid
73         vector<linePair> lines;
74         vector<linePair> qLines;
75         vector<linePair> rLines;
76
77         void getReferences();
78         map<string,int> getWeights();
79         int getErrors(Sequence, Sequence, Compare&);
80         void printErrorHeader(ofstream&);
81         void printErrorData(Compare, int, ofstream&, ofstream&);
82         void printSubMatrix();
83         void printErrorFRFile(map<char, vector<int> >, map<char, vector<int> >);
84         void printErrorQuality(map<char, vector<int> >);
85         void printQualityFR(vector<vector<int> >, vector<vector<int> >);
86         
87         int setLines(string, string, string, vector<unsigned long long>&, vector<unsigned long long>&, vector<unsigned long long>&);
88         int driver(string, string, string, string, string, string, linePair, linePair, linePair);
89         int createProcesses(string, string, string, string, string, string);
90
91         string queryFileName, referenceFileName, qualFileName, reportFileName, namesFileName, outputDir;
92         double threshold;
93         bool ignoreChimeras, save;
94         int numRefs, processors;
95         int maxLength, totalBases, totalMatches;
96         //ofstream errorSummaryFile, errorSeqFile;
97         vector<string> outputNames;
98         
99         vector<Sequence> referenceSeqs;
100         vector<vector<int> > substitutionMatrix;
101         vector<vector<int> > qualForwardMap;
102         vector<vector<int> > qualReverseMap;
103         vector<int> misMatchCounts;
104         map<char, vector<int> > qScoreErrorMap;
105         map<char, vector<int> > errorForward;
106         map<char, vector<int> > errorReverse;
107         map<string, int> weights;
108         vector<string> megaAlignVector;
109
110 };
111
112 #endif