Skip to main content

QCModule

Trait QCModule 

Source
pub trait QCModule: Send {
Show 19 methods // Required methods fn process_sequence(&mut self, sequence: &Sequence); fn name(&self) -> &str; fn description(&self) -> &str; fn reset(&mut self); fn raises_error(&self) -> bool; fn raises_warning(&self) -> bool; fn ignore_filtered_sequences(&self) -> bool; fn ignore_in_report(&self) -> bool; fn write_text_report(&self, writer: &mut dyn Write) -> Result<()>; // Provided methods fn cost_hint(&self) -> u32 { ... } fn set_filename(&mut self, _name: &str) { ... } fn attach_live_stats(&mut self, _live: Arc<LiveStats>) { ... } fn set_phred_encoding(&mut self, _encoding: PhredEncoding) { ... } fn finalize(&mut self) { ... } fn status(&self) -> ModuleStatus { ... } fn chart_image_name(&self) -> Option<&str> { ... } fn chart_alt_text(&self) -> Option<&str> { ... } fn generate_chart_svg(&self) -> Option<String> { ... } fn write_html_report(&self, writer: &mut dyn Write, png: bool) -> Result<()> { ... }
}
Expand description

Trait that all QC analysis modules must implement.

Mirrors the QCModule Java interface method-for-method (minus Swing GUI methods like getResultsPanel()).

Required Methods§

Source

fn process_sequence(&mut self, sequence: &Sequence)

Process a single sequence record, accumulating statistics.

Source

fn name(&self) -> &str

The display name of this module as shown in the report.

Source

fn description(&self) -> &str

A longer description of what this module checks.

Source

fn reset(&mut self)

Reset the module to its initial state.

Source

fn raises_error(&self) -> bool

Whether the module results should trigger a failure status.

Source

fn raises_warning(&self) -> bool

Whether the module results should trigger a warning status.

Source

fn ignore_filtered_sequences(&self) -> bool

Whether this module should skip sequences flagged as filtered.

Source

fn ignore_in_report(&self) -> bool

Whether this module should be excluded from the report. Matches ignoreInReport() - used e.g. by PerTileQuality when there are no tile IDs in the data.

Source

fn write_text_report(&self, writer: &mut dyn Write) -> Result<()>

Write this module’s section to the text report.

Provided Methods§

Source

fn cost_hint(&self) -> u32

A rough, static hint of this module’s per-sequence processing cost relative to the other modules. It is used only to balance the modules across worker threads in the parallel analysis pipeline, so that the few expensive modules don’t pile onto one thread. The values are approximate and never affect results — a wrong hint only costs a little parallel efficiency, never correctness. Keep them in proportion to a profile of the default modules on short reads; the default suits a near-free module.

Source

fn set_filename(&mut self, _name: &str)

Set the source filename for this module. BasicStats uses this to display the filename in the report. Other modules ignore it.

Source

fn attach_live_stats(&mut self, _live: Arc<LiveStats>)

Attach a shared snapshot sink that the module publishes partial results to while it runs, so the terminal progress display can show live statistics. Only BasicStats implements this; every other module ignores it, and nothing about the analysis changes when no sink is attached.

Source

fn set_phred_encoding(&mut self, _encoding: PhredEncoding)

Tell the module the quality encoding specified by the input format, when there is one (BAM/SAM, where quality is Phred+33 by construction). Modules that would otherwise infer the encoding from the lowest quality character use this instead; other modules ignore it. Never called for formats like FASTQ where the encoding must be inferred.

Source

fn finalize(&mut self)

Finalize calculations after all sequences have been processed.

In Java, modules lazily compute results in synchronized methods called from getResultsPanel()/makeReport()/raisesError()/raisesWarning(). In Rust, we separate the mutable computation phase (finalize) from the immutable reporting phase so that raises_error/raises_warning/write_text_report can take &self.

Source

fn status(&self) -> ModuleStatus

The current status of this module.

Source

fn chart_image_name(&self) -> Option<&str>

Return the base filename for this module’s chart image (without extension). Matches the filenames used in Images/ directory of the zip archive, e.g. “per_base_quality” for per_base_quality.png and per_base_quality.svg.

Source

fn chart_alt_text(&self) -> Option<&str>

Return the alt text for this module’s chart image, if it has one. Modules that produce charts should override this to return Some(“…”). The default write_html_report uses this to call write_chart_and_table automatically, so modules with charts only need to implement this method instead of overriding write_html_report.

Source

fn generate_chart_svg(&self) -> Option<String>

Generate the SVG chart content for this module, if applicable. In Java, writeDefaultImage() renders the Swing JPanel to both SVG and PNG. Here we generate SVG first, then convert to PNG via resvg.

Source

fn write_html_report(&self, writer: &mut dyn Write, png: bool) -> Result<()>

Write this module’s HTML content (table and/or chart image) to the report.

In Java, each module’s makeReport() calls writeTable() which calls writeXhtmlTable() then writeTextTable(). Some modules also call writeDefaultImage() to embed a chart. The default implementation here checks for chart_alt_text() – if present, it renders the chart and table via write_chart_and_table; otherwise it renders just an HTML table from the text report output, matching writeXhtmlTable().

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§