File: sampleFile.h

package info (click to toggle)
bedtools 2.27.1%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 54,804 kB
  • sloc: cpp: 38,072; sh: 7,307; makefile: 2,241; python: 163
file content (47 lines) | stat: -rw-r--r-- 1,101 bytes parent folder | download | duplicates (4)
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
/*
 * sampleFile.h
 *
 *  Created on: Apr 29, 2015
 *      Author: nek3d
 */

#ifndef SAMPLEFILE_H_
#define SAMPLEFILE_H_

#include "ToolBase.h"
#include "ContextSample.h"

class SampleFile : public ToolBase {

public:
    SampleFile(ContextSample *context);
    virtual ~SampleFile();
	virtual bool init();
	virtual bool findNext(RecordKeyVector &hits);
	virtual void processHits(RecordOutputMgr *outputMgr, RecordKeyVector &hits) {}
	virtual void cleanupHits(RecordKeyVector &hits) {}
	virtual bool finalizeCalculations() { return true; }
	virtual void  giveFinalReport(RecordOutputMgr *outputMgr);


protected:
	FileRecordMgr *_inputFile;
	vector<Record *> _samples;
	size_t _numSamples; //the number of samples we ultimately want
	size_t _numCurrSamples; //the number of samples kept so far.
	size_t _currRecordNum;
	int _seed;

	static const int DEFAULT_NUM_SAMPLES = 1000000;
	bool keepRecord(Record *record);
	bool strandComplies(const Record * record);

	virtual ContextSample *upCast(ContextBase *context) { return static_cast<ContextSample *>(context); }


};




#endif /* SAMPLEFILE_H_ */