How to use the pyopenms.IDMapper function in pyopenms

To help you get started, we’ve selected a few pyopenms examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github OpenMS / OpenMS / pyOpenMS / pyTOPP / IDMapper.py View on Github external
def id_mapper(in_file, id_file, out_file, params, use_centroid_rt,
        use_centroid_mz, use_subelements ):

    in_type = pms.FileHandler.getType(in_file)

    protein_ids = []
    peptide_ids = []

    pms.IdXMLFile().load(id_file, protein_ids, peptide_ids)

    mapper = pms.IDMapper()
    mapper.setParameters(params)

    if in_type == pms.Type.CONSENSUSXML:
        file_ = pms.ConsensusXMLFile()
        map_ = pms.ConsensusMap()
        file_.load(in_file, map_)
        mapper.annotate(map_, peptide_ids, protein_ids, use_subelements)
        addDataProcessing(map_, params, pms.ProcessingAction.IDENTIFICATION_MAPPING)
        file_.store(out_file, map_)

    elif in_type == pms.Type.FEATUREXML:
        file_ = pms.FeatureXMLFile()
        map_ = pms.FeatureMap()
        file_.load(in_file, map_)
        mapper.annotate(map_, peptide_ids, protein_ids, use_centroid_rt,
                use_centroid_mz)
github OpenMS / OpenMS / pyOpenMS / pyTOPP / IDMapper.py View on Github external
args = parser.parse_args()



    run_mode = (args.in_ and args.id_ and args.out) \
                and (args.ini is not None or args.dict_ini is not None)

    write_mode = args.write_ini is not None or args.write_dict_ini is not None
    ok = run_mode or write_mode
    if not ok:
        parser.error("either specify -id, -in, -out and -(dict)ini for running "
                     "the id mapper\nor -write(dict)ini for creating std "
                     "ini file")

    defaults = pms.IDMapper().getParameters()
    write_requested = writeParamsIfRequested(args, defaults)

    if not write_requested:
        updateDefaults(args, defaults)

        dd = defaults.asDict()
        dd["ignore_charge"] = "true" if args.ignore_charge else "false"
        for att in ["mz_tolerance", "rt_tolerance", "mz_measure",
                "mz_reference"]:
            value = getattr(args, att)
            if value is not None:
                dd[att] = value

        defaults.update(dd)
        feature_use_centroid_rt = getattr(args, "feature:use_centroid_rt")
        feature_use_centroid_mz = getattr(args, "feature:use_centroid_mz")
github OpenMS / OpenMS / src / pyOpenMS / pyTOPP / IDMapper.py View on Github external
def id_mapper(in_file, id_file, out_file, params, use_centroid_rt,
        use_centroid_mz, use_subelements ):

    in_type = pms.FileHandler.getType(in_file)

    protein_ids = []
    peptide_ids = []

    pms.IdXMLFile().load(id_file, protein_ids, peptide_ids)

    mapper = pms.IDMapper()
    mapper.setParameters(params)

    if in_type == pms.Type.CONSENSUSXML:
        file_ = pms.ConsensusXMLFile()
        map_ = pms.ConsensusMap()
        file_.load(in_file, map_)
        mapper.annotate(map_, peptide_ids, protein_ids, use_subelements)
        addDataProcessing(map_, params, pms.ProcessingAction.IDENTIFICATION_MAPPING)
        file_.store(out_file, map_)

    elif in_type == pms.Type.FEATUREXML:
        file_ = pms.FeatureXMLFile()
        map_ = pms.FeatureMap()
        file_.load(in_file, map_)
        mapper.annotate(map_, peptide_ids, protein_ids, use_centroid_rt,
                use_centroid_mz)
github OpenMS / OpenMS / src / pyOpenMS / pyTOPP / IDMapper.py View on Github external
args = parser.parse_args()



    run_mode = (args.in_ and args.id_ and args.out) \
                and (args.ini is not None or args.dict_ini is not None)

    write_mode = args.write_ini is not None or args.write_dict_ini is not None
    ok = run_mode or write_mode
    if not ok:
        parser.error("either specify -id, -in, -out and -(dict)ini for running "
                     "the id mapper\nor -write(dict)ini for creating std "
                     "ini file")

    defaults = pms.IDMapper().getParameters()
    write_requested = writeParamsIfRequested(args, defaults)

    if not write_requested:
        updateDefaults(args, defaults)

        dd = defaults.asDict()
        dd["ignore_charge"] = "true" if args.ignore_charge else "false"
        for att in ["mz_tolerance", "rt_tolerance", "mz_measure",
                "mz_reference"]:
            value = getattr(args, att)
            if value is not None:
                dd[att] = value

        defaults.update(dd)
        feature_use_centroid_rt = getattr(args, "feature:use_centroid_rt")
        feature_use_centroid_mz = getattr(args, "feature:use_centroid_mz")