mgf_search_result_annotator.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:spectra-cluster-py 作者: spectra-cluster 项目源码 文件源码
def parse_msgfplus(filename, fdr):
    """
    Extracts the PSMs from a MSGF+ search result file.

    :param filename: Filename of the MSGF+ search result file (only text file supported)
    :param fdr: Target FDR as fractional (ie. 0.01 for 1%)
    :return: A list of PSM objects
    """
    msgfplus_results = list()
    with open(filename, newline="") as result_file:
        msgfplus_result_reader = csv.DictReader(result_file, delimiter="\t", quoting=csv.QUOTE_NONE)

        for msgfplus_psm in msgfplus_result_reader:
            # ignore all PSMs below the set FDR
            if float(msgfplus_psm['PepQValue']) > fdr:
                continue

            psm = Psm(int(msgfplus_psm["SpecID"][6:]), msgfplus_psm["Peptide"])
            msgfplus_results.append(psm)

    return msgfplus_results
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号