def getInterval(pos,exons):
    numExons=len(exons)
    for i in range(numExons):
        exon=exons[i]
        interval=None
        if(pos+2==exon.getBegin()):
            interval=Interval(exons[i-1].end,exon.getEnd())
        elif(pos==exon.getEnd()):
            interval=Interval(exon.getBegin(),exons[i+1].getBegin())
        if(interval): 
            interval.exon=i
            return interval
    return None

#============================= main() =================================
parser=EssexParser(infile)
while(True):
    report=parser.nextElem()
    if(not report): break
    statusNode=report.findChild("status");
    if(not statusNode): continue
    siteType="donor"
    brokenNode=statusNode.findChild("broken-donor")
    if(not brokenNode):
        siteType="acceptor"
        brokenNode=statusNode.findChild("broken-acceptor")
    if(not brokenNode): continue
    sitePos=int(brokenNode.getIthElem(0))
    geneID=report.getAttribute("gene-ID")
    transID=report.getAttribute("transcript-ID")
    mappedNode=report.findChild("mapped-transcript")
from __future__ import (absolute_import, division, print_function, 
   unicode_literals, generators, nested_scopes, with_statement)
from builtins import (bytes, dict, int, list, object, range, str, ascii,
   chr, hex, input, next, oct, open, pow, round, super, filter, map, zip)
# The above imports should allow this program to run in both Python 2 and
# Python 3.  You might need to update your version of module "future".
from EssexParser import EssexParser
import sys
import glob

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
Example #3
0
#!/usr/bin/env python
#=========================================================================
# This is OPEN SOURCE SOFTWARE governed by the Gnu General Public
# License (GPL) version 3, as described at www.opensource.org.
# Copyright (C)2016 William H. Majoros ([email protected]).
#=========================================================================
from __future__ import (absolute_import, division, print_function, 
   unicode_literals, generators, nested_scopes, with_statement)
from builtins import (bytes, dict, int, list, object, range, str, ascii,
   chr, hex, input, next, oct, open, pow, round, super, filter, map, zip)
from EssexParser import EssexParser
import sys

BASE="/Users/bmajoros/python/test/data"
filename=BASE+"/HG00096-1-subset.essex"
parser=EssexParser(filename)
while(True):
    root=parser.nextElem()
    if(not root): break
    #root.printXML(sys.stdout); print("\n")
    elem=root.pathQuery("reference-transcript/variants")
    if(elem): elem.printXML(sys.stdout); print("\n")
Example #4
0
#!/usr/bin/env python
#=========================================================================
# This is OPEN SOURCE SOFTWARE governed by the Gnu General Public
# License (GPL) version 3, as described at www.opensource.org.
# Author: William H. Majoros ([email protected])
#=========================================================================
from __future__ import (absolute_import, division, print_function,
                        unicode_literals, generators, nested_scopes,
                        with_statement)
from builtins import (bytes, dict, int, list, object, range, str, ascii, chr,
                      hex, input, next, oct, open, pow, round, super, filter,
                      map, zip)
# The above imports should allow this program to run in both Python 2 and
# Python 3.  You might need to update your version of module "future".
import sys
import ProgramName
from EssexParser import EssexParser

#=========================================================================
# main()
#=========================================================================
if (len(sys.argv) != 2):
    exit(ProgramName.get() + " <in.essex>\n")
(infile, ) = sys.argv[1:]

parser = EssexParser(infile)
while (True):
    tree = parser.nextElem()
    if (tree is None): break
    tree.print(sys.stdout)
Example #5
0
#!/usr/bin/env python
#=========================================================================
# This is OPEN SOURCE SOFTWARE governed by the Gnu General Public
# License (GPL) version 3, as described at www.opensource.org.
# Copyright (C)2016 William H. Majoros ([email protected]).
#=========================================================================
from __future__ import (absolute_import, division, print_function,
                        unicode_literals, generators, nested_scopes,
                        with_statement)
from builtins import (bytes, dict, int, list, object, range, str, ascii, chr,
                      hex, input, next, oct, open, pow, round, super, filter,
                      map, zip)
from EssexParser import EssexParser
import sys

BASE = "/Users/bmajoros/python/test/data"
filename = BASE + "/HG00096-1-subset.essex"
parser = EssexParser(filename)
while (True):
    root = parser.nextElem()
    if (not root): break
    #root.printXML(sys.stdout); print("\n")
    elem = root.pathQuery("reference-transcript/variants")
    if (elem):
        elem.printXML(sys.stdout)
        print("\n")