def runTcPerUtr(tid, bam, referenceFile, bed, minMQ, maxReadLength, outputDirectory, snpDirectory): outputCSV = os.path.join( outputDirectory, replaceExtension(basename(bam), ".csv", "_tcperutr")) outputPDF = os.path.join( outputDirectory, replaceExtension(basename(bam), ".pdf", "_tcperutr")) outputLOG = os.path.join( outputDirectory, replaceExtension(basename(bam), ".log", "_tcperutr")) if (snpDirectory != None): inputSNP = os.path.join( snpDirectory, replaceExtension(basename(bam), ".vcf", "_snp")) else: inputSNP = None if (maxReadLength == None): maxReadLength = estimateMaxReadLength(bam) if (maxReadLength < 0): print( "Could not reliable estimate maximum read length. Please specify --max-read-length parameter." ) sys.exit(0) log = getLogFile(outputLOG) print("Using " + str(maxReadLength) + " as maximum read length.", file=log) stats.tcPerUtr(referenceFile, bed, bam, minMQ, maxReadLength, outputCSV, outputPDF, inputSNP, log, False, True, True) closeLogFile(log) stepFinished()
def runCount(tid, bam, ref, bed, maxLength, minQual, strictTCs, outputDirectory, snpDirectory): outputCSV = os.path.join( outputDirectory, replaceExtension(basename(bam), ".tsv", "_tcount")) outputBedgraphPlus = os.path.join( outputDirectory, replaceExtension(basename(bam), ".bedgraph", "_tcount_plus")) outputBedgraphMinus = os.path.join( outputDirectory, replaceExtension(basename(bam), ".bedgraph", "_tcount_mins")) outputLOG = os.path.join( outputDirectory, replaceExtension(basename(bam), ".log", "_tcount")) if (snpDirectory != None): inputSNP = os.path.join( snpDirectory, replaceExtension(basename(bam), ".vcf", "_snp")) else: inputSNP = None if (maxLength == None): maxLength = estimateMaxReadLength(bam) if (maxLength < 0): print( "Could not reliable estimate maximum read length. Please specify --max-read-length parameter." ) sys.exit(0) log = getLogFile(outputLOG) print("Using " + str(maxLength) + " as maximum read length.", file=log) tcounter.computeTconversions(ref, bed, inputSNP, bam, maxLength, minQual, outputCSV, outputBedgraphPlus, outputBedgraphMinus, strictTCs, log) stepFinished() return outputCSV
def runSNPeval(tid, bam, ref, bed, maxLength, minQual, coverageCutoff, variantFraction, strictTCs, outputDirectory, snpDirectory): outputCSV = os.path.join( outputDirectory, replaceExtension(basename(bam), ".csv", "_SNPeval")) outputPDF = os.path.join( outputDirectory, replaceExtension(basename(bam), ".pdf", "_SNPeval")) outputLOG = os.path.join( outputDirectory, replaceExtension(basename(bam), ".log", "_SNPeval")) if (not os.path.isdir(snpDirectory)): print("SNP directory does not exists. Abort.") sys.exit(0) inputSNP = os.path.join(snpDirectory, replaceExtension(basename(bam), ".vcf", "_snp")) if (maxLength == None): maxLength = estimateMaxReadLength(bam) if (maxLength < 0): print( "Could not reliable estimate maximum read length. Please specify --max-read-length parameter." ) sys.exit(0) log = getLogFile(outputLOG) print("Using " + str(maxLength) + " as maximum read length.", file=log) stats.computeSNPMaskedRates(ref, bed, inputSNP, bam, maxLength, minQual, coverageCutoff, variantFraction, outputCSV, outputPDF, strictTCs, log) stepFinished()
def runStatsRatesUTR(tid, bam, referenceFile, minMQ, strictTCs, outputDirectory, utrFile, maxReadLength): outputCSV = os.path.join( outputDirectory, replaceExtension(basename(bam), ".csv", "_mutationrates_utr")) outputPDF = os.path.join( outputDirectory, replaceExtension(basename(bam), ".pdf", "_mutationrates_utr")) outputLOG = os.path.join( outputDirectory, replaceExtension(basename(bam), ".log", "_mutationrates_utr")) if (maxReadLength == None): maxReadLength = estimateMaxReadLength(bam) if (maxReadLength < 0): print( "Could not reliable estimate maximum read length. Please specify --max-read-length parameter." ) sys.exit(0) log = getLogFile(outputLOG) print("Using " + str(maxReadLength) + " as maximum read length.", file=log) stats.statsComputeOverallRatesPerUTR(referenceFile, bam, minMQ, strictTCs, outputCSV, outputPDF, utrFile, maxReadLength, log) closeLogFile(log) stepFinished()
def runStatsRatesUTR(tid, bam, referenceFile, minMQ, strictTCs, outputDirectory, utrFile, maxReadLength) : outputCSV = os.path.join(outputDirectory, replaceExtension(basename(bam), ".csv", "_mutationrates_utr")) outputPDF = os.path.join(outputDirectory, replaceExtension(basename(bam), ".pdf", "_mutationrates_utr")) outputLOG = os.path.join(outputDirectory, replaceExtension(basename(bam), ".log", "_mutationrates_utr")) if (maxReadLength == None) : maxReadLength = estimateMaxReadLength(bam) if (maxReadLength < 0) : print("Could not reliable estimate maximum read length. Please specify --max-read-length parameter.") sys.exit(0) log = getLogFile(outputLOG) print("Using " + str(maxReadLength) + " as maximum read length.",file=log) stats.statsComputeOverallRatesPerUTR(referenceFile, bam, minMQ, strictTCs, outputCSV, outputPDF, utrFile, maxReadLength, log) closeLogFile(log) stepFinished()
def runTcPerUtr(tid, bam, referenceFile, bed, minMQ, maxReadLength, outputDirectory, snpDirectory): outputCSV = os.path.join(outputDirectory, replaceExtension(basename(bam), ".csv", "_tcperutr")) outputPDF = os.path.join(outputDirectory, replaceExtension(basename(bam), ".pdf", "_tcperutr")) outputLOG = os.path.join(outputDirectory, replaceExtension(basename(bam), ".log", "_tcperutr")) if(snpDirectory != None): inputSNP = os.path.join(snpDirectory, replaceExtension(basename(bam), ".vcf", "_snp")) else: inputSNP = None if (maxReadLength == None) : maxReadLength = estimateMaxReadLength(bam) if (maxReadLength < 0) : print("Could not reliable estimate maximum read length. Please specify --max-read-length parameter.") sys.exit(0) log = getLogFile(outputLOG) print("Using " + str(maxReadLength) + " as maximum read length.",file=log) stats.tcPerUtr(referenceFile, bed, bam, minMQ, maxReadLength, outputCSV, outputPDF, inputSNP, log, False, True, True) closeLogFile(log) stepFinished()
def runSNPeval(tid, bam, ref, bed, maxLength, minQual, coverageCutoff, variantFraction, strictTCs, outputDirectory, snpDirectory) : outputCSV = os.path.join(outputDirectory, replaceExtension(basename(bam), ".csv", "_SNPeval")) outputPDF = os.path.join(outputDirectory, replaceExtension(basename(bam), ".pdf", "_SNPeval")) outputLOG = os.path.join(outputDirectory, replaceExtension(basename(bam), ".log", "_SNPeval")) if (not os.path.isdir(snpDirectory)) : print("SNP directory does not exists. Abort.") sys.exit(0) inputSNP = os.path.join(snpDirectory, replaceExtension(basename(bam), ".vcf", "_snp")) if (maxLength == None) : maxLength = estimateMaxReadLength(bam) if (maxLength < 0) : print("Could not reliable estimate maximum read length. Please specify --max-read-length parameter.") sys.exit(0) log = getLogFile(outputLOG) print("Using " + str(maxLength) + " as maximum read length.",file=log) stats.computeSNPMaskedRates(ref, bed, inputSNP, bam, maxLength, minQual, coverageCutoff, variantFraction, outputCSV, outputPDF, strictTCs, log) stepFinished()