File: sharedlistvector.h

package info (click to toggle)
mothur 1.48.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 13,692 kB
  • sloc: cpp: 161,866; makefile: 122; sh: 31
file content (73 lines) | stat: -rwxr-xr-x 2,536 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#ifndef SHAREDLIST_H
#define SHAREDLIST_H

/*
 *  sharedlistvector.h
 *  Mothur
 *
 *  Created by Sarah Westcott on 1/22/09.
 *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
 *
 */

#include "datavector.hpp"
#include "groupmap.h"
#include "counttable.h"
#include "sharedrabundvectors.hpp"
#include "sharedrabundfloatvectors.hpp"
#include "currentfile.h"

/* This class is a child to datavector.  It represents OTU information at a certain distance. 
	A sharedlistvector can be converted into a sharedordervector, sharedrabundvector or sharedsabundvectorand 
	as well as an ordervector, rabundvector or sabundvector.
	Each member of the internal container "data" represents an individual OTU.
	Each individual in the OTU belongs to a group.
	So data[0] = "a,b,c,d,e,f".
	example: listvector		=	a,b,c,d,e,f		g,h,i		j,k		l		m  
			 rabundvector	=	6				3			2		1		1
			 sabundvector	=	2		1		1		0		0		1
			 ordervector	=	1	1	1	1	1	1	2	2	2	3	3	4	5 */

class SharedListVector : public DataVector {
	
public:
	SharedListVector(ifstream&, vector<string>&, string&, string&);
	SharedListVector(const SharedListVector& lv) : DataVector(lv.label), data(lv.data), maxRank(lv.maxRank), numBins(lv.numBins), numSeqs(lv.numSeqs), binLabels(lv.binLabels), groups(lv.groups), fillGroups(lv.fillGroups), groupMode(lv.groupMode), otuTag(lv.otuTag) { groupmap = nullptr; countTable = nullptr; };
	~SharedListVector(){ if (groupmap != nullptr) { delete groupmap; } if (countTable != nullptr) { delete countTable; } };
	
	int getNumBins()							{	return numBins;		}
	int getNumSeqs()							{	return numSeqs;		}
	int getMaxRank()							{	return maxRank;		}

	void set(int, string);	
	string get(int);
    vector<string> getLabels();
    void setLabels(vector<string>);
	void push_back(string);
	void resize(int);
	void clear();
	int size();
	void print(ostream&);
	
	RAbundVector getRAbundVector();
	SAbundVector getSAbundVector();
	OrderVector getOrderVector(map<string,int>*);
	SharedOrderVector* getSharedOrderVector();
	SharedRAbundVectors* getSharedRAbundVector(); //returns sharedRabundVectors for all the users groups
    SharedRAbundFloatVectors* getSharedRAbundFloatVector(); //returns sharedRabundVectors for all the users groups
	
private:
	vector<string> data;  //data[i] is a list of names of sequences in the ith OTU.
	GroupMap* groupmap;
    CountTable* countTable;
    vector<string> groups;
    bool fillGroups;
	int maxRank;
	int numBins;
	int numSeqs;
    vector<string> binLabels;
    string groupMode, otuTag;

};

#endif