skbio.io.registry.read

skbio.io.registry.read(self, file, format=None, into=None, verify=True, **kwargs)[source]

Read file as format into an object.

State: Stable as of 0.4.0.

Parameters
  • file (openable (filepath, URL, filehandle, etc.)) – The file to read. Something that is understood by skbio.io.open.

  • format (str, optional) – The format of the file if known. If None, the format will be inferred from the file.

  • into (type or None, optional) – The object which will be returned. If None, a generator will be returned.

  • verify (bool, optional) – When True, will double check the format if provided.

  • kwargs (dict, optional) – Keyword arguments will be passed to their respective handlers (skbio.io.open and the reader for format). newline cannot be provided.

Returns

An instance of into if into is not None else generator

Return type

object or generator

Raises
  • ValueError – Raised when format and into are both None.

  • TypeError – If newline is provided in kwargs.

  • UnrecognizedFormatError – Raised when a reader could not be found for a given format or the format could not be guessed.

  • FormatIdentificationWarning – Raised when verify is True and the sniffer of a format did not agree that file is a member of format

  • ArgumentOverrideWarning – Raised when verify is True and a user-supplied argument is overriding the suggestion provided by the sniffer of format.