]> git.donarmstrong.com Git - mothur.git/blob - bellerophon.h
added modify names parameter to set.dir
[mothur.git] / bellerophon.h
1 #ifndef BELLEROPHON_H
2 #define BELLEROPHON_H
3
4 /*
5  *  bellerophon.h
6  *  Mothur
7  *
8  *  Created by Sarah Westcott on 7/9/09.
9  *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
10  *
11  */
12
13
14 #include "chimera.h"
15 #include "sparsematrix.hpp"
16 #include "sequence.hpp"
17 #include "dist.h"
18
19 typedef list<PCell>::iterator MatData;
20 typedef map<int, float> SeqMap;  //maps sequence to all distance for that seqeunce
21
22 /***********************************************************/
23
24 class Bellerophon : public Chimera {
25         
26         public:
27                 Bellerophon(string, bool, bool, int, int, int, string); //fastafile, filter, correction, window, increment, processors, outputDir);     
28                 ~Bellerophon() { delete distCalculator; for (int i = 0; i < seqs.size(); i++) { delete seqs[i];  }  seqs.clear(); }
29                 
30                 int getChimeras();
31                 int print(ostream&, ostream&, string);
32                 
33                 #ifdef USE_MPI
34                 int print(MPI_File&, MPI_File&, string);
35                 #endif
36                 
37         private:
38                 struct linePair {
39                         unsigned long long start;
40                         int num;
41                         linePair(unsigned long long i, int j) : start(i), num(j) {}
42                 };
43                 
44                 vector<linePair> lines;
45         
46                 Dist* distCalculator;
47                 vector<Sequence*> seqs;
48                 vector< vector<Preference> > pref; //pref[0] = preference scores for all seqs in window 0.
49                 string fastafile;
50                 int iters, count, window, increment, numSeqs, processors; //iters = number of windows
51                 bool correction;
52                 
53                 int generatePreferences(vector<SeqMap>, vector<SeqMap>, int);
54                 int createSparseMatrix(int, int, SparseMatrix*, vector<Sequence>);
55                 vector<Preference> getBestPref();
56                 int driverChimeras(vector<int>, linePair);
57                 int createProcesses(vector<int>);
58                 int writePrefs(string, linePair);
59                 int readPrefs(string);
60                 vector<string> getBestWindow(linePair line);
61                 int fillPref(int, vector<string>&);
62 };
63
64 /***********************************************************/
65
66 #endif
67