annotate PsiCLASS-1.0.2/SubexonGraph.cpp @ 0:903fc43d6227 draft default tip

Uploaded
author lsong10
date Fri, 26 Mar 2021 16:52:45 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
1 #include "SubexonGraph.hpp"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
2
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
3 void SubexonGraph::GetGeneBoundary( int tag, int &boundary, int timeStamp )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
4 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
5 if ( visit[tag] == timeStamp )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
6 return ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
7 //printf( "%d %d\n", tag, timeStamp ) ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
8 visit[tag] = timeStamp ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
9 if ( subexons[tag].end > boundary )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
10 boundary = subexons[tag].end ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
11 //if ( subexons[tag].start == 2858011 )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
12 // printf( "%d: %d %d\n", tag, subexons[tag].nextCnt, subexons[tag].prevCnt) ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
13 int i ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
14 int cnt = subexons[tag].nextCnt ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
15 for ( i = 0 ; i < cnt ; ++i )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
16 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
17 //printf( "next of %d: %d %d\n", tag, i, subexons[tag].next[i] ) ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
18 GetGeneBoundary( subexons[tag].next[i], boundary, timeStamp ) ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
19 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
20 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
21
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
22 int SubexonGraph::GetGeneIntervalIdx( int startIdx, int &endIdx, int timeStamp )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
23 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
24 int i ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
25 int seCnt = subexons.size() ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
26 if ( startIdx >= seCnt )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
27 return -1 ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
28 int farthest = -1 ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
29 GetGeneBoundary( startIdx, farthest, timeStamp ) ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
30
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
31 for ( i = startIdx + 1 ; i < seCnt ; ++i )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
32 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
33 if ( subexons[i].start > farthest || subexons[i].chrId != subexons[ startIdx ].chrId )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
34 break ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
35
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
36 GetGeneBoundary( i, farthest, timeStamp ) ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
37 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
38 endIdx = i - 1 ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
39
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
40 return endIdx ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
41 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
42
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
43 int SubexonGraph::ComputeGeneIntervals()
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
44 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
45 int i, cnt ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
46 int seCnt = subexons.size() ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
47 visit = new int[seCnt] ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
48 memset( visit, -1, sizeof( int ) * seCnt ) ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
49 int tag = 0 ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
50 cnt = 0 ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
51 while ( 1 )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
52 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
53 struct _geneInterval ngi ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
54 //printf( "%d %d %d\n", tag, subexons[tag].start + 1, subexons[tag].end + 1 ) ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
55 if ( GetGeneIntervalIdx( tag, ngi.endIdx, cnt ) == -1 )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
56 break ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
57 ++cnt ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
58 ngi.startIdx = tag ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
59 ngi.start = subexons[ ngi.startIdx ].start ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
60 ngi.end = subexons[ ngi.endIdx ].end ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
61
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
62 tag = ngi.endIdx + 1 ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
63 // Adjust the extent
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
64 // Adjust the start
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
65 if ( subexons[ ngi.startIdx ].leftStrand != 0
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
66 && subexons[ngi.startIdx].leftStrand != subexons[ngi.startIdx ].rightStrand )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
67 // We should make sure that rightstrand is non-zero whenever left-strand is non-zero for the startIdx.
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
68 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
69 for ( i = ngi.startIdx ; i >= 0 ; --i )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
70 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
71 if ( ( subexons[i].leftType == 1 && subexons[i].leftClassifier < classifierThreshold ) // an end within the subexon
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
72 || ( subexons[i].leftType == 0 ) // probably a overhang subexon. It should be a subset of the criterion following.
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
73 || ( i > 0 && subexons[i - 1].end + 1 < subexons[i].start ) ) // a gap.
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
74 break ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
75 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
76 ngi.start = subexons[i].start ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
77 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
78
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
79 // Adjust the end.
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
80 // And here, we also need to decide wether we need to adjust "tag" or not,
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
81 // because the next interval might be overlap with current interval by the last subexon.
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
82 // We solve the overlap genes now, so we DON'T need to adjust tag.
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
83 if ( subexons[ ngi.endIdx ].rightStrand != 0
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
84 && subexons[ngi.endIdx].leftStrand != subexons[ngi.endIdx ].rightStrand )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
85 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
86 for ( i = ngi.endIdx ; i < seCnt ; ++i )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
87 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
88 if ( ( subexons[i].rightType == 2 && subexons[i].rightClassifier < classifierThreshold ) // an end within the subexon
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
89 || ( subexons[i].rightType == 0 ) // probably a overhang subexon.
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
90 || ( i < seCnt - 1 && subexons[i].end + 1 < subexons[i + 1].start ) ) // a gap
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
91 break ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
92 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
93 ngi.end = subexons[i].end ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
94
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
95 /*if ( subexons[ ngi.endIdx ].rightType == 2 )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
96 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
97 for ( i = ngi.endIdx ; i >= ngi.startIdx ; --i )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
98 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
99 if ( subexons[i].leftType == 1 )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
100 break ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
101 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
102 // The last region overlapps.
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
103 if ( i >= ngi.startIdx && subexons[i].leftStrand != subexons[ ngi.endIdx ].rightStrand )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
104 --tag ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
105 }*/
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
106 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
107 geneIntervals.push_back( ngi ) ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
108 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
109 delete[] visit ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
110
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
111 return cnt ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
112 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
113
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
114 int SubexonGraph::ExtractSubexons( int startIdx, int endIdx, struct _subexon *retList )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
115 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
116 int i, j, k ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
117 int cnt = endIdx - startIdx + 1 ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
118 //printf( "%s: %d %d %d\n", __func__, startIdx, endIdx, cnt ) ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
119 for ( i = 0 ; i < cnt ; ++i )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
120 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
121 retList[i] = subexons[i + startIdx] ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
122 retList[i].geneId = -1 ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
123 retList[i].prev = new int[ retList[i].prevCnt ] ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
124 retList[i].next = new int[ retList[i].nextCnt ] ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
125
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
126 for ( j = 0 ; j < retList[i].prevCnt ; ++j )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
127 retList[i].prev[j] = subexons[i + startIdx].prev[j] - startIdx ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
128 for ( j = 0 ; j < retList[i].nextCnt ; ++j )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
129 retList[i].next[j] = subexons[i + startIdx].next[j] - startIdx ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
130
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
131 for ( j = 0, k = 0 ; j < retList[i].prevCnt ; ++j )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
132 if ( retList[i].prev[j] >= 0 && retList[i].prev[j] < cnt )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
133 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
134 retList[i].prev[k] = retList[i].prev[j] ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
135 ++k ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
136 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
137 retList[i].prevCnt = k ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
138
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
139 for ( j = 0, k = 0 ; j < retList[i].nextCnt ; ++j )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
140 if ( retList[i].next[j] >= 0 && retList[i].next[j] < cnt )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
141 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
142 retList[i].next[k] = retList[i].next[j] ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
143 ++k ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
144 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
145 retList[i].nextCnt = k ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
146 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
147 UpdateGeneId( retList, cnt ) ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
148 return cnt ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
149 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
150
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
151 void SubexonGraph::SetGeneId( int tag, int strand, struct _subexon *subexons, int seCnt, int id )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
152 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
153 if ( subexons[tag].geneId != -1 && subexons[tag].geneId != -2 )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
154 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
155 if ( subexons[tag].geneId != id ) // a subexon may belong to more than one gene.
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
156 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
157 //printf( "Set -2, %d: %d %d %d %d\n", id, tag, subexons[tag].geneId, subexons[tag].start + 1, strand ) ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
158 subexons[tag].geneId = -2 ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
159 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
160 else
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
161 return ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
162 // There is no need to terminate at the ambiguous exon, the strand will prevent
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
163 // us from overwriting previous gene ids.
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
164 //return ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
165 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
166 else if ( subexons[tag].geneId == -2 )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
167 return ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
168 //printf( "%d: %d %d %d %d\n", id, tag, subexons[tag].geneId, subexons[tag].start + 1, strand ) ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
169 int i ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
170 if ( subexons[tag].geneId != -2 )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
171 subexons[ tag ].geneId = id ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
172 int cnt = subexons[tag].nextCnt ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
173 // Set through the introns.
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
174 if ( IsSameStrand( strand, subexons[tag].rightStrand ) )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
175 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
176 for ( i = 0 ; i < cnt ; ++i )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
177 if ( subexons[ subexons[tag].next[i] ].start > subexons[tag].end + 1 )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
178 SetGeneId( subexons[tag].next[i], strand, subexons, seCnt, id ) ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
179 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
180
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
181 cnt = subexons[tag].prevCnt ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
182 if ( IsSameStrand( strand, subexons[tag].leftStrand ) )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
183 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
184 for ( i = 0 ; i < cnt ; ++i )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
185 if ( subexons[ subexons[tag].prev[i] ].end < subexons[tag].start - 1 )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
186 SetGeneId( subexons[tag].prev[i], strand, subexons, seCnt, id ) ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
187 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
188
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
189 // Set through the adjacent subexons.
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
190 if ( tag < seCnt - 1 && subexons[tag + 1].start == subexons[tag].end + 1 )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
191 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
192 SetGeneId( tag + 1, strand, subexons, seCnt, id ) ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
193 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
194
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
195 if ( tag > 0 && subexons[tag].start - 1 == subexons[tag - 1].end )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
196 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
197 SetGeneId( tag - 1, strand, subexons, seCnt, id ) ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
198 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
199
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
200 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
201
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
202 void SubexonGraph::UpdateGeneId( struct _subexon *subexons, int seCnt )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
203 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
204 int i ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
205 baseGeneId = usedGeneId ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
206 int lastMinusStrandGeneId = -1 ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
207 for ( int strand = -1 ; strand <= 1 ; strand +=2 )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
208 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
209 for ( i = 0 ; i < seCnt ; ++i )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
210 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
211 //printf( "%d (%d %d) %d.\n", i, subexons[i].start + 1, subexons[i].end + 1, subexons[i].geneId ) ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
212 if ( ( subexons[i].geneId == -1 && ( ( strand == 1 && subexons[i].rightStrand == 0 ) || subexons[i].rightStrand == strand ) )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
213 || ( strand == 1 && baseGeneId <= subexons[i].geneId && subexons[i].geneId <= lastMinusStrandGeneId && subexons[i].rightStrand == strand ) )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
214 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
215 SetGeneId( i, strand, subexons, seCnt, usedGeneId ) ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
216 if ( strand == -1 )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
217 lastMinusStrandGeneId = usedGeneId ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
218 ++usedGeneId ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
219 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
220 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
221 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
222
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
223 for ( i = 0 ; i < seCnt ; ++i )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
224 if ( subexons[i].leftType == 0 && subexons[i].rightType == 0 )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
225 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
226 subexons[i].geneId = usedGeneId ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
227 ++usedGeneId ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
228 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
229 // Put base and usedGeneId in lcCnt, rcCnt field.
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
230 for ( i = 0 ; i < seCnt ; ++i )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
231 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
232 subexons[i].lcCnt = baseGeneId ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
233 subexons[i].rcCnt = usedGeneId ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
234 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
235
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
236 /*for ( i = 0 ; i < seCnt ; ++i )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
237 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
238 printf( "geneId %d: %d-%d %d\n", i, subexons[i].start + 1, subexons[i].end + 1, subexons[i].geneId ) ;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
239 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
240 printf("%d %d\n", baseGeneId, usedGeneId ) ;*/
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
241 }