예제 #1
0
def main():

    parser = argparse.ArgumentParser(description="PeakPickerHiRes")
    parser.add_argument("-in",
                        action="append",
                        type=str,
                        dest="in_",
                        metavar="input_file",
                        )

    parser.add_argument("-seeds",
                        action="store",
                        type=str,
                        metavar="seeds_file",
                        )

    parser.add_argument("-out",
                        action="append",
                        type=str,
                        metavar="output_file",
                        )

    parser.add_argument("-trafo_out",
                        action="append",
                        type=str,
                        metavar="output_file",
                        )

    parser.add_argument("-ini",
                        action="store",
                        type=str,
                        metavar="ini_file",
                        )

    parser.add_argument("-dict_ini",
                        action="store",
                        type=str,
                        metavar="python_dict_ini_file",
                        )

    parser.add_argument("-write_ini",
                        action="store",
                        type=str,
                        metavar="ini_file",
                        )

    parser.add_argument("-write_dict_ini",
                        action="store",
                        type=str,
                        metavar="python_dict_ini_file",
                        )

    parser.add_argument("-reference:file",
                        action="store",
                        type=str,
                        metavar="reference_file",
                        dest="reference_file",
                        )
    parser.add_argument("-reference:index",
                        action="store",
                        type=int,
                        metavar="reference_index",
                        dest="reference_index",
                        )

    args = parser.parse_args()

    def collect(args):
        return [f.strip() for arg in args or [] for f in arg.split(",")]

    in_files = collect(args.in_)
    out_files = collect(args.out)
    trafo_out_files = collect(args.trafo_out)

    run_mode = (in_files and (out_files or trafo_out_files))\
                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 -in, -(trafo_)out and -(dict)ini for running "
                     "the map aligner\nor -write(dict)ini for creating std "
                     "ini file")

    defaults = getDefaultParameters()
    write_requested = writeParamsIfRequested(args, defaults)

    if not write_requested:
        updateDefaults(args, defaults)

        if not out_files and not trafo_out_files:
            parser.error("need -out or -trafo_out files")

        if out_files and len(out_files) != len(in_files):
            parser.error("need as many -out files as -in files")
        if trafo_out_files and len(trafo_out_files) != len(in_files):
            parser.error("need as many -trafo_out files as -in files")

        if args.reference_index is not None and args.reference_file is not None:
            parser.error("can only handle either reference:index or reference:file")

        if args.reference_index is not None:
            if args.reference_index <0 or args.reference_index >= len(in_files):
                parser.error("reference:index invalid")
        if args.reference_file is not None:
            if args.reference_file not in in_files:
                parser.error("reference_file not in input files")


        align(in_files, out_files, trafo_out_files, args.reference_index or 0,
                args.reference_file or "", defaults)
예제 #2
0
def main():

    parser = argparse.ArgumentParser(description="PeakPickerHiRes")
    parser.add_argument("-in",
                        action="store",
                        type=str,
                        dest="in_",
                        metavar="input_file",
                        )

    parser.add_argument("-out",
                        action="store",
                        type=str,
                        metavar="output_file",
                        )

    parser.add_argument("-ini",
                        action="store",
                        type=str,
                        metavar="ini_file",
                        )

    parser.add_argument("-dict_ini",
                        action="store",
                        type=str,
                        metavar="python_dict_ini_file",
                        )

    parser.add_argument("-write_ini",
                        action="store",
                        type=str,
                        metavar="ini_file",
                        )

    parser.add_argument("-write_dict_ini",
                        action="store",
                        type=str,
                        metavar="python_dict_ini_file",
                        )

    args = parser.parse_args()

    run_mode = args.in_ is not None and args.out is not None\
                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 -in, -out and -(dict)ini for running "
                     "the peakpicker\nor -write(dict)ini for creating std "
                     "ini file")

    defaults = pms.PeakPickerHiRes().getDefaults()

    write_requested = writeParamsIfRequested(args, defaults)

    if not write_requested:
        updateDefaults(args, defaults)

        fh = pms.MzMLFile()
        fh.setLogType(pms.LogType.CMD)
        input_map = pms.MSExperiment()
        fh.load(args.in_, input_map)

        run_peak_picker(input_map, defaults, args.out)
예제 #3
0
def main():

    parser = argparse.ArgumentParser(description="IDMapper")

    parser.add_argument(
        "-id",
        action="store",
        type=str,
        dest="id_",
        metavar="id_file",
    )

    parser.add_argument(
        "-in",
        action="store",
        type=str,
        dest="in_",
        metavar="input_file",
    )

    parser.add_argument(
        "-out",
        action="store",
        type=str,
        metavar="output_file",
    )

    parser.add_argument(
        "-ini",
        action="store",
        type=str,
        metavar="ini_file",
    )

    parser.add_argument(
        "-dict_ini",
        action="store",
        type=str,
        metavar="python_dict_ini_file",
    )

    parser.add_argument(
        "-write_ini",
        action="store",
        type=str,
        metavar="ini_file",
    )

    parser.add_argument(
        "-write_dict_ini",
        action="store",
        type=str,
        metavar="python_dict_ini_file",
    )

    parser.add_argument("-mz_tolerance", action="store", type=float)

    parser.add_argument("-rt_tolerance", action="store", type=float)

    parser.add_argument("-mz_measure", action="store", type=str)

    parser.add_argument("-mz_reference", action="store", type=str)

    parser.add_argument("-ignore_charge", action="store_true")

    parser.add_argument("-feature:use_centroid_rt", action="store_true")

    parser.add_argument("-feature:use_centroid_mz", action="store_true")

    parser.add_argument("-consensusfeature:use_subelements",
                        action="store_true")

    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")
        consenususfeature_use_subelements = getattr(
            args, "consensusfeature:use_subelements")

        id_mapper(args.in_, args.id_, args.out, defaults,
                  feature_use_centroid_rt, feature_use_centroid_mz,
                  consenususfeature_use_subelements)
예제 #4
0
def main():

    parser = argparse.ArgumentParser(description="PeakPickerHiRes")
    parser.add_argument(
        "-in",
        action="append",
        type=str,
        dest="in_",
        metavar="input_file",
    )

    parser.add_argument(
        "-seeds",
        action="store",
        type=str,
        metavar="seeds_file",
    )

    parser.add_argument(
        "-out",
        action="append",
        type=str,
        metavar="output_file",
    )

    parser.add_argument(
        "-trafo_out",
        action="append",
        type=str,
        metavar="output_file",
    )

    parser.add_argument(
        "-ini",
        action="store",
        type=str,
        metavar="ini_file",
    )

    parser.add_argument(
        "-dict_ini",
        action="store",
        type=str,
        metavar="python_dict_ini_file",
    )

    parser.add_argument(
        "-write_ini",
        action="store",
        type=str,
        metavar="ini_file",
    )

    parser.add_argument(
        "-write_dict_ini",
        action="store",
        type=str,
        metavar="python_dict_ini_file",
    )

    parser.add_argument(
        "-reference:file",
        action="store",
        type=str,
        metavar="reference_file",
        dest="reference_file",
    )
    parser.add_argument(
        "-reference:index",
        action="store",
        type=int,
        metavar="reference_index",
        dest="reference_index",
    )

    args = parser.parse_args()

    def collect(args):
        return [f.strip() for arg in args or [] for f in arg.split(",")]

    in_files = collect(args.in_)
    out_files = collect(args.out)
    trafo_out_files = collect(args.trafo_out)

    run_mode = (in_files and (out_files or trafo_out_files))\
                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 -in, -(trafo_)out and -(dict)ini for running "
            "the map aligner\nor -write(dict)ini for creating std "
            "ini file")

    defaults = getDefaultParameters()
    write_requested = writeParamsIfRequested(args, defaults)

    if not write_requested:
        updateDefaults(args, defaults)

        if not out_files and not trafo_out_files:
            parser.error("need -out or -trafo_out files")

        if out_files and len(out_files) != len(in_files):
            parser.error("need as many -out files as -in files")
        if trafo_out_files and len(trafo_out_files) != len(in_files):
            parser.error("need as many -trafo_out files as -in files")

        if args.reference_index is not None and args.reference_file is not None:
            parser.error(
                "can only handle either reference:index or reference:file")

        if args.reference_index is not None:
            if args.reference_index < 0 or args.reference_index >= len(
                    in_files):
                parser.error("reference:index invalid")
        if args.reference_file is not None:
            if args.reference_file not in in_files:
                parser.error("reference_file not in input files")

        align(in_files, out_files, trafo_out_files, args.reference_index or 0,
              args.reference_file or "", defaults)
예제 #5
0
def main():

    parser = argparse.ArgumentParser(description="FeatureLinkerUnlabeledQT")
    parser.add_argument(
        "-in",
        action="append",
        type=str,
        dest="in_",
        metavar="input_files",
    )

    parser.add_argument(
        "-out",
        action="store",
        type=str,
        metavar="output_file",
    )

    parser.add_argument(
        "-ini",
        action="store",
        type=str,
        metavar="ini_file",
    )

    parser.add_argument(
        "-dict_ini",
        action="store",
        type=str,
        metavar="python_dict_ini_file",
    )

    parser.add_argument(
        "-write_ini",
        action="store",
        type=str,
        metavar="ini_file",
    )

    parser.add_argument(
        "-write_dict_ini",
        action="store",
        type=str,
        metavar="python_dict_ini_file",
    )

    parser.add_argument(
        "-keep_subelements",
        action="store_true",
    )

    args = parser.parse_args()

    def collect(args):
        return [f.strip() for arg in args or [] for f in arg.split(",")]

    in_files = collect(args.in_)

    run_mode = (in_files 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 -in, -out and -(dict)ini for running "
                     "the feature linker\nor -write(dict)ini for creating std "
                     "ini file")

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

    if not write_requested:
        updateDefaults(args, defaults)

        link(in_files, args.out, args.keep_subelements, defaults)
예제 #6
0
def main():

    parser = argparse.ArgumentParser(description="PeakPickerHiRes")
    parser.add_argument(
        "-in",
        action="store",
        type=str,
        dest="in_",
        metavar="input_file",
    )

    parser.add_argument(
        "-out",
        action="store",
        type=str,
        metavar="output_file",
    )

    parser.add_argument(
        "-ini",
        action="store",
        type=str,
        metavar="ini_file",
    )

    parser.add_argument(
        "-dict_ini",
        action="store",
        type=str,
        metavar="python_dict_ini_file",
    )

    parser.add_argument(
        "-write_ini",
        action="store",
        type=str,
        metavar="ini_file",
    )

    parser.add_argument(
        "-write_dict_ini",
        action="store",
        type=str,
        metavar="python_dict_ini_file",
    )

    args = parser.parse_args()

    run_mode = args.in_ is not None and args.out is not None\
                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 -in, -out and -(dict)ini for running "
                     "the peakpicker\nor -write(dict)ini for creating std "
                     "ini file")

    defaults = pms.PeakPickerHiRes().getDefaults()

    write_requested = writeParamsIfRequested(args, defaults)

    if not write_requested:
        updateDefaults(args, defaults)

        fh = pms.MzMLFile()
        fh.setLogType(pms.LogType.CMD)
        input_map = pms.MSExperiment()
        fh.load(args.in_, input_map)

        run_peak_picker(input_map, defaults, args.out)
예제 #7
0
def main():

    parser = argparse.ArgumentParser(description="FeatureFinderCentroided")
    parser.add_argument("-in",
                        action="store",
                        type=str,
                        dest="in_",
                        metavar="input_file",
                        )

    parser.add_argument("-seeds",
                        action="store",
                        type=str,
                        metavar="seeds_file",
                        )

    parser.add_argument("-out",
                        action="store",
                        type=str,
                        metavar="output_file",
                        )

    parser.add_argument("-ini",
                        action="store",
                        type=str,
                        metavar="ini_file",
                        )

    parser.add_argument("-dict_ini",
                        action="store",
                        type=str,
                        metavar="python_dict_ini_file",
                        )

    parser.add_argument("-write_ini",
                        action="store",
                        type=str,
                        metavar="ini_file",
                        )

    parser.add_argument("-write_dict_ini",
                        action="store",
                        type=str,
                        metavar="python_dict_ini_file",
                        )

    args = parser.parse_args()

    run_mode = args.in_ is not None and args.out is not None\
                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 -in, -out and -(dict)ini for running "
                     "the peakpicker\nor -write(dict)ini for creating std "
                     "ini file")

    name = pms.FeatureFinderAlgorithmPicked.getProductName()
    defaults = pms.FeatureFinder().getParameters(name)

    write_requested = writeParamsIfRequested(args, defaults)

    if not write_requested:
        updateDefaults(args, defaults)

        seeds = pms.FeatureMap()
        if args.seeds:
            fh = pms.FeatureXMLFile()
            fh.load(args.seeds, seeds)

        run_featurefinder_centroided(args.in_, defaults, seeds, args.out)
예제 #8
0
파일: IDMapper.py 프로젝트: BioITer/OpenMS
def main():

    parser = argparse.ArgumentParser(description="IDMapper")

    parser.add_argument("-id",
                        action="store",
                        type=str,
                        dest="id_",
                        metavar="id_file",
                        )

    parser.add_argument("-in",
                        action="store",
                        type=str,
                        dest="in_",
                        metavar="input_file",
                        )

    parser.add_argument("-out",
                        action="store",
                        type=str,
                        metavar="output_file",
                        )

    parser.add_argument("-ini",
                        action="store",
                        type=str,
                        metavar="ini_file",
                        )

    parser.add_argument("-dict_ini",
                        action="store",
                        type=str,
                        metavar="python_dict_ini_file",
                        )

    parser.add_argument("-write_ini",
                        action="store",
                        type=str,
                        metavar="ini_file",
                        )

    parser.add_argument("-write_dict_ini",
                        action="store",
                        type=str,
                        metavar="python_dict_ini_file",
                        )

    parser.add_argument("-mz_tolerance",
                        action="store",
                        type=float)

    parser.add_argument("-rt_tolerance",
                        action="store",
                        type=float)

    parser.add_argument("-mz_measure",
                        action="store",
                        type=str)

    parser.add_argument("-mz_reference",
                        action="store",
                        type=str)

    parser.add_argument("-ignore_charge",
                        action="store_true")

    parser.add_argument("-feature:use_centroid_rt",
                        action="store_true")

    parser.add_argument("-feature:use_centroid_mz",
                        action="store_true")

    parser.add_argument("-consensusfeature:use_subelements",
                        action="store_true")

    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")
        consenususfeature_use_subelements = getattr(args,
                "consensusfeature:use_subelements")

        id_mapper(args.in_, args.id_, args.out, defaults,
                feature_use_centroid_rt,
                feature_use_centroid_mz,
                consenususfeature_use_subelements
                )
예제 #9
0
def main():

    parser = argparse.ArgumentParser(description="FeatureLinkerUnlabeledQT")
    parser.add_argument("-in",
                        action="append",
                        type=str,
                        dest="in_",
                        metavar="input_files",
                        )

    parser.add_argument("-out",
                        action="store",
                        type=str,
                        metavar="output_file",
                        )

    parser.add_argument("-ini",
                        action="store",
                        type=str,
                        metavar="ini_file",
                        )

    parser.add_argument("-dict_ini",
                        action="store",
                        type=str,
                        metavar="python_dict_ini_file",
                        )

    parser.add_argument("-write_ini",
                        action="store",
                        type=str,
                        metavar="ini_file",
                        )

    parser.add_argument("-write_dict_ini",
                        action="store",
                        type=str,
                        metavar="python_dict_ini_file",
                        )

    parser.add_argument("-keep_subelements",
                        action="store_true",
                        )


    args = parser.parse_args()


    def collect(args):
        return [f.strip() for arg in args or [] for f in arg.split(",")]

    in_files = collect(args.in_)

    run_mode = (in_files 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 -in, -out and -(dict)ini for running "
                     "the feature linker\nor -write(dict)ini for creating std "
                     "ini file")

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

    if not write_requested:
        updateDefaults(args, defaults)


        link(in_files, args.out, args.keep_subelements, defaults)