def fastaParserSpectraClusterPy(header):
    """Custom parser for fasta headers adapted from
    https://github.com/spectra-cluster/spectra-cluster-py

    :param header: str, protein entry header from a fasta file

    :returns: dict, parsed header
    """
    isUniprot = lambda h: h[0:3] in ['sp|', 'tr|', 'up|']

    if isUniprot(header):
        start = 3
        end = header.find('|', start)
    else:
        start = 0
        breakPositions = [header.find(' '), header.find('|')]
        breakPositions = [i if i > 0 else len(header) for i in breakPositions]
        end = min(breakPositions)

    return {'id': header[start:end]}
Custom parser for fasta headers adapted from
    https://github.com/spectra-cluster/spectra-cluster-py

    :param header: str, protein entry header from a fasta file

    :returns: dict, parsed header