MCPcopy Create free account
hub / github.com/deweylab/RSEM / buildTranscript

Function buildTranscript

extractRef.cpp:89–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87}
88
89bool buildTranscript(int sp, int ep) {
90 int cur_s, cur_e; // current_start, current_end
91 vector<Interval> vec;
92
93 string transcript_id = items[sp].getTranscriptID();
94 string gene_id = items[sp].getGeneID();
95 string gene_name = "", transcript_name = "";
96
97 char strand = items[sp].getStrand();
98 string seqname = items[sp].getSeqName();
99 string left = items[sp].getLeft();
100
101 vec.clear();
102 cur_s = cur_e = -1;
103 for (int i = sp; i <= ep; i++) {
104 int start = items[i].getStart();
105 int end = items[i].getEnd();
106
107 general_assert(strand == items[i].getStrand(), "According to the GTF file given, transcript " + transcript_id + " has exons from different orientations!");
108 general_assert(seqname == items[i].getSeqName(), "According to the GTF file given, transcript " + transcript_id + " has exons on multiple chromosomes!");
109
110 if (items[i].getGeneName() != "") {
111 if (gene_name == "") gene_name = items[i].getGeneName();
112 else general_assert(gene_name == items[i].getGeneName(), "Transcript " + transcript_id + " is associated with multiple gene names!");
113 }
114 if (items[i].getTranscriptName() != "") {
115 if (transcript_name == "") transcript_name = items[i].getTranscriptName();
116 else general_assert(transcript_name == items[i].getTranscriptName(), "Transcript " + transcript_id + " is associated with multiple transcript names!");
117 }
118
119 if (cur_e + 1 < start) {
120 if (cur_s > 0) vec.push_back(Interval(cur_s, cur_e));
121 cur_s = start;
122 }
123 cur_e = (cur_e < end ? end : cur_e);
124 }
125 if (cur_s > 0) vec.push_back(Interval(cur_s, cur_e));
126
127 transcripts.add(Transcript(transcript_id, gene_id, seqname, strand, vec, left, transcript_name, gene_name));
128
129 return true;
130}
131
132void parse_gtf_file(char* gtfF) {
133 ifstream fin(gtfF);

Callers 1

parse_gtf_fileFunction · 0.85

Calls 9

IntervalClass · 0.85
getLeftMethod · 0.80
clearMethod · 0.80
getStartMethod · 0.80
getEndMethod · 0.80
push_backMethod · 0.80
TranscriptClass · 0.70
getStrandMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected