2 # -*- coding:latin-1 -*-
7 ground_truth
= cPickle
.load(sys
.argv
[1])
8 prediction
= cPickle
.load(sys
.argv
[2])
10 ESTs
= ground_truth
['TestEsts']
11 Exons
= ground_truth
['TestExon']
12 Acc
= ground_truth
['TestAcc']
13 Don
= ground_truth
['TestDon']
14 DNA
= ground_truth
['Test']
16 totalWrongPos
= [0]*len(prediction
)
18 for pos
,alignmentObj
in enumerate(prediction
):
19 predPos
= zips(alignmentObj
.tStarts
, alignmentObj
.tEnds
)
22 for predExonStart
,predExonStop
in predPos
:
24 for pos
,currentExons
in enumerate(Exons
):
25 for idx
in range(1,len(currentExons
)-1):
27 intronStart
= currentExons
[idx
][1]
28 intronStop
= currentExons
[idx
+1][0]
30 # est is covering full intron
31 if intronStart
> predExonStart
and intronStop
< predExonStop
:
32 #fprintf(fh,sprintf(' %s is completely overlapping from %d %d\n',currentESTName,intronStart,intronStop));
33 wrongPos
+= intronStop
-intronStart
34 # est is nested inside intron
35 elif intronStart
< predExonStart
and intronStop
> predExonStop
:
36 #fprintf(fh,sprintf(' %s is completely inside intron from %d %d\n',currentESTName,predExonStart,predExonStop));
37 wrongPos
+= intronStop
-intronStart
38 # end of exonth is nested inside predExoniction
39 elif intronStart
> predExonStart
and predExonStop
> intronStart
and intronStop
> predExonStop
:
40 #fprintf(fh,sprintf('%s is upstream overlapping from %d %d\n',currentESTName,intronStart,predExonStop));
41 wrongPos
+= intronStop
-intronStart
42 # predExoniction is nested inside exonth
43 elif intronStart
< predExonStart
and predExonStart
< intronStop
and intronStop
< predExonStop
:
44 #fprintf(fh,sprintf('%s is downstream overlapping from %d %d\n',currentESTName,predExonStart,intronStop));
45 wrongPos
+= intronStop
-intronStart
49 totalWrongPositions
[pos
] = wrongPos