File: GFFFile.cpp

package info (click to toggle)
pbseqlib 5.3.5%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 7,020 kB
  • sloc: cpp: 77,250; python: 331; sh: 103; makefile: 41
file content (39 lines) | stat: -rw-r--r-- 1,212 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
#include <pbdata/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;
        std::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();
}