def psmid_to_usi(psmid, project_id):
    """
    Convert Percolator out PSMId to HUPO-PSI Universal Spectrum Identifier.
    See http://www.psidev.info/usi for more info.
    
    Expects the following formatted PSMId:
    `run` _ `SII` _ `MSGFPlus spectrum index` _ `PSM rank` _ `scan number` _ `MSGFPlus-assigned charge` _ `rank`
    See https://github.com/percolator/percolator/issues/147
    """
    psmid = psmid.split('_')
    usi = ':'.join(['mzspec', project_id, '_'.join(psmid[:-6]), 'scan', psmid[-3]])    
    return usi