Beispiel #1
0
def plot_figure_S6_panels():
    """
    Plot panels used in Figure S6.
    """

    ###
    # Reproduction of manuscript Figure 3D varying the number of SNPs
    # interrogated on the chromosome of interest.
    ###

    wgs_file = "wgs_method_10000affected.csv"

    snp_dirs = [
        ANALYSES_DIR + "snp_method_bbdisp1000_nbdisp0.0005_snps1000",
        ANALYSES_DIR + "snp_method_bbdisp1000_nbdisp0.0005",
        ANALYSES_DIR + "snp_method_bbdisp1000_nbdisp0.0005_snps6000",
        ANALYSES_DIR + "snp_method_bbdisp1000_nbdisp0.0005_snps10000"
    ]

    outfiles = [
        "Fig_S6_01_snp_1000snps.png", "Fig_S6_02_snp_3348snps.png",
        "Fig_S6_03_snp_6000snps.png", "Fig_S6_04_snp_10000snps.png"
    ]

    for snp_dir, outfile in zip(snp_dirs, outfiles):

        ylab = False
        if snp_dir == snp_dirs[0]:
            ylab = True
        comp_sensitivity_plot(ANALYSES_DIR + wgs_file,
                              snp_dir,
                              FIGURES_DIR + outfile,
                              ylab=ylab)
Beispiel #2
0
def plot_figure_S1_panels():
    """
    Plot panels used in Figure S1.
    """

    ###
    # A Panels - plot effect of depth on bin counts across simulated chromosome
    #            21
    ###

    depths = [5e6, 11.5e6, 16e6,
              25e6]  #Note that nbdisp = 1 collapses to Poisson
    outfiles = [
        "Fig_S1A_wgs_d5M.png", "Fig_S1A_wgs_d11.5M.png",
        "Fig_S1A_wgs_d16M.png", "Fig_S1A_wgs_d25M.png"
    ]

    for depth, outfile in zip(depths, outfiles):
        if depth == 5e6:
            plot_wgs_chr21_dip_tri(depth=depth,
                                   outfile=outfile,
                                   ylab=True,
                                   var_y=True)
        else:
            plot_wgs_chr21_dip_tri(depth=depth, outfile=outfile, var_y=True)

    ###
    # B Panels - Reproduction of manuscript Figure 3D under different
    #            sequencing depths for the WGS method.
    ###

    wgs_files = [
        "wgs_method_10000affected_d5M.csv",
        "wgs_method_10000affected_d11.5M.csv", "wgs_method_10000affected.csv",
        "wgs_method_10000affected_d25M.csv"
    ]

    outfiles = [
        "Fig_S1B_wgs_depth_5M.png", "Fig_S1B_wgs_depth_11.5M.png",
        "Fig_S1B_wgs_depth_16M.png", "Fig_S1B_wgs_depth_25M.png"
    ]

    snp_dir = ANALYSES_DIR + "snp_method_bbdisp1000_nbdisp0.0005"

    for wgs_file, outfile in zip(wgs_files, outfiles):

        ylab = False
        if wgs_file == "wgs_method_10000affected_d5M.csv":
            ylab = True
        comp_sensitivity_plot(ANALYSES_DIR + wgs_file,
                              snp_dir,
                              FIGURES_DIR + outfile,
                              ylab=ylab)
Beispiel #3
0
def plot_figure_S2_panels():
    """
    Plot panels used in Figure S2.
    """

    ###
    # A Panels - plot of dispersion of bin counts across simulated chromosome
    #            21
    ###

    nbdisps = [0.1, 0.333, 0.666,
               1]  #Note that nbdisp = 1 collapses to Poisson
    outfiles = [
        "Fig_S2A_wgs_neg_binom_0.1.png", "Fig_S2A_wgs_neg_binom_0.333.png",
        "Fig_S2A_wgs_neg_binom_0.666.png", "Fig_S2A_wgs_neg_binom_Poisson.png"
    ]

    for nbdisp, outfile in zip(nbdisps, outfiles):
        if nbdisp == 0.1:
            plot_wgs_chr21_dip_tri(nbdisp=nbdisp, outfile=outfile, ylab=True)
        else:
            plot_wgs_chr21_dip_tri(nbdisp=nbdisp, outfile=outfile)

    ###
    # B Panels - Reproduction of manuscript Figure 3D under different values of
    #            nbdisp for the WGS method.
    ###

    wgs_files = [
        "wgs_method_10000affected_nb0.1.csv",
        "wgs_method_10000affected_nb0.333.csv",
        "wgs_method_10000affected_nb0.666.csv", "wgs_method_10000affected.csv"
    ]

    outfiles = [
        "Fig_S2B_wgs_neg_binom_0.1.png", "Fig_S2B_wgs_neg_binom_0.333.png",
        "Fig_S2B_wgs_neg_binom_0.666.png", "Fig_S2B_wgs_neg_binom_Poisson.png"
    ]

    snp_dir = ANALYSES_DIR + "snp_method_bbdisp1000_nbdisp0.0005"

    for wgs_file, outfile in zip(wgs_files, outfiles):

        ylab = False
        if wgs_file == "wgs_method_10000affected_nb0.1.csv":
            ylab = True
        comp_sensitivity_plot(ANALYSES_DIR + wgs_file,
                              snp_dir,
                              FIGURES_DIR + outfile,
                              ylab=ylab)
Beispiel #4
0
def plot_figure_S5_panels():
    """
    Plot panels used in Figure S5.
    """

    ###
    # A Panels - Allele fractions and corresponding distributions for samples
    #            simulated under the SNP method with varying values of nbdisp
    ###

    ff = 0.1  # Fetal fraction
    num_snps = 3348  # Number of SNPs per chromosome
    mean_counts = 859  # Mean counts per SNP
    bbdisp = 1000  # Beta binomial dispersion parameter

    panels = {
        "01_disomy_nbdisp0.0005": [(1, 1, None), 0.0005],
        "02_disomy_nbdisp0.005": [(1, 1, None), 0.005],
        "03_disomy_nbdisp0.05": [(1, 1, None), 0.05],
        "04_disomy_nbdisp1": [(1, 1, None), 1],
        "05_maternal_m1_nbdisp0.0005": [(2, 1, 1), 0.0005],
        "06_maternal_m1_nbdisp0.005": [(2, 1, 1), 0.005],
        "07_maternal_m1_nbdisp0.05": [(2, 1, 1), 0.05],
        "08_maternal_m1_nbdisp1": [(2, 1, 1), 1],
    }

    for key, val in panels.iteritems():

        ylab = False
        if (key == "01_disomy_nbdisp0.0005"
                or key == "05_maternal_m1_nbdisp0.0005"):
            ylab = True

        df_points = simulate_snp_sample(ff=ff,
                                        H=val[0],
                                        num_snps=num_snps,
                                        mean_counts=mean_counts,
                                        bbdisp=bbdisp,
                                        nbdisp=val[1])

        df_dist = simulate_snp_sample(ff=ff,
                                      H=val[0],
                                      num_snps=100000,
                                      mean_counts=mean_counts,
                                      bbdisp=bbdisp,
                                      nbdisp=val[1])

        generate_snp_method_fig1_plot(points=df_points,
                                      distros=df_dist,
                                      outfile="Fig_S5A_{}.png".format(key),
                                      bbdisp=bbdisp,
                                      nbdisp=val[1],
                                      ylab=ylab)

    ###
    # B Panels - Reproduction of manuscript Figure 3D under different values of
    #            nbdisp under the SNP method.
    ###

    wgs_file = "wgs_method_10000affected.csv"

    snp_dirs = [
        ANALYSES_DIR + "snp_method_bbdisp1000_nbdisp0.0005",
        ANALYSES_DIR + "snp_method_bbdisp1000_nbdisp0.005",
        ANALYSES_DIR + "snp_method_bbdisp1000_nbdisp0.05",
        ANALYSES_DIR + "snp_method_bbdisp1000_nbdisp1"
    ]

    outfiles = [
        "Fig_S5B_01_snp_nbdisp0.0005.png", "Fig_S5B_02_snp_nbdisp0.005.png",
        "Fig_S5B_03_snp_nbdisp0.05.png", "Fig_S5B_04_snp_nbdisp1.png"
    ]

    for snp_dir, outfile in zip(snp_dirs, outfiles):

        ylab = False
        if snp_dir == snp_dirs[0]:
            ylab = True
        comp_sensitivity_plot(ANALYSES_DIR + wgs_file,
                              snp_dir,
                              FIGURES_DIR + outfile,
                              ylab=ylab)
Beispiel #5
0
def plot_figure_S4_panels():
    """
    Plot panels used in Figure S4.
    """

    ###
    # A Panels - Allele fractions and corresponding distributions for samples
    #            simulated under the SNP method with varying values of bbdisp
    ###

    ff = 0.1  # Fetal fraction
    num_snps = 3348  # Number of SNPs per chromosome
    mean_counts = 859  # Mean counts per SNP
    nbdisp = 0.0005  # Negative binomial dispersion parameter

    panels = {
        "01_disomy_bbdisp100": [(1, 1, None), 100],
        "02_disomy_bbdisp1000": [(1, 1, None), 1000],
        "03_disomy_bbdisp10000": [(1, 1, None), 10000],
        "04_disomy_binomial": [(1, 1, None), 'binomial'],
        "05_maternal_m1_bbdisp100": [(2, 1, 1), 100],
        "06_maternal_m1_bbdisp1000": [(2, 1, 1), 1000],
        "07_maternal_m1_bbdisp10000": [(2, 1, 1), 10000],
        "08_maternal_m1_binomial": [(2, 1, 1), 'binomial'],
    }

    for key, val in panels.iteritems():

        ylab = False
        if (key == "01_disomy_bbdisp100" or key == "05_maternal_m1_bbdisp100"):
            ylab = True

        df_points = simulate_snp_sample(ff=ff,
                                        H=val[0],
                                        num_snps=num_snps,
                                        mean_counts=mean_counts,
                                        bbdisp=val[1],
                                        nbdisp=nbdisp)

        df_dist = simulate_snp_sample(ff=ff,
                                      H=val[0],
                                      num_snps=100000,
                                      mean_counts=mean_counts,
                                      bbdisp=val[1],
                                      nbdisp=nbdisp)

        #For distribution plotting purposes, setting bbdisp to extremely high
        #value is indistiguishable from the binomial.
        generate_snp_method_fig1_plot(points=df_points,
                                      distros=df_dist,
                                      outfile="Fig_S4A_{}.png".format(key),
                                      bbdisp=val[1],
                                      nbdisp=nbdisp,
                                      ylab=ylab)

    ###
    # B Panels - Reproduction of manuscript Figure 3D under different values of
    #            bbdisp under the SNP method.
    ###

    wgs_file = "wgs_method_10000affected.csv"

    snp_dirs = [
        ANALYSES_DIR + "snp_method_bbdisp100_nbdisp0.0005",
        ANALYSES_DIR + "snp_method_bbdisp1000_nbdisp0.0005",
        ANALYSES_DIR + "snp_method_bbdisp10000_nbdisp0.0005",
        ANALYSES_DIR + "snp_method_binomial_nbdisp0.0005"
    ]

    outfiles = [
        "Fig_S4B_01_snp_bbdisp100.png", "Fig_S4B_02_snp_bbdisp1000.png",
        "Fig_S4B_03_snp_bbdisp10000.png", "Fig_S4B_04_snp_binomial.png"
    ]

    for snp_dir, outfile in zip(snp_dirs, outfiles):

        ylab = False
        if snp_dir == snp_dirs[0]:
            ylab = True
        comp_sensitivity_plot(ANALYSES_DIR + wgs_file,
                              snp_dir,
                              FIGURES_DIR + outfile,
                              ylab=ylab)