# Path: phe/mapping/mapping_factory.py
# def available_mappers():
#     """Return a list of available mappers."""
#     return _avail_mappers.keys()
# 
# Path: phe/mapping/mapping_factory.py
# def factory(mapper=None, custom_options=None):
#     """Create an instance of a mapper from _config_.
#     
#     Parameters
#     ----------
#     mapper: str, optional
#         Name of the mapper to initialise.
#     custom_options: str, optional
#         Custom options to be passed to the mapper.
#         
#     Returns
#     -------
#     :py:class:`phe.mapping.Mapper`:
#         Instance of a :py:class:`phe.mapping.Mapper` with provided name, or
#         None if the mapper could not be found.
#     """
#     if mapper is not None and isinstance(mapper, str):
# 
#         mapper = mapper.lower()
#         if mapper in _avail_mappers:
#             try:
#                 obj = _avail_mappers[mapper](cmd_options=custom_options)
#             except Exception as e:
#                 logging.error("Could not initialise mapper: %s", mapper)
#                 logging.error(e.message)
#                 obj = None
# 
#         else:
#             logging.error("No implementation for %s mapper.", mapper)
#             obj = None
#         return obj
# 
#     logging.warn("Unknown parameters. Mapper could not be initialised.")
#     return None
# 
# Path: phe/variant/variant_factory.py
# def available_callers():
#     """Return list of available variant callers."""
#     return _avail_variant_callers.keys()
# 
# Path: phe/variant/variant_factory.py
# def factory(variant=None, custom_options=None):
#     """Make an instance of a variant class.
#     
#     Parameters
#     ----------
#     variant: str, optional
#         Name of the variant class to instantiate.
#     custom_options: str, optional
#         Custom options to be passed directly to the implementing class.
#     
#     Returns
#     -------
#     :py:class:`phe.variant.VariantCaller`:
#         Instance of the :py:class:`phe.variant.VariantCaller` for given
#         variant name, or None if one couldn't be found.
#     """
#     if variant is not None and isinstance(variant, str):
# 
#         variant = variant.lower()
#         if variant in _avail_variant_callers:
#             try:
#                 obj = _avail_variant_callers[variant](cmd_options=custom_options)
#             except Exception as e:
#                 logging.error(e.message)
#                 obj = None
#         else:
#             logging.error("No implementation for %s variant.", variant)
#             obj = None
# 
#         return obj
# 
#     logging.warn("Unknown parameters. Mapper could not be initialised.")
#     return None


import argparse
import logging
from phe.mapping.mapping_factory import available_mappers
from phe.mapping.mapping_factory import factory as map_fac
from phe.variant.variant_factory import available_callers
from phe.variant.variant_factory import factory as var_fac
"""Prepare reference for different mappers and variant callers.

:Date: 6 October, 2015
:Author: Alex Jironkin
"""



def get_desc():
    return "Prepare reference for SNP pipeline by generating required aux files."

def get_args():
    args = argparse.ArgumentParser(description=get_desc())

    args.add_argument("--reference", "-r", required=True, help="Path to reference file to prepare.")

    args.add_argument("--mapper", help="Available mappers: %s" % available_mappers())

# Path: phe/mapping/mapping_factory.py
# def available_mappers():
#     """Return a list of available mappers."""
#     return _avail_mappers.keys()
# 
# Path: phe/mapping/mapping_factory.py
# def factory(mapper=None, custom_options=None):
#     """Create an instance of a mapper from _config_.
#     
#     Parameters
#     ----------
#     mapper: str, optional
#         Name of the mapper to initialise.
#     custom_options: str, optional
#         Custom options to be passed to the mapper.
#         
#     Returns
#     -------
#     :py:class:`phe.mapping.Mapper`:
#         Instance of a :py:class:`phe.mapping.Mapper` with provided name, or
#         None if the mapper could not be found.
#     """
#     if mapper is not None and isinstance(mapper, str):
# 
#         mapper = mapper.lower()
#         if mapper in _avail_mappers:
#             try:
#                 obj = _avail_mappers[mapper](cmd_options=custom_options)
#             except Exception as e:
#                 logging.error("Could not initialise mapper: %s", mapper)
#                 logging.error(e.message)
#                 obj = None
# 
#         else:
#             logging.error("No implementation for %s mapper.", mapper)
#             obj = None
#         return obj
# 
#     logging.warn("Unknown parameters. Mapper could not be initialised.")
#     return None
# 
# Path: phe/variant/variant_factory.py
# def available_callers():
#     """Return list of available variant callers."""
#     return _avail_variant_callers.keys()
# 
# Path: phe/variant/variant_factory.py
# def factory(variant=None, custom_options=None):
#     """Make an instance of a variant class.
#     
#     Parameters
#     ----------
#     variant: str, optional
#         Name of the variant class to instantiate.
#     custom_options: str, optional
#         Custom options to be passed directly to the implementing class.
#     
#     Returns
#     -------
#     :py:class:`phe.variant.VariantCaller`:
#         Instance of the :py:class:`phe.variant.VariantCaller` for given
#         variant name, or None if one couldn't be found.
#     """
#     if variant is not None and isinstance(variant, str):
# 
#         variant = variant.lower()
#         if variant in _avail_variant_callers:
#             try:
#                 obj = _avail_variant_callers[variant](cmd_options=custom_options)
#             except Exception as e:
#                 logging.error(e.message)
#                 obj = None
#         else:
#             logging.error("No implementation for %s variant.", variant)
#             obj = None
# 
#         return obj
# 
#     logging.warn("Unknown parameters. Mapper could not be initialised.")
#     return None


# Path: scripts/prepare_reference.py
import argparse
import logging
from phe.mapping.mapping_factory import available_mappers
from phe.mapping.mapping_factory import factory as map_fac
from phe.variant.variant_factory import available_callers
from phe.variant.variant_factory import factory as var_fac

"""Prepare reference for different mappers and variant callers.

:Date: 6 October, 2015
:Author: Alex Jironkin
"""



def get_desc():
    return "Prepare reference for SNP pipeline by generating required aux files."

def get_args():
    args = argparse.ArgumentParser(description=get_desc())

    args.add_argument("--reference", "-r", required=True, help="Path to reference file to prepare.")

    args.add_argument("--mapper", help="Available mappers: %s" % available_mappers())

    args.add_argument("--variant", help="Available variants: %s" % available_callers())