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