13 from commoncode import getMergedRegions, getLocusByChromDict
14 from cistematic.genomes import Genome
16 print "%s: version 1.3" % sys.argv[0]
24 print "usage: python %s genome acceptedfile outfile" % argv[0]
31 utrChanges(genome, acceptfile, outfile)
34 def utrChanges(genome, acceptfile, outFileName):
35 acceptDict = getMergedRegions(acceptfile, maxDist=0, keepLabel=True, verbose=True)
36 outfile = open(outFileName, "w")
40 origLocusByChromDict = getLocusByChromDict(hg, keepSense = True)
41 newLocusByChromDict = getLocusByChromDict(hg, additionalRegionsDict = acceptDict, keepSense = True)
47 for chrom in origLocusByChromDict:
48 for (gstart, gstop, gid, glen, sense) in origLocusByChromDict[chrom]:
49 for (newstart, newstop, newgid, newlen, newsense) in newLocusByChromDict[chrom]:
51 changedBoundary = False
58 changedBoundary = True
62 changedBoundary = True
70 changedBoundary = True
74 changedBoundary = True
80 outfile.write("%s\tchr%s\t%d\t%d\t%s\tchr%s\t%d\t%d\t%s\t%s\n" % (gid, chrom, gstart, gstop, sense, chrom, newstart, newstop, new5p, new3p))
85 print "%d new 5'utr" % new5utr
86 print "%d new 3'utr" % new3utr
87 print "%s affected genes" % changedGene
90 if __name__ == "__main__":