BASE="/home/bmajoros/1000G/assembly/combined"

FILES=glob.glob(BASE+"/*/*.ice9")
for file in FILES:
    print(file)
    parser=EssexParser(file)
    while(True):
        root=parser.nextElem()
        if(not root): break
        alts=root.pathQuery("report/status/alternate-structures")
        if(not alts): continue
        transcripts=alts.findChildren("transcript")
        scores={}
        numCryptic=0
        for transcript in transcripts:
            change=transcript.getAttribute("structure-change")
            score=transcript.getAttribute("score")
            if(change not in scores): scores[change]=0.0
            scores[change]+=float(score)
            numCryptic+=1
        if(len(scores)!=2): continue
        skippingScore=scores["exon-skipping"]
        crypticScore=scores["cryptic-site"]
        print(root.getAttribute("substrate"),
              root.getAttribute("transcript-ID"),
              skippingScore,crypticScore,numCryptic,flush=True)
    parser.close()