Skip to content

ChainReader does not respect format argument in Universe loading #2334

@lilyminium

Description

@lilyminium

Expected behavior

u = mda.Universe(PDB, [PDB, PDB, PDB], format=my_custom_pdb_reader)

reads in my strange PDB files with my custom PDB reader.

Actual behavior

format: str, ``None``, default ``None``
        Provide the file format of the coordinate or trajectory file; ``None``
        guesses it from the file extension. Note that this keyword has no
        effect if a list of file names is supplied because the "chained" reader
        has to guess the file format for each individual list member.
        Can also pass a subclass of :class:`MDAnalysis.coordinates.base.ProtoReader` 
        to define a custom reader to be used on the trajectory file.

Any list of filenames is passed to the ChainReader, resulting in the normal MDAnalysis PDB reader instead of my custom one.

Current version of MDAnalysis

  • Which version are you using?
    0.19.3-dev

Suggested fix

In the core._get_readers.get_reader_for function, pass on the format argument into ChainReader. In ChainReader, use it for self.readers[].

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions