Generates a :class:`ProteinDatabase` by in silico digestion of proteins
    from a fasta file.

    :param filePath: File path
    :param proteindb: optional an existing :class:`ProteinDatabase` can be
        specified, otherwise a new instance is generated and returned
    :param decoyTag: If a fasta file contains decoy protein entries, they should
        be specified with a sequence tag
    :param contaminationTag: If a fasta file contains contamination protein
        entries, they should be specified with a sequence tag
    :param headerParser: optional, allows specifying an individual headerParser
    :param forceId: bool, if True and no id can be extracted from the fasta
        header the whole header sequence is used as a protein id instead of
        raising an exception.
    :param cleavageRule: cleavage rule expressed in a regular expression, see
        :attr:`maspy.constants.expasy_rules`
    :param missedCleavage: number of allowed missed cleavage sites
    :param removeNtermM: bool, True to consider also peptides with the
        N-terminal Methionine of the protein removed
    :param minLength: int, only yield peptides with length >= minLength
    :param maxLength: int, only yield peptides with length <= maxLength
    :param ignoreIsoleucine: bool, if True treat Isoleucine and Leucine in
        peptide sequences as indistinguishable

    See also :func:`maspy.peptidemethods.digestInSilico`

def importProteinDatabase(filePath, proteindb=None, headerParser=None,
        forceId=False, decoyTag='[decoy]', contaminationTag='[cont]',
        ignoreIsoleucine=False,  cleavageRule='[KR]', minLength=5, maxLength=40,
        missedCleavage=0, removeNtermM=False):
    """Generates a :class:`ProteinDatabase` by in silico digestion of proteins
    from a fasta file.

    :param filePath: File path
    :param proteindb: optional an existing :class:`ProteinDatabase` can be
        specified, otherwise a new instance is generated and returned
    :param decoyTag: If a fasta file contains decoy protein entries, they should
        be specified with a sequence tag
    :param contaminationTag: If a fasta file contains contamination protein
        entries, they should be specified with a sequence tag
    :param headerParser: optional, allows specifying an individual headerParser
    :param forceId: bool, if True and no id can be extracted from the fasta
        header the whole header sequence is used as a protein id instead of
        raising an exception.
    :param cleavageRule: cleavage rule expressed in a regular expression, see
        :attr:`maspy.constants.expasy_rules`
    :param missedCleavage: number of allowed missed cleavage sites
    :param removeNtermM: bool, True to consider also peptides with the
        N-terminal Methionine of the protein removed
    :param minLength: int, only yield peptides with length >= minLength
    :param maxLength: int, only yield peptides with length <= maxLength
    :param ignoreIsoleucine: bool, if True treat Isoleucine and Leucine in
        peptide sequences as indistinguishable

    See also :func:`maspy.peptidemethods.digestInSilico`
    """
    if proteindb is None:
        proteindb = ProteinDatabase(ignoreIsoleucine=ignoreIsoleucine)

    # - Add protein entries to the protein database - #
    for fastaHeader, sequence in _readFastaFile(filePath):
        #TODO: function, make protein entry or something like this.
        header, isDecoy = _removeHeaderTag(fastaHeader, decoyTag)
        header, isContaminant = _removeHeaderTag(header, contaminationTag)

        headerInfo = _parseFastaHeader(header, headerParser, forceId)
        proteinId = _idFromHeaderInfo(headerInfo, isDecoy, decoyTag)
        proteinName = _nameFromHeaderInfo(headerInfo, isDecoy, decoyTag)

        if not isDecoy:
            isDecoy = _proteinTagPresent(header, decoyTag)
        if not isContaminant:
            isContaminant = _proteinTagPresent(header, contaminationTag)

        proteindb._addProtein(
            proteinId, proteinName, sequence, fastaHeader, headerInfo,
            isDecoy=isDecoy, isContaminant=isContaminant
        )

    # - Perform an insilico digestion and add peptides to the proteindb - #
    for proteinId in proteindb.proteins:
        sequence = proteindb.proteins[proteinId].sequence
        digestInfo = maspy.peptidemethods.digestInSilico(
            sequence, cleavageRule, missedCleavage, removeNtermM,
            minLength, maxLength
        )
        for sequence, info in digestInfo:
            proteindb._addPeptide(sequence, proteinId, info)

    #Define wheter a peptide is unique to one protein entry
    for peptide, peptideEntry in viewitems(proteindb.peptides):
        if len(peptideEntry.proteins) == 1:
            peptideEntry.isUnique = True
        else:
            peptideEntry.isUnique = False

    #Add peptide as shared or unique to its protein entries
    for peptide, peptideEntry in viewitems(proteindb.peptides):
        for proteinId in peptideEntry.proteins:
            if peptideEntry.isUnique:
                proteindb.proteins[proteinId].uniquePeptides.add(peptide)
            else:
                proteindb.proteins[proteinId].sharedPeptides.add(peptide)

    #Define unique proteins, i.e. have at least one unique peptide
    for proteinEntry in viewvalues(proteindb.proteins):
        if len(proteinEntry.uniquePeptides) > 0:
            proteinEntry.isUnique = True
        else:
            proteinEntry.isUnique = False

    return proteindb