import collections


def load_manifest(manifest_path):
    """Extract sample information from a manifest file.

    """

    # pylint: disable=I0011,C0103
    Sample = collections.namedtuple("Sample", "id status path")

    samples = []
    with open(manifest_path, "r") as manifest_file:
        for line in manifest_file:
            sample_id, status, path = line.split()

            if status not in ["case", "control"]:
                message = (
                    'Sample status must be either "case" or "control";'
                    ' instead got "{}"'
                )
                raise Exception(message.format(status))

            sample = Sample(id=sample_id, status=status, path=path)
            samples.append(sample)
    return samples