File: kmerdb.hpp

package info (click to toggle)
mothur 1.24.1-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 7,868 kB
  • sloc: cpp: 110,948; ansic: 2,037; fortran: 665; makefile: 74; sh: 59
file content (49 lines) | stat: -rw-r--r-- 1,520 bytes parent folder | download | duplicates (3)
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
#ifndef KMERDB_HPP
#define KMERDB_HPP

/*
 *  kmerdb.h
 *  
 *
 *  Created by Pat Schloss on 12/16/08.
 *  Copyright 2008 Patrick D. Schloss. All rights reserved.
 *
 *	This class is a child class of the Database class, which stores the template sequences as a kmer table and provides
 *	a method of searching the kmer table for the sequence with the most kmers in common with a query sequence.
 *	kmerLocations is the primary storage variable that is a two-dimensional vector where each row represents the
 *	different number of kmers and each column contains the index to sequences that use that kmer.
 *
 *	Construction of an object of this type will first look for an appropriately named database file and if it is found
 *	then will read in the database file (readKmerDB), otherwise it will generate one and store the data in memory
 *	(generateKmerDB)

 */

#include "mothur.h"
#include "database.hpp"

class KmerDB : public Database {
	
public:
	KmerDB(string, int);
	KmerDB();
	~KmerDB();
	
	void generateDB();
	void addSequence(Sequence);
	vector<int> findClosestSequences(Sequence*, int);
	void readKmerDB(ifstream&);
	int getCount(int);  //returns number of sequences with that kmer number
	vector<int> getSequencesWithKmer(int);  //returns vector of sequences that contain kmer passed in
	int getReversed(int);  //returns reverse compliment kmerNumber 
	int getMaxKmer() { return maxKmer; }
	
private:
	
	int kmerSize;
	int maxKmer, count;
	string kmerDBName;
	vector<vector<int> > kmerLocations;
};

#endif