Parse the MACH file and generate the list of jobs.

    :param args: Arguments from parseargs
    :param filename: name of file containing list of mach dosage files
    :return jobs to be run

def split_mach_jobs(args, filename):
    """Parse the MACH file and generate the list of jobs.

    :param args: Arguments from parseargs
    :param filename: name of file containing list of mach dosage files
    :return jobs to be run
    """
    max_snp_count = args.snps_per_job

    job_list = {}
    cur = None
    last_pos = None
    job_string = ""
    job_name = ""

    mach_count = 1
    if args.mach_count:
        mach_count = args.mach_count

    ExitIf("mvmany doesn't support splitting mach jobs into pieces at this time", max_snp_count > 1)

    dosage_files = []
    for line in open(filename):
        dosage_files.append(line.strip().split("/")[-1].split(".")[0])
        dosage_files.append(".".join(line.strip().split()[-1].split("/")[-1].split(".")[0:-1]))

    file_count = len(dosage_files)
    job_count = int(math.ceil(float(file_count) / mach_count))

    for job_num in range(job_count):
        job_idx = job_num * mach_count + 1
        job_string = "--mach-count %d --mach-offset %d" % (mach_count, job_idx)
        job_name = "job%04d-%s" % (job_num+1, dosage_files[job_idx - 1])
        job_list[job_name] = job_string

    return job_list