Parse a tab-separated file containing compound IDs and properties

    The compound properties are parsed according to the header which specifies
    which property is contained in each column.

def parse_compound_table_file(path, f):
    """Parse a tab-separated file containing compound IDs and properties

    The compound properties are parsed according to the header which specifies
    which property is contained in each column.
    """

    context = FilePathContext(path)

    for i, row in enumerate(csv.DictReader(f, delimiter=str('\t'))):
        if 'id' not in row or row['id'].strip() == '':
            raise ParseError('Expected `id` column in table')

        props = {key: value for key, value in iteritems(row) if value != ''}

        if 'charge' in props:
            props['charge'] = int(props['charge'])

        mark = FileMark(context, i + 2, None)
        yield CompoundEntry(props, mark)