Skip to content

Ability to support file-like objects in clodius.tiles聽#142

Description

@manzt

Tracking whether file-like objects could be supported by the different tiles implementations.

馃煩 = yes, 馃煥 = unknown, 馃煡 = no

馃煥 bam.py

Depends on pysam.AlignmentFile which allows a file-like object for the reference but not the index.

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

Depends on sqllite3.connect which only accepts a string.

馃煡 bedarcsdb.py

Depends on sqllite3.connect which only accepts a string.

馃煡 beddb.py

Depends on sqllite3.connect which only accepts a string.

馃煩 bedfile.py

Currently a no-op.

馃煥 bigbed.py

Depends on tiles/bigwig.py.

馃煥 bigwig.py

Depends on whether pybbi could accept file-like objects.

馃煩 chromsizes.py

Just reading a csv using builtin open.

馃煩 cooler.py

Depends on h5py which allows file-like objects

馃煩 density.py

Depends on h5py which allows file-like objects

馃煩/馃煥 fasta.py

Depends on pyfaidx.Fasta supports only filenames. Some effort here that could be abstracted further.

馃煡 geo.py

Depends on sqllite3.connect which only accepts a string.

馃煩 hitile.py

Depends on h5py which allows file-like objects

馃煡 imtiles.py

Depends on sqllite3.connect which only accepts a string.

馃煩 mrmatrix.py

Depends on h5py which allows file-like objects

馃煩 multivec.py

Depends on h5py which allows file-like objects

馃煩 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

Uses builtin open with can be replaced with fh.open if file-like object is provided.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions