Ability to support file-like objects in `clodius.tiles`
- Dominant language
- Python
- Stars
- 39
- Forks
- 22
- PR merge metrics
- No merged PRs in 30d
Description
Tracking whether file-like objects could be supported by the different tiles implementations.
π© = yes, π¨ = unknown, π₯ = no
#### π¨ [`bam.py`](https://github.com/higlass/clodius/blob/develop/clodius/tiles/bam.py)
Depends on [`pysam.AlignmentFile`](https://pysam.readthedocs.io/en/latest/api.html#pysam.AlignmentFile) which allows a file-like object for the reference but not the index.
```python
import pysam
# internal support for remote files http://www.htslib.org/doc/samtools.html#DESCRIPTION
# We could use this, but would need to cache instances (like tiles/clodius) to avoid
# re-initializing for each call to `tiles()`
pysam.AlignmentFile('http://localhost:8080/data.bam##idx##s3://path/to/data.bai')
with open('./data.bam') as f:
pysam.AlignmentFile(f) # works
with open('./data.bam') as f, open('./data.bai') as idx:
pysam.AlignmentFile(f, index_filename=idx) # error, can't pass file-like object for index!
with fsspec.open('http://localhost:8080/data.bam') as f:
pysam.AlignmentFile(f) # not recognized as a file-like object
```
#### π₯ [`bed2ddb.py`](https://github.com/higlass/clodius/blob/develop/clodius/tiles/bed2ddb.py)
Depends on [`sqllite3.connect`](https://docs.python.org/3/library/sqlite3.html#sqlite3.connect) which only accepts a string.
#### π₯ [`bedarcsdb.py`](https://github.com/higlass/clodius/blob/develop/clodius/tiles/bedarcsdb.py)
Depends on [`sqllite3.connect`](https://docs.python.org/3/library/sqlite3.html#sqlite3.connect) which only accepts a string.
#### π₯ [`beddb.py`](https://github.com/higlass/clodius/blob/develop/clodius/tiles/beddb.py)
Depends on [`sqllite3.connect`](https://docs.python.org/3/library/sqlite3.html#sqlite3.connect) which only accepts a string.
#### π© [`bedfile.py`](https://github.com/higlass/clodius/blob/develop/clodius/tiles/bedfile.py)
Currently a no-op.
#### π¨ [`bigbed.py`](https://github.com/higlass/clodius/blob/develop/clodius/tiles/bigbed.py)
Depends on `tiles/bigwig.py`.
#### π¨ [`bigwig.py`](https://github.com/higlass/clodius/blob/develop/clodius/tiles/bigwig.py)
Depends on whether [`pybbi`](https://github.com/nvictus/pybbi) could accept file-like objects.
#### π© [`chromsizes.py`](https://github.com/higlass/clodius/blob/develop/clodius/tiles/chromsizes.py)
Just reading a csv using builtin `open`.
#### π© [`cooler.py`](https://github.com/higlass/clodius/blob/develop/clodius/tiles/cooler.py)
Depends on `h5py` which [allows file-like objects](https://docs.h5py.org/en/stable/high/file.html#python-file-like-objects)
#### π© [`density.py`](https://github.com/higlass/clodius/blob/develop/clodius/tiles/density.py)
Depends on `h5py` which [allows file-like objects](https://docs.h5py.org/en/stable/high/file.html#python-file-like-objects)
#### π©/π¨ [`fasta.py`](https://github.com/higlass/clodius/blob/develop/clodius/tiles/fasta.py)
Depends on [`pyfaidx.Fasta`](https://github.com/mdshw5/pyfaidx) supports only filenames. Some effort [here](https://github.com/mdshw5/pyfaidx/pull/168) that could be abstracted further.
#### π₯ [`geo.py`](https://github.com/higlass/clodius/blob/develop/clodius/tiles/geo.py)
Depends on [`sqllite3.connect`](https://docs.python.org/3/library/sqlite3.html#sqlite3.connect) which only accepts a string.
#### π© [`hitile.py`](https://github.com/higlass/clodius/blob/develop/clodius/tiles/hitile.py)
Depends on `h5py` which [allows file-like objects](https://docs.h5py.org/en/stable/high/file.html#python-file-like-objects)
#### π₯ [`imtiles.py`](https://github.com/higlass/clodius/blob/develop/clodius/tiles/imtiles.py)
Depends on [`sqllite3.connect`](https://docs.python.org/3/library/sqlite3.html#sqlite3.connect) which only accepts a string.
#### π© [`mrmatrix.py`](https://github.com/higlass/clodius/blob/develop/clodius/tiles/mrmatrix.py)
Depends on `h5py` which [allows file-like objects](https://docs.h5py.org/en/stable/high/file.html#python-file-like-objects)
#### π© [`multivec.py`](https://github.com/higlass/clodius/blob/develop/clodius/tiles/multivec.py)
Depends on `h5py` which [allows file-like objects](https://docs.h5py.org/en/stable/high/file.html#python-file-like-objects)
#### π© [`tabix.py`](https://github.com/higlass/clodius/blob/develop/clodius/tiles/tabix.py)
Uses builtin `open` and `gzip.open` which can be replaced with `f.open` and `gzip.open(f)` if filehandles are provided.
#### π© [`time_interval.py`](https://github.com/higlass/clodius/blob/develop/clodius/tiles/time_interval.py)
Uses builtin `open` with can be replaced with `fh.open` if file-like object is provided.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.