X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=erange.git;a=blobdiff_plain;f=MakeBamFromRds.py;fp=MakeBamFromRds.py;h=0b4946b1c3e9d4338da5e4a57b77791316ebad9b;hp=730c20be6fb147f84e58b7f80485199e0975ad3a;hb=cfc5602b26323ad2365295145e3f6c622d912eb4;hpb=c4561c55cfa9726530c6777b6515c4ef66306b2f diff --git a/MakeBamFromRds.py b/MakeBamFromRds.py index 730c20b..0b4946b 100644 --- a/MakeBamFromRds.py +++ b/MakeBamFromRds.py @@ -176,7 +176,7 @@ def processSpliceReads(RDS, outfile, chrom, withFlag, useFlagLike, readlength, d pass else: for read in spliceDict[chrom]: - if fastaSequenceDict.has_key(chrom): + if chrom in fastaSequenceDict: read["sense"], noncanonical = fixSpliceSense(fastaSequenceDict[chrom], read["startR"], read["stopL"], read["sense"]) noncanonicalSplices += noncanonical @@ -205,7 +205,7 @@ def writeBAMEntry(outfile, chrom, outputDict, readlength): alignedRead.rname = outfile.references.index(chrom) - if outputDict.has_key("startL"): + if "startL" in outputDict: startL = outputDict["startL"] - 1 stopL = outputDict["stopL"] - 1 startR = outputDict["startR"] - 1 @@ -217,6 +217,13 @@ def writeBAMEntry(outfile, chrom, outputDict, readlength): alignedRead.pos = outputDict["start"] - 1 alignedRead.cigar = [(0, readlength)] + #TODO: add sequence info + #cistematic.core.retrieveSequence(genome, chrom, start, stop, sense="F", db="") + #ooooo. let's do this with PyGr + + #TODO: add quality - max for each base, but default is to not include just like current + # rdsToFastq() sets everything to max + if paired: if pairID == "1": alignedRead.is_read1 = True @@ -227,7 +234,7 @@ def writeBAMEntry(outfile, chrom, outputDict, readlength): else: pass - if outputDict.has_key("mismatch"): + if "mismatch" in outputDict: mismatchTag = getMismatches(outputDict["mismatch"]) if mismatchTag: tagList.append(("MD", str(mismatchTag))) @@ -300,7 +307,7 @@ def fixSpliceSense(fastaSequence, startRight, stopLeft, sense=""): spliceJunction = string.join([leftJunctionSig, rightJunctionSig], "") spliceJunction = spliceJunction.upper() print spliceJunction - if spliceSense.has_key(spliceJunction): + if spliceJunction in spliceSense: sense = spliceSense[spliceJunction] else: noncanonical += 1