timoast / sinto

Tools for single-cell data processing
https://timoast.github.io/sinto/
MIT License
118 stars 25 forks source link

Gzipped barcode file loading #67

Closed jonathangriffiths closed 4 months ago

jonathangriffiths commented 5 months ago

Hi there,

Just an FYI that I think there is an issue with reading gzipped barcode files. I am getting the error

  File "/usr/local/bin/sinto", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/site-packages/sinto/arguments.py", line 555, in main
    options.func(options)
  File "/usr/local/lib/python3.10/site-packages/sinto/utils.py", line 24, in wrapper
    func(args)
  File "/usr/local/lib/python3.10/site-packages/sinto/cli.py", line 18, in run_filterbarcodes
    filterbarcodes.filterbarcodes(
  File "/usr/local/lib/python3.10/site-packages/sinto/filterbarcodes.py", line 104, in filterbarcodes
    cb = utils.read_cell_barcode_file(cells)
  File "/usr/local/lib/python3.10/site-packages/sinto/utils.py", line 203, in read_cell_barcode_file
    inf = gzip.open(infile, "b")
  File "/usr/local/lib/python3.10/gzip.py", line 58, in open
    binary_file = GzipFile(filename, gz_mode, compresslevel)
  File "/usr/local/lib/python3.10/gzip.py", line 174, in __init__
    fileobj = self.myfileobj = builtins.open(filename, mode or 'rb')
ValueError: Must have exactly one of create/read/write/append mode and at most one plus

In line 203 there, 'b' is used - I don't think this is correct according to the gzip docs here

The mode argument can be any of 'r', 'rb', 'a', 'ab', 'w', 'wb', 'x' or 'xb' for binary mode

Apologies for no PR!

timoast commented 4 months ago

Thanks @jonathangriffiths, should be fixed now