8 * Created by westcott on 1/13/10.
9 * Copyright 2010 Schloss Lab. All rights reserved.
14 #include "listvector.hpp"
15 #include "nameassignment.hpp"
16 #include "counttable.h"
19 //**********************************************************************************************************************
20 // This class takes a distance matrix file and converts it to a file where each row contains all distances below the cutoff
21 // for a given sequence.
33 0 4 1 0.01 2 0.015 3 0.03 4 0.04
34 1 4 0 0.01 2 0.03 3 0.02 4 0.05
35 2 4 0 0.015 1 0.03 3 0.02 4 0.03
36 3 4 0 0.03 1 0.02 2 0.02 4 0.02
37 4 4 0 0.04 1 0.05 2 0.03 3 0.02
39 column 1 - sequence name converted to row number
40 column 2 - numDists under cutoff
41 rest of line - sequence row -> distance, sequence row -> distance
43 if you had a cutoff of 0.03 then the file would look like,
45 0 3 1 0.01 2 0.015 3 0.03
46 1 3 0 0.01 2 0.03 3 0.02
47 2 4 0 0.015 1 0.03 3 0.02 4 0.03
48 3 4 0 0.03 1 0.02 2 0.02 4 0.02
51 This class also creates a vector of ints, rowPos.
53 rowPos[0] = position in the file of distances related to sequence 0.
54 If a sequence is excluded by the cutoff, it's rowPos = -1.
56 //**********************************************************************************************************************
61 FormatMatrix(){ m = MothurOut::getInstance(); }
62 virtual ~FormatMatrix() {}
64 virtual int read(NameAssignment*){ return 1; }
65 virtual int read(CountTable*){ return 1; }
67 void setCutoff(float c) { cutoff = c; }
68 ListVector* getListVector() { return list; }
69 string getFormattedFileName() { return distFile; }
70 vector<int> getRowPositions() { return rowPos; }
80 //**********************************************************************************************************************