tracts.plot.plot_tract_length_distributions_from_output#

plot_tract_length_distributions_from_output(output_dir, output_filename_format=None, log_scale=True, save_dir=None, sum_female_and_male_allosome_tracts=True, autosome_title='Autosomal tract length distributions', allosome_title='X-chromosome tract length distributions', female_allosome_title='Female X-chromosome tract length distributions', male_allosome_title='Male X-chromosome tract length distributions', subtitle=None, xlabel='Tract Length (M)', ylabel='Count', title_fontsize=14, subtitle_fontsize=10, label_fontsize=12, tick_fontsize=10, legend_fontsize=10)#

Re-produces the autosomal and (if present) allosomal tract length distribution plots (observed counts against the predicted distribution), directly from the tract length distribution output files saved in output_dir by a previous run_tracts() run, without re-running the inference.

Whether allosomal plots are produced at all is inferred from whether allosomal output files are present in output_dir. When they are, sum_female_and_male_allosome_tracts controls whether female and male allosomal tracts are combined into a single plot (default) or plotted separately.

Parameters:
  • output_dir (str | Path) – The output directory (as produced by run_tracts()) from which to read the data and predicted tract length distributions.

  • output_filename_format (str | None) – The output filename format used to produce the files in output_dir, as specified in the driver file used for the original run (or its default value, see OutputConfig). If None, it is automatically inferred from the files present in output_dir.

  • log_scale (bool) – Whether to use log scale for the y-axis. Defaults to True. Does not have to match the value used in the original run: this can be used to reformat plots.

  • save_dir (str | Path | None) – The directory in which to save the re-produced plots (created if it does not already exist). If None, defaults to output_dir, overwriting the original plots in place.

  • sum_female_and_male_allosome_tracts (bool) – If allosomes are present in the sample, whether to plot the female and male allosomal tract length distributions summed into a single plot (default) or as two separate plots. Both the summed and per-sex output files are always saved by output_simulation_data_sex_biased(), so either can be plotted from the same output_dir regardless of this setting. Defaults to True.

  • autosome_title (str) – The title of the autosomal plot. Defaults to “Autosomal tract length distributions”.

  • allosome_title (str) – The title of the allosomal plot, when female and male tracts are combined into a single plot. Defaults to “X-chromosome tract length distributions”.

  • female_allosome_title (str) – The title of the female allosomal plot, when female and male tracts are plotted separately. Defaults to “Female X-chromosome tract length distributions”.

  • male_allosome_title (str) – The title of the male allosomal plot, when female and male tracts are plotted separately. Defaults to “Male X-chromosome tract length distributions”.

  • subtitle (str | None) – An optional subtitle, applied to every plot produced by this call. If None (default), it is computed from the saved likelihood, as “Log-likelihood: {value}”.

  • xlabel (str) – The label for the x-axis. Defaults to “Tract Length (M)”.

  • ylabel (str) – The label for the y-axis. Defaults to “Count”.

  • title_fontsize (float) – The font size of the title. Defaults to 14.

  • subtitle_fontsize (float) – The font size of the subtitle. Defaults to 10.

  • label_fontsize (float) – The font size of the x- and y-axis labels. Defaults to 12.

  • tick_fontsize (float) – The font size of the tick labels. Defaults to 10.

  • legend_fontsize (float) – The font size of the legend text and titles. Defaults to 10.

Return type:

None