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