88e440f6e7e7739f90684ffc6129aeb1b7961285
max
  Tue May 6 06:29:41 2025 -0700
creating quickgenes file for cbImportSeurat

diff --git src/cbPyLib/cellbrowser/seurat.py src/cbPyLib/cellbrowser/seurat.py
index 60c8576..fcc340c 100644
--- src/cbPyLib/cellbrowser/seurat.py
+++ src/cbPyLib/cellbrowser/seurat.py
@@ -318,30 +318,31 @@
     confArgs = {"clusterField":"Cluster"}
     if inConf.get("skipMatrixExport", False):
         confArgs["exprMatrix"] = inMatrix
         matrixPath = None
 
     writeCbSeuratScript(inConf, inMatrix, tsnePath, clusterPath, markerPath, rdsPath, matrixPath, scriptPath,
             datasetName, outDir, threadCount)
     runRscript(scriptPath, logPath)
 
     if not isfile(markerPath):
         errAbort("R script did not complete successfully. Check %s and analysisLog.txt." % scriptPath)
 
     coords = [{'shortLabel':'t-SNE', 'file':'tsne.coords.tsv'}]
 
     generateQuickGenes(outDir)
+
     confArgs['quickGenesFile'] = "quickGenes.tsv"
 
     writeCellbrowserConf(datasetName, coords, cbConfPath, args=confArgs)
 
     generateHtmls(datasetName, outDir, desc = {"supplFiles": [{"label":"Seurat RDS", "file":basename(rdsPath)}]})
     copyPkgFile("sampleConfig/desc.conf", outDir)
 
 def cbImportSeurat_parseArgs(showHelp=False):
     " setup logging, parse command line arguments and options. -h shows auto-generated help page "
     parser = optparse.OptionParser("""usage: %prog [options] -i input.rds -o outDir [-n datasetName] - convert Seurat object to cellbrowser
 
     Example:
     - %prog -i pbmc3k.rds -o pbmc3kSeurat - convert pbmc3k to directory of tab-separated files
     """)
 
@@ -524,31 +525,37 @@
     cmds.append("ExportToCellbrowser(sobj, '%s', '%s', markers.file = %s, cluster.field=%s, skip.expr.matrix = %s, skip.markers = %s, use.mtx=%s, matrix.slot='%s')" %
             (outDir, datasetName, markerFileStr, clusterStr, skipStr, skipMarkerStr, useMtx, matrixSlot))
 
     writeRScript(cmds, scriptPath, "cbImportSeurat")
     runRscript(scriptPath, logPath)
     if not isfile(metaPath):
         errAbort("R script did not complete successfully. Check %s and analysisLog.txt." % scriptPath)
 
     descDict = None
     if inFormat=="rds":
         rdsOutPath = join(outDir, basename(inFname))
         copyFileIfDiffSize(inFname, rdsOutPath)
         objectVersion = findObjectVersion(outDir)
         descDict = {"supplFiles": [{"label":"Seurat %s RDS" % objectVersion, "file":basename(inFname)}]}
 
+    generateQuickGenes(outDir)
+
+    # append one single line to cellbrowser.conf
     cbConfPath = join(outDir, "cellbrowser.conf")
+    fh = open(cbConfPath, "a")
+    fh.write("\nquickGenesFile = 'quickGenes.tsv'\n")
+    fh.close()
 
     generateHtmls(datasetName, outDir, desc = descDict)
 
 def cbImportSeuratCli():
     " convert .rds to directory "
     args, options = cbImportSeurat_parseArgs()
 
     inFname = options.inFname
     outDir = options.outDir
     if None in [inFname, outDir]:
         cbImportSeurat_parseArgs(showHelp=True)
         errAbort("You need to specify at least an input rds file and an output directory")
 
     datasetName = options.datasetName
     if datasetName is None: