Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
bedFh.write("\n")
bedFh.close()
if skipCount != 0:
logging.info("Could not place %d genes, these were skipped" % skipCount)
bedFname2 = bedFname.replace(".bed", ".sorted.bed")
cmd = "LC_COLLATE=C sort -k1,1 -k2,2n %s > %s" % (bedFname, bedFname2)
cellbrowser.runCommand(cmd)
# convert to .bb using .as file
# from https://genome.ucsc.edu/goldenpath/help/examples/barChart/barChartBed.as
#asFname = join(dataDir, )
asFname = cellbrowser.getStaticFile(["genomes", "barChartBed.as"])
sizesFname = cellbrowser.getSizesFname(genome)
cmd = "bedToBigBed -as=%s -type=bed6+5 -tab %s %s %s" % (asFname, bedFname2, sizesFname, bbFname)
cellbrowser.runCommand(cmd)
idReportFname = join(outDir, "metaBamMatch.txt")
cellCount = writeDebugReport(allMetaCellIds, cellIdToBams, clusterBams, idReportFname)
jlFh = open("jobList", "w")
#cellCount = 0
for clusterName, (cellIds, bamFnames) in clusterBams.iteritems():
uniqueCellIds = set(cellIds)
#cellCount += len(uniqueCellIds)
logging.info("Merging BAM files and writing hub")
saneHubName = sanitizeName(hubName)
writeParentStanzas(tfh, saneHubName, hubName, cellCount)
chromSizes = cellbrowser.getSizesFname(db)
jobNo = 0
emptyClusterCount = 0
for clusterName, (cellIds, bamFnames) in clusterBams.iteritems():
saneClusterName = sanitizeName(clusterName)
logging.info("Processing cluster %s, %d cellIds/BAM files, examples: %s" % (clusterName, len(cellIds), cellIds[0]))
cmds = []
outBam = join(outDir, saneClusterName+".bam")
outStat = join(outDir, saneClusterName+".stats.txt")
outCalls = join(outDir, saneClusterName+".calls.tsv")
junctionBed = join(outDir, saneClusterName+".junctions.bed")
intronBed = join(outDir, saneClusterName+".introns.bed")
junctionBedSorted = junctionBed.replace(".bed", ".sorted.bed")
intronBedSorted = intronBed.replace(".bed", ".sorted.bed")