2 * transcripts are numbered from 1. 0 is reserved for noise isoform
14 #include "Transcript.h"
19 Transcripts(int type = 0) {
20 M = 0; this->type = type;
22 transcripts.push_back(Transcript());
25 int getM() { return M; }
26 int getType() { return type; }
28 const Transcript& getTranscriptAt(int pos) {
29 assert(pos > 0 && pos <= M);
30 return transcripts[pos];
33 void add(const Transcript& transcript) {
34 transcripts.push_back(transcript);
39 std::sort(transcripts.begin(), transcripts.end());
42 void readFrom(const char*);
43 void writeTo(const char*);
46 int M, type; // type 0 from genome , 1 standalone transcriptome
47 std::vector<Transcript> transcripts;
50 void Transcripts::readFrom(const char* inpF) {
52 std::ifstream fin(inpF);
54 if (!fin.is_open()) { fprintf(stderr, "Cannot open %s! It may not exist.\n", inpF); exit(-1); }
59 transcripts.resize(M + 1);
60 for (int i = 1; i <= M; i++) {
61 transcripts[i].read(fin);
66 void Transcripts::writeTo(const char* outF) {
67 std::ofstream fout(outF);
68 fout<<M<<" "<<type<<std::endl;
69 for (int i = 1; i <= M; i++) {
70 transcripts[i].write(fout);
75 #endif /* TRANSCRIPTS_H_ */