INNER CODE UNIT · Python
parse
pha4ge/hAMRonization · hAMRonization/__init__.py:85
def parse(handle, metadata, tool):
r"""Turn a sequence file into an iterator returning SeqRecords.
Arguments:
- handle - handle to the file, or the filename as a string
- tool - lower case string describing the file format.
- required_arguments - dict containing the required arguments for tool
Typical usage, opening a file to read in, and looping over the record(s):
>>> import hAMRonization as hAMR
>>> filename = "abricate_report.tsv"
>>> metadata = {"analysis_software_version": "1.0.1",
... "reference_database_version": "2019-Jul-28"}
>>> for result in hAMR.parse(filename, required_arguments, "abricate"):
... print(result)
"""
if not isinstance(tool, str):
raise TypeError("Need a string for the file format (lower case)")
if not isinstance(metadata, dict):