File: PosteriorSamples.h

package info (click to toggle)
bitseq 0.7.5+dfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 676 kB
  • sloc: cpp: 7,043; python: 562; makefile: 150; sh: 52
file content (66 lines) | stat: -rw-r--r-- 2,025 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#ifndef POSTERIORSAMPLES_H
#define POSTERIORSAMPLES_H

#include<vector>
#include<fstream>
#include<string>

using namespace std;

const long PS_maxStoredSamples = 100000000;

class PosteriorSamples{//{{{
   private:
      long N,M;
      double norm;
      bool transposed,failed,areLogged;
      ifstream samplesF;
      vector<long> lines;
      vector<vector<double> > samples;

      bool open(string fileName);
      bool read();
   public:
   PosteriorSamples() { clear(); }
   ~PosteriorSamples() { close(); }
   // Copy constructor and assginment. Both just create new class. For vectors only.
   PosteriorSamples(const PosteriorSamples &other) { clear(); }
   PosteriorSamples& operator=(const PosteriorSamples & other) { //{{{
      close();
      clear();
      return *this;
   } //}}}
   void clear();
   bool initSet(long *m, long *n, string fileName);
   bool getTranscript(long tr, vector<double> &trSamples);
   void close();
   bool logged(){return areLogged;}
   void setNorm(double norm){this->norm = norm;}
};//}}}

class Conditions{//{{{
   private:
      long M,N,CN,C;
      bool mapping,areLogged;
      vector<long> Ms,Ns;
      vector<vector <long> > trMap;
      vector<PosteriorSamples> samples;
      vector<pair<long,long> > cIndex;
      
      long getIndex(long max); // return index without checking for duplicats
   public:
      Conditions();
      void close();
      long getRC(long c) const;
      long getRN() const { return CN;}
      long getC() const { return C;}
      bool init(string trFileName, vector<string> filesGot, long *c, long *m, long *n);
      bool init(string trFileName, vector<string> filesGot, long *m, long *n);
      bool setNorm(vector<double> norms);
      bool getTranscript(long cond, long rep, long tr, vector<double> &trSamples);
      bool getTranscript(long cond, long tr, vector<double> &trSamples);
      bool getTranscript(long cond, long tr, vector<double> &trSamples, long samplesN);
      bool logged() const { return areLogged; }
};//}}}

#endif