<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_final_numbers(filename, out_dir):
 """Copy the final_files file and get the number of markers and samples. :param filename: the name of the file. :param out_dir: the output directory. :type filename: str :type out_dir: str :returns: the final number of markers and samples :rtype: tuple """

    # Copying the file
    shutil.copy(filename, out_dir)

    # Reading the number of markers and samples
    nb_samples = None
    nb_markers = None
    with open(filename, "r") as i_file:
        for line in i_file:
            row = line.rstrip("\r\n").split("\t")
            if len(row) == 1:
                continue
            path, ext = os.path.splitext(row[0])
            if ext in {".bim", ".tped", ".map"}:
                nb_markers = row[1]
            elif ext in {".fam", ".ped", ".tfam"}:
                nb_samples = row[1]

    assert nb_samples
    assert nb_markers

    return nb_markers, nb_samples