File: Transcript.cpp

package info (click to toggle)
rna-star 2.7.8a%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 3,076 kB
  • sloc: cpp: 20,429; awk: 483; ansic: 470; makefile: 181; sh: 31
file content (59 lines) | stat: -rw-r--r-- 1,533 bytes parent folder | download | duplicates (3)
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
#include "Transcript.h"

Transcript::Transcript()
{
    reset();
};

void Transcript::reset() {
    extendL=0;

//     for (uint ii=0;ii<4;ii++) {
//         polyXlength[ii]=0;
//         polyXnMM[ii]=0;
//     };
    primaryFlag=false;

    rStart=0; roStart=0; rLength=0; gStart=0; gLength=0; //read and genomic coordinates

    maxScore=0;
    nMatch=0;
    nMM=0;

    nGap=0; lGap=0; lDel=0; lIns=0; nDel=0; nIns=0;

    nUnique=nAnchor=0;
};

void Transcript::add(Transcript *trIn) {
    maxScore+=trIn->maxScore;
    nMatch+=trIn->nMatch;
    nMM+=trIn->nMM;
    nGap+=trIn->nGap; lGap+=trIn->lGap;
    lDel+=trIn->lDel; nDel+=trIn->nDel;
    lIns+=trIn->lIns; nIns+=trIn->nIns;
    nUnique+=trIn->nUnique;
};

void Transcript::extractSpliceJunctions(vector<array<uint64,2>> &sjOut, bool &annotYes)
{
    annotYes=true;
    for (uint64 iex=0; iex<nExons-1; iex++) {//record all junctions
        if (canonSJ[iex]>=0) {//only record junctions, not indels or mate gap
            array<uint64,2> sj;
            sj[0]=exons[iex][EX_G]+exons[iex][EX_L];//start
            sj[1]=exons[iex+1][EX_G] - sj[0]; //gap
            sjOut.push_back(sj);
            if (sjAnnot[iex]==0)
                annotYes=false;//if one of the SJs is unannoated, annotYes=false
        };
    };
};

uint64 Transcript::chrStartLengthExtended()
{
    uint64 start1  = cStart - exons[0][EX_R];
    uint64 length1 = exons[nExons-1][EX_G] + Lread - exons[nExons-1][EX_R] - exons[0][EX_G] + exons[0][EX_R];
    
    return (start1 << 32) | length1;
};