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