Takes the output list of a PISCES cull and returns in a usable dictionary.

    Notes
    -----
    Designed for outputs of protein sequence redundancy culls conducted using the PISCES server.
    http://dunbrack.fccc.edu/PISCES.php
    G. Wang and R. L. Dunbrack, Jr. PISCES: a protein sequence culling server. Bioinformatics, 19:1589-1591, 2003.

    Parameters
    ----------
    pisces_output : str or path
        Output list of non-redundant protein chains from PISCES, or path to text file.
    path : bool
        True if path given rather than string.

    Returns
    -------
    pisces_dict : dict
        Data output by PISCES in dictionary form.

def parse_PISCES_output(pisces_output, path=False):
    """ Takes the output list of a PISCES cull and returns in a usable dictionary.

    Notes
    -----
    Designed for outputs of protein sequence redundancy culls conducted using the PISCES server.
    http://dunbrack.fccc.edu/PISCES.php
    G. Wang and R. L. Dunbrack, Jr. PISCES: a protein sequence culling server. Bioinformatics, 19:1589-1591, 2003.

    Parameters
    ----------
    pisces_output : str or path
        Output list of non-redundant protein chains from PISCES, or path to text file.
    path : bool
        True if path given rather than string.

    Returns
    -------
    pisces_dict : dict
        Data output by PISCES in dictionary form.
    """
    pisces_dict = {}
    if path:
        pisces_path = Path(pisces_output)
        pisces_content = pisces_path.read_text().splitlines()[1:]
    else:
        pisces_content = pisces_output.splitlines()[1:]
    for line in pisces_content:
        pdb = line.split()[0][:4].lower()
        chain = line.split()[0][-1]
        pdb_dict = {'length': line.split()[1],
                    'method': line.split()[2],
                    'resolution': line.split()[3],
                    'R-factor': line.split()[4],
                    'R-free': line.split()[5]}
        if pdb in pisces_dict:
            pisces_dict[pdb]['chains'].append(chain)
        else:
            pdb_dict['chains'] = [chain]
            pisces_dict[pdb] = pdb_dict
    return pisces_dict