gunshotmatch_reports.peaks

Peak Report Generator.

Classes:

CSVReports(project)

Class for producing CSV peak reports.

PeakMetadataTable(project)

Helper class for peak metadata for insertion into a PDF or CSV report.

PeakSummary(peak_no, name, rt, area, ...)

Summary data for a ConsolidatedPeak.

Functions:

build_peak_report(project[, pdf_filename, ...])

Construct a peak report for the given project and write to the chosen file.

class CSVReports(project)[source]

Bases: object

Class for producing CSV peak reports.

Parameters:

project (Project) – A GunShotMatch project.

New in version 0.4.0.

Methods:

overview_csv()

Produce an overview report of the peaks, giving the name, retention time and peak area of the peaks.

summary_csv()

Produce a summary report of the peaks, giving the individual retention times and hits.

overview_csv()[source]

Produce an overview report of the peaks, giving the name, retention time and peak area of the peaks.

The output columns are as follows:

  • Peak No.

  • Name – The name of the top hit

  • Rt – Mean retention time

  • Area – Mean peak area

  • Area % – Mean peak area as a percentage of the largest peak

  • MF – Mean match factor for the top hit

  • Rejected – Whether the peak has been rejected (e.g. with PeakViewer)

  • Min Peak Area – The minimum peak area across the repeats.

  • Max Peak Area – The maximum peak area across the repeats.

  • Peak Area Range – The difference between the minimum and maximum peak areas.

  • Area Range Percent -ve – The difference between the minimum and mean peak areas as a percentage of the mean.

  • Area Range Percent +ve – The difference between the maximum and mean peak areas as a percentage of the mean.

The peaks are sorted from largest to smallest.

Changed in version 0.8.0: Added Min Peak Area, Max Peak Area, Peak Area Range, and Area Range Percent columns.

Return type:

str

summary_csv()[source]

Produce a summary report of the peaks, giving the individual retention times and hits.

The table for each peak mirrors the table in the PDF peak report (build_peak_report()). The peaks are sorted from largest to smallest.

Return type:

str

class PeakMetadataTable(project)[source]

Bases: object

Helper class for peak metadata for insertion into a PDF or CSV report.

Parameters:

project (Project) – A GunShotMatch project.

New in version 0.3.0.

Attributes:

area_percentages

Peak areas as percentage of largest peak

max_peak_number

The total number of peaks in the project.

num_rows

Maximum number of rows for the metadata table.

project

A GunShotMatch project.

Methods:

get_summary_for_peak(peak, peak_number)

Return a formatted summary of the peak.

get_table_for_peak(peak, peak_number)

Return tabulated data on the peak, with individual peak areas, retention times, and the top 5 hits.

area_percentages

Peak areas as percentage of largest peak

get_summary_for_peak(peak, peak_number)[source]

Return a formatted summary of the peak.

Parameters:
Return type:

PeakSummary

get_table_for_peak(peak, peak_number)[source]

Return tabulated data on the peak, with individual peak areas, retention times, and the top 5 hits.

Parameters:
Return type:

List[Tuple[str, str, str, str, str, str, str, str, str]]

max_peak_number

The total number of peaks in the project.

num_rows

Maximum number of rows for the metadata table.

project

A GunShotMatch project.

namedtuple PeakSummary(peak_no, name, rt, area, area_percentage, mf, rejected)[source]

Bases: NamedTuple

Summary data for a ConsolidatedPeak.

Formatted for insertion into a PDF or CSV peak report.

New in version 0.3.0.

Fields:
  1.  peak_no (str) – Peak number, 1-indexed

  2.  name (str) – The name of the top hit

  3.  rt (str) – Mean retention time

  4.  area (str) – Mean peak area

  5.  area_percentage (str) – Mean peak area as a percentage of the largest peak

  6.  mf (str) – Mean match factor for the top hit

  7.  rejected (str) – Whether the peak has been rejected (e.g. with PeakViewer)

__repr__()

Return a nicely formatted representation string

build_peak_report(project, pdf_filename=None, *, title_every_page=False)[source]

Construct a peak report for the given project and write to the chosen file.

Parameters:
Return type:

str

Returns:

The output filename.