def main(): print('\nRunning copyCaller.py') args = parseArgs() varFile = utility.getProgramPath('varScan.jar') rScript = utility.getProgramPath('segmentation.R') cnFile = '%s/output.cn.call' %(args.outputFolder) sTime = utility.startTime() adjustment = 0 correction = 0 counter = -1 while not adjustment == 'Centered': counter = counter + 1 correction = correction + adjustment copyCall(varFile, args.inputFile, cnFile, correction) removeCommas(cnFile) adjustment = runRScript(rScript, cnFile, args.outputFolder) print('\nFinal correction value is %s' %(str(correction))) print('Number of adjustments: %s' %(str(counter))) eTime = utility.endTime() utility.executionTime(sTime, eTime) return
def main(): print('\nRunning multipleCopyCall.py') args = parseArgs() sTime = utility.startTime() tList = [] tmpDir = utility.createDirectory(args.outputFolder, 'copyCalls') for i in range(args.iteration): ccDir = utility.createDirectory(tmpDir, str(i)) t = threading.Thread(target=runCopyCall, args=( args.inputFile, ccDir, )) t.start() tList.append(t) while len(threading.enumerate()) > 5: time.sleep(1) for t in tList: t.join() eTime = utility.endTime() utility.executionTime(sTime, eTime) return
def main(): print('\nRunning mergePatients.py') args = parseArgs() if not args.inputFiles: sys.exit('No files found in path') sTime = utility.startTime() createCumulative(args.inputFiles, args.outputFile) eTime = utility.endTime() utility.executionTime(sTime, eTime)
def main(): print('\nRunning annoteSegments.py') args = parseArgs() sTime = utility.startTime() genesDict = getAnnotationInfo(args.annotationFile) segments = annoteSegments(args.inputFile, genesDict) utility.writeOutput(segments, args.outputFile) eTime = utility.endTime() utility.executionTime(sTime, eTime)
def main(): print('\nRunning summaryCopyCalls.py\n') args = parseArgs() sTime = utility.startTime() genesDict, iterations = iterateFiles(args.inputDir) genesList = geneStatistic(genesDict, iterations) printOutput(genesList, args.outputFile) eTime = utility.endTime() utility.executionTime(sTime, eTime)
def main(): print('\nRunning cancerFilter.py') args = parseArgs() sTime = utility.startTime() geneList = getGenes(args.geneFile) filteredSegs = filterSegmentGenes(args.inputFile, geneList) utility.writeOutput(filteredSegs, args.outputFile) eTime = utility.endTime() utility.executionTime(sTime, eTime)
def main(): print('\nRunning mergeCopyCalls.py\n') args = parseArgs() sTime = utility.startTime() segmentsDict = segmentsCollector(args.inputFiles, args.patientId) total = len(args.inputFiles) segments = filterDict(segmentsDict, args.threshold, total) utility.writeOutput(segments, args.outputFile) eTime = utility.endTime() utility.executionTime(sTime, eTime)
def main(): print('\nRunning mergeSegments.py\n') args = parseArgs() sTime = utility.startTime() armsDict = getArmsInfo(args.armRef) mergedSegs = getMergedSegments(args.inputFile, armsDict, args.maximum, args.minimum) utility.writeOutput(mergedSegs, args.outputFile) eTime = utility.endTime() utility.executionTime(sTime, eTime)
def main(): print('\nRunning runCNVAnalysis.py\n') configFile = parseArgs() config = getArgsFromFIle(configFile.configFile) sTime = utility.startTime() copyNumFile = runCopyNumber(config['Input']['controlBam'], config['Input']['tumoralBam'], config['References']['bedFile'], config['References']['refFile'], config['Output']['outputFolder'], config['Analysis'].getboolean('copyNumber')) multipleCCDir = runMultipleCopyCall( copyNumFile, config['Parameters']['iterations'], config['Output']['outputFolder'], config['Analysis'].getboolean('copyCalls')) cumulativeCC = runMergeCopyCalls( multipleCCDir, 'output.r.tsv', config['Parameters']['genePercentage'], config['Input']['patient'], config['Output']['outputFolder'], config['Analysis'].getboolean('mergeCopyCalls')) coverageFile = runCoverageFilter( cumulativeCC, config['Input']['controlbam'], config['Input']['tumoralbam'], config['References']['bedfile'], config['References']['reffile'], config['Parameters']['minCoverage'], config['Output']['outputfolder'], config['Analysis'].getboolean('coverageFilter')) mergedFile = runMergeSegments( coverageFile, config['References']['armreffile'], config['Parameters']['upperlimit'], config['Parameters']['lowerlimit'], config['Output']['outputfolder'], config['Analysis'].getboolean('mergeSegments')) annotedFile = runAnnoteSegments( mergedFile, config['References']['annotationfile'], config['Output']['outputfolder'], config['Analysis'].getboolean('annoteSegments')) cancerFile = runGeneFilter(annotedFile, config['References']['cancerGenesReference'], config['Output']['outputfolder'], config['Analysis'].getboolean('geneFilter')) eTime = utility.endTime() utility.executionTime(sTime, eTime)
def main(): print('\nRunning copyNumber.py') args = parseArgs() varFile = utility.getProgramPath('varScan.jar') sTime = utility.startTime() os.chdir(args.outputFolder) pileUpBams(varFile, args.controlFile, args.tumoralFile, args.bedFile, args.refFile, args.outputFolder) eTime = utility.endTime() utility.executionTime(sTime, eTime) return
def main(): print('\nRunning createCsv.py') args = parseArgs() sTime = utility.startTime() genes, variationTypes, patients = getGenes(args.inputFiles) lines = createCsv (genes, variationTypes, patients) line1, line2 = csvHeader(patients, variationTypes) lines.insert(0, line2) lines.insert(0, line1) writeCsv(lines, args.outputFile) eTime = utility.endTime() utility.executionTime(sTime, eTime)
def main(): print('\nRunning coverageFilter.py') args = parseArgs() sTime = utility.startTime() segments = getSegments(args.inputFile) tList = [] for segment in segments: t = threading.Thread(target=coverageMeans, args=(segment, args.controlFile, args.tumoralFile, args.bedFile, args.refFile, args.minCov)) t.start() tList.append(t) while len(threading.enumerate()) > 5: time.sleep(1) for t in tList: t.join() utility.writeOutput(filteredSegs, args.outputFile) eTime = utility.endTime() utility.executionTime(sTime, eTime)