maximilianh / cellBrowser

main repo: https://github.com/ucscGenomeBrowser/cellBrowser/ - Python pipeline and Javascript scatter plot library for single-cell datasets, http://cellbrowser.rtfd.org
https://github.com/ucscGenomeBrowser/cellBrowser/
GNU General Public License v3.0
104 stars 40 forks source link

Scanpy import fails due to fields starting with underscore #208

Closed pcm32 closed 3 years ago

pcm32 commented 3 years ago

Trying on an AnnData object that we generate we got the following error:

INFO:root:Reading sample names from /private/var/folders/23/wwh84vd95rncnf5mx753cpgh0000gp/T/tmp_1zll3p7/job_working_directory/000/2/working/outdir/meta.tsv
Traceback (most recent call last):
  File "/Users/pmoreno/miniconda3/envs/__ucsc-cell-browser@0.7.15/bin/cbImportScanpy", line 10, in <module>
    sys.exit(cbImportScanpyCli())
  File "/Users/pmoreno/miniconda/envs/__ucsc-cell-browser@0.7.15/lib/python3.9/site-packages/cellbrowser/convert.py", line 604, in cbImportScanpyCli
    build(outDir, options.htmlDir, port=options.port)
  File "/Users/pmoreno/miniconda/envs/__ucsc-cell-browser@0.7.15/lib/python3.9/site-packages/cellbrowser/cellbrowser.py", line 4392, in build
    convertDataset(inDir, inConf, outConf, datasetDir, redo)
  File "/Users/pmoreno/miniconda/envs/__ucsc-cell-browser@0.7.15/lib/python3.9/site-packages/cellbrowser/cellbrowser.py", line 3749, in convertDataset
    sampleNames, needFilterMatrix = convertMeta(inDir, inConf, outConf, datasetDir, outMetaFname)
  File "/Users/pmoreno/miniconda/envs/__ucsc-cell-browser@0.7.15/lib/python3.9/site-packages/cellbrowser/cellbrowser.py", line 3412, in convertMeta
    sampleNames, needFilterMatrix = metaReorder(matrixFname, metaFname, finalMetaFname)
  File "/Users/pmoreno/miniconda/envs/__ucsc-cell-browser@0.7.15/lib/python3.9/site-packages/cellbrowser/cellbrowser.py", line 2195, in metaReorder
    metaSampleNames = readSampleNames(metaFname)
  File "/Users/pmoreno/miniconda/envs/__ucsc-cell-browser@0.7.15/lib/python3.9/site-packages/cellbrowser/cellbrowser.py", line 3061, in readSampleNames
    for row in lineFileNextRow(fname, noHeaders=False):
  File "/Users/pmoreno/miniconda/envs/__ucsc-cell-browser@0.7.15/lib/python3.9/site-packages/cellbrowser/cellbrowser.py", line 668, in lineFileNextRow
    Record = namedtuple('tsvCsvRec', headers)
  File "/Users/pmoreno/miniconda/envs/__ucsc-cell-browser@0.7.15/lib/python3.9/collections/__init__.py", line 399, in namedtuple
    raise ValueError('Field names cannot start with an underscore: '
ValueError: Field names cannot start with an underscore: '_is_in_cluster__'

This is with latest release version 0.7.15

Also, it would be nice if cbImportScanpy would fail with an error code when it fails. In this the tool fails silently (no error code) and Galaxy hence thinks that the import was succesful.

pcm32 commented 3 years ago

This should be easy to handle in the method that you have to sanitise the headers I presume.

pcm32 commented 3 years ago

Sorted by #209