def generate_multi_backend(args, variant_key):
    logging.info("Processing Genotype")
    dosage_conversion = GenotypeUtilities.impute_to_mean_conversion if args.impute_to_mean else None
    dosage_filter = get_filter(args, variant_key)
    metadata = []

    for genotype, individual_ids in ModelTraining.load_genotype_file_by_chromosome(
            args.input_genotype_file, variant_key, dosage_conversion,
            dosage_filter):
        if args.simplify_individual_id:
            logging.info("simplifying individual id")
            individual_ids = [x.split("_")[0] for x in individual_ids]

        _m = genotype.get_variants_metadata()

        metadata.append(_m)
        _chr = _m.chromosome.values[0]
        logging.log(9, "Processing {}".format(_chr))
        _o = args.output_prefix + ".chr{}".format(_chr) + ".variants.parquet"
        Parquet.save_variants(_o, genotype, individual_ids)

    logging.info("Saving metadata")
    metadata = pandas.concat(metadata)
    path_metadata_variant = args.output_prefix + ".variants_metadata.parquet"
    Parquet._save_metadata(path_metadata_variant, metadata)
def generate_single_backend(args, variant_key):
    logging.info("Loading Genotype")
    dosage_conversion = GenotypeUtilities.impute_to_mean_conversion if args.impute_to_mean else None
    dosage_filter = get_filter(args, variant_key)
    genotype, individual_ids = ModelTraining.load_genotype_file(
        args.input_genotype_file, variant_key, dosage_conversion,
        dosage_filter)

    if args.simplify_individual_id:
        logging.info("simplifying individual id")
        individual_ids = [x.split("_")[0] for x in individual_ids]

    logging.info("Saving Genotype")
    path_variant = args.output_prefix + ".variants.parquet"
    Parquet.save_variants(path_variant, genotype, individual_ids)

    logging.info("Saving metadata")
    path_metadata_variant = args.output_prefix + ".variants_metadata.parquet"
    Parquet._save_metadata(path_metadata_variant,
                           genotype.get_variants_metadata())