print time.ctime()
- if doSplices:
- print "getting splices"
- splicesDict = RDS.getSplicesDict(withChrom=True, withPairID=True, readIDDict=True, splitRead=True)
- print "got splices"
-
print "getting uniq reads"
uniqDict = RDS.getReadsDict(withChrom=True, withPairID=True, doUniqs=True, readIDDict=True)
print "got uniqs"
if doSplices:
- for readID in splicesDict:
- theRead = splicesDict[readID]
- read0 = theRead[0]
- del read0[1]
- try:
- uniqDict[readID].append(read0)
- except:
- if len(theRead) == 4:
- read2 = theRead[2]
- del read2[1]
- uniqDict[readID] = [read0,read2]
+ addSplicesToUniqReads(RDS, uniqDict)
if doVerbose:
print len(uniqDict), time.ctime()
outfile = open(outfilename,"w")
-
diffChrom = 0
distal = 0
total = 0
continue
else:
outline = "%s\t%s\t%d\t%s\t%s\t%d\t%s" % (readID, chrom1, start1, sense1, chrom2, start2, sense2)
- outfile.write(outline + "\n")
+ print >> outfile, outline
if doVerbose:
print diffChrom, outline
else:
dist = abs(start1 - start2)
-
if minDist < dist < maxDist:
distal += 1
outline = "%s\t%s\t%d\t%s\t%d\t%s\t%d" % (readID, chrom1, start1, sense1, start2, sense2, dist)
- outfile.write(outline + "\n")
+ print >> outfile, outline
if doVerbose:
print distal, outline
print time.ctime()
+def addSplicesToUniqReads(RDS, uniqDict):
+ print "getting splices"
+ splicesDict = RDS.getSplicesDict(withChrom=True, withPairID=True, readIDDict=True, splitRead=True)
+ print "got splices"
+ for readID in splicesDict:
+ theRead = splicesDict[readID]
+ read0 = theRead[0]
+ read0["start"] = read0["startL"]
+ del read0["stopL"]
+ try:
+ uniqDict[readID].append(read0)
+ except:
+ if len(theRead) == 4:
+ read2 = theRead[2]
+ read2["start"] = read2["startL"]
+ del read2["stopL"]
+ uniqDict[readID] = [read0,read2]
+
+
if __name__ == "__main__":
main(sys.argv)
\ No newline at end of file