-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTTS.cpp
More file actions
53 lines (46 loc) · 1.1 KB
/
Copy pathTTS.cpp
File metadata and controls
53 lines (46 loc) · 1.1 KB
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
#include "TTS.h"
#define MAX_TTS 500000
struct _TTSsite *tts = NULL ;
int ttsCnt ;
FILE *fpTTS ;
void TTS_Init( char *file )
{
fpTTS =fopen( file, "r" ) ;
if ( !fpTTS )
printf( "Could not find TTS file %s. Program will ignore it.\n", file ) ;
tts = ( struct _TTSsite * )malloc( sizeof( struct _TTSsite ) * MAX_TTS ) ;
}
void TTS_Read( char *chrom )
{
static char polyaChrom[10] = "", strand[3] = "" ;
static int pos = -1, code = -1, sigPos ;
if ( tts == NULL )
{
ttsCnt = -1 ;
return ;
}
ttsCnt = 0 ;
if ( !strcmp( polyaChrom, chrom ) )
{
tts[ ttsCnt ].sigPos = sigPos ;
tts[ ttsCnt ].pos = pos ;
tts[ ttsCnt ].strand = ( strand[0] == '+' ? 1 : 0 ) ;
tts[ ttsCnt ].code = code ;
++ttsCnt ;
}
while ( fscanf( fpTTS, "%s %d %d %s %d", polyaChrom, &sigPos, &pos, strand, &code ) != EOF )
{
if ( strcmp( polyaChrom, chrom ) )
break ;
tts[ ttsCnt ].sigPos = sigPos ;
tts[ ttsCnt ].pos = pos ;
tts[ ttsCnt ].strand = ( strand[0] == '+' ? 1 : 0 ) ;
tts[ ttsCnt ].code = code ;
++ttsCnt ;
}
}
struct _TTSsite *TTS_GetCurrentTTS( int &cnt )
{
cnt = ttsCnt ;
return tts ;
}