File: GFFFile.cpp

package info (click to toggle)
pbseqlib 0~20161219-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 5,924 kB
  • ctags: 5,123
  • sloc: cpp: 82,727; makefile: 305; python: 239; sh: 8
file content (40 lines) | stat: -rw-r--r-- 1,188 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
#include "GFFFile.hpp"

GFFEntry::GFFEntry(std::string & _name, std::string & _source,
                  std::string & _type, UInt & _start, UInt & _end,
                  float & _score, char & _strand,
                  std::string & _frame, std::string _attributes) {
    name = _name; 
    source = _source;
    type = _type;
    start = _start;
    end = _end;
    score = _score;
    strand = _strand;
    frame = _frame;
    attributes = _attributes;
}

void GFFFile::ReadAll(std::string & gffFileName) {
  std::fstream gffIn;
  CrucialOpen(gffFileName, gffIn, std::ios::in);
  while(gffIn) {
    std::string line;
    getline(gffIn, line);
    std::stringstream linestrm(line);
    std::string name, source, type;
    UInt start, end;
    char strand;
    float score;
    std::string frame, attributes;
    // A sample record in adapterGffFile:
    // ref000001   .   adapter 10955   10999   0.00    +   .   xxxx
    linestrm >> name >> source >> type 
             >> start >> end >> score 
             >> strand >> frame >> attributes;
    entries.push_back(GFFEntry(
      name, source, type, start, end, 
      score, strand, frame, attributes));
    }
    gffIn.close();
}